diff --git a/cef.gyp b/cef.gyp index 262e27921..2ef15bb18 100644 --- a/cef.gyp +++ b/cef.gyp @@ -7,6 +7,10 @@ 'pkg-config': 'pkg-config', 'chromium_code': 1, 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/cef', + 'revision': ' <(INTERMEDIATE_DIR)/dummy_main.c' + ], + }, + ], + }, + { + # dylib for interposing Carbon calls in the plugin process. + 'target_name': 'plugin_carbon_interpose', + 'type': 'shared_library', + 'variables': { 'enable_wexit_time_destructors': 1, }, + # This target must not depend on static libraries, else the code in + # those libraries would appear twice in plugin processes: Once from + # Chromium Framework, and once from this dylib. + 'dependencies': [ + 'libcef', + ], + 'conditions': [ + ['component=="shared_library"', { + 'dependencies': [ + '<(DEPTH)/webkit/support/webkit_support.gyp:glue', + '<(DEPTH)/content/content.gyp:content_plugin', + ], + }], + ], + 'sources': [ + '<(DEPTH)/content/plugin/plugin_carbon_interpose_mac.cc', + ], + 'include_dirs': [ + '..', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', + ], + }, + 'xcode_settings': { + 'DYLIB_COMPATIBILITY_VERSION': '<(version_mac_dylib)', + 'DYLIB_CURRENT_VERSION': '<(version_mac_dylib)', + }, + 'postbuilds': [ + { + # The framework defines its load-time path + # (DYLIB_INSTALL_NAME_BASE) relative to the main executable + # (chrome). A different relative path needs to be used in + # libplugin_carbon_interpose.dylib. + 'postbuild_name': 'Fix Framework Link', + 'action': [ + 'install_name_tool', + '-change', + '@executable_path/libcef.dylib', + '@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' + ], + }, + ], + }, { 'target_name': 'cefclient_helper_app', 'type': 'executable', diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 9678e92f2..71f7e080e 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -18,6 +18,14 @@ #include "ui/base/resource/resource_bundle.h" #include "webkit/glue/user_agent.h" +namespace { + +const char kInterposeLibraryPath[] = + "@executable_path/../../../libplugin_carbon_interpose.dylib"; + +} // namespace + + CefContentClient::CefContentClient(CefRefPtr application) : application_(application), pack_loading_disabled_(false), @@ -100,6 +108,12 @@ gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) const { return value; } +#if defined(OS_MACOSX) && !defined(OS_IOS) +std::string CefContentClient::GetCarbonInterposePath() const { + return std::string(kInterposeLibraryPath); +} +#endif + FilePath CefContentClient::GetPathForResourcePack( const FilePath& pack_path, ui::ScaleFactor scale_factor) { diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h index 8f562e9e2..998b9afbd 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/content_client.h @@ -35,6 +35,10 @@ class CefContentClient : public content::ContentClient, ui::ScaleFactor scale_factor) const OVERRIDE; virtual gfx::Image& GetNativeImageNamed(int resource_id) const OVERRIDE; +#if defined(OS_MACOSX) && !defined(OS_IOS) + virtual std::string GetCarbonInterposePath() const OVERRIDE; +#endif + CefRefPtr application() const { return application_; } void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; } diff --git a/tools/distrib/cefclient.gyp b/tools/distrib/cefclient.gyp index fd59d516e..2d9f6ee3d 100644 --- a/tools/distrib/cefclient.gyp +++ b/tools/distrib/cefclient.gyp @@ -100,6 +100,7 @@ 'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks', 'files': [ '<(PRODUCT_DIR)/cefclient Helper.app', + '$(CONFIGURATION)/libplugin_carbon_interpose.dylib', ], }, ], diff --git a/tools/make_distrib.py b/tools/make_distrib.py index d5872ae38..ba3b73a13 100644 --- a/tools/make_distrib.py +++ b/tools/make_distrib.py @@ -367,9 +367,10 @@ elif platform == 'macosx': make_dir(dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'libcef.dylib'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'libplugin_carbon_interpose.dylib'), dst_dir, options.quiet) else: build_dir = None - + # transfer xcodebuild/Release files build_dir = os.path.join(src_dir, 'xcodebuild/Release') if not options.allowpartial or path_exists(build_dir): @@ -377,6 +378,7 @@ elif platform == 'macosx': make_dir(dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'libcef.dylib'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'libplugin_carbon_interpose.dylib'), dst_dir, options.quiet) if not options.nosymbols: # create the real dSYM file from the "fake" dSYM file diff --git a/tools/revision.py b/tools/revision.py new file mode 100644 index 000000000..1096c12dd --- /dev/null +++ b/tools/revision.py @@ -0,0 +1,19 @@ +# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +import svn_util as svn +import git_util as git +import sys + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + +try: + sys.stdout.write(svn.get_revision()) +except: + sys.stdout.write(git.get_svn_revision()) + +