Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl.cc |
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
| index c1a8d50cb2aa3363a09f5557752e37bd4f083153..708486d364ef96eb630421019187089e6a0476e4 100644 |
| --- a/chrome/browser/profiles/profile_impl.cc |
| +++ b/chrome/browser/profiles/profile_impl.cc |
| @@ -10,7 +10,6 @@ |
| #include "base/file_path.h" |
| #include "base/file_util.h" |
| #include "base/memory/scoped_ptr.h" |
| -#include "base/path_service.h" |
| #include "base/string_number_conversions.h" |
| #include "base/string_util.h" |
| #include "base/utf_string_conversions.h" |
| @@ -27,6 +26,7 @@ |
| #include "chrome/browser/defaults.h" |
| #include "chrome/browser/download/download_service.h" |
| #include "chrome/browser/download/download_service_factory.h" |
| +#include "chrome/browser/extensions/component_loader.h" |
| #include "chrome/browser/extensions/extension_devtools_manager.h" |
| #include "chrome/browser/extensions/extension_error_reporter.h" |
| #include "chrome/browser/extensions/extension_event_router.h" |
| @@ -38,6 +38,7 @@ |
| #include "chrome/browser/extensions/extension_service.h" |
| #include "chrome/browser/extensions/extension_settings_backend.h" |
| #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| +#include "chrome/browser/extensions/unpacked_installer.h" |
| #include "chrome/browser/extensions/user_script_master.h" |
| #include "chrome/browser/favicon/favicon_service.h" |
| #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| @@ -83,7 +84,6 @@ |
| #include "chrome/browser/webdata/web_data_service.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_notification_types.h" |
| -#include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_paths_internal.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/extensions/extension_permission_set.h" |
| @@ -102,11 +102,9 @@ |
| #include "content/browser/ssl/ssl_host_state.h" |
| #include "content/browser/user_metrics.h" |
| #include "content/public/browser/notification_service.h" |
| -#include "grit/browser_resources.h" |
| #include "grit/locale_settings.h" |
| #include "net/base/transport_security_state.h" |
| #include "net/http/http_server_properties.h" |
| -#include "ui/base/resource/resource_bundle.h" |
| #include "webkit/database/database_tracker.h" |
| #include "webkit/quota/quota_manager.h" |
| @@ -153,28 +151,6 @@ enum ContextType { |
| kMediaContext |
| }; |
| -typedef std::list<std::pair<FilePath::StringType, int> > |
| - ComponentExtensionList; |
| - |
| -#if defined(FILE_MANAGER_EXTENSION) |
| -void AddFileManagerExtension(ComponentExtensionList* component_extensions) { |
| -#ifndef NDEBUG |
| - const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| - if (command_line->HasSwitch(switches::kFileManagerExtensionPath)) { |
| - FilePath filemgr_extension_path = |
| - command_line->GetSwitchValuePath(switches::kFileManagerExtensionPath); |
| - component_extensions->push_back(std::make_pair( |
| - filemgr_extension_path.value(), |
| - IDR_FILEMANAGER_MANIFEST)); |
| - return; |
| - } |
| -#endif // NDEBUG |
| - component_extensions->push_back(std::make_pair( |
| - FILE_PATH_LITERAL("file_manager"), |
| - IDR_FILEMANAGER_MANIFEST)); |
| -} |
| -#endif // defined(FILE_MANAGER_EXTENSION) |
| - |
| // Gets the cache parameters from the command line. |type| is the type of |
| // request context that we need, |cache_path| will be set to the user provided |
| // path, or will not be touched if there is not an argument. |max_size| will |
| @@ -469,15 +445,17 @@ void ProfileImpl::InitExtensions(bool extensions_enabled) { |
| autoupdate_enabled, |
| extensions_enabled)); |
| - RegisterComponentExtensions(); |
| + extension_service_->component_loader()->RegisterDefaultComponentExtensions(); |
|
Aaron Boodman
2011/10/28 22:21:58
For now, if you make the change I suggested to Com
Yoyo Zhou
2011/10/31 21:58:15
+1
I've seen quite a few subtle init bugs, and lo
Yoyo Zhou
2011/10/31 21:58:15
On 2011/10/28 22:21:58, Aaron Boodman wrote:
> For
|
| + |
| extension_service_->Init(); |
| if (extensions_enabled) { |
| // Load any extensions specified with --load-extension. |
| + // TODO(yoz): this should move into ExtensionService::Init |
| if (command_line->HasSwitch(switches::kLoadExtension)) { |
| FilePath path = command_line->GetSwitchValuePath( |
| switches::kLoadExtension); |
| - extension_service_->LoadExtensionFromCommandLine(path); |
| + extension_service_->MakeUnpackedInstaller()->LoadFromCommandLine(path); |
| } |
| } |
| @@ -506,106 +484,6 @@ void ProfileImpl::InitExtensions(bool extensions_enabled) { |
| } |
| } |
| -void ProfileImpl::RegisterComponentExtensions() { |
| - // Register the component extensions. |
| - // |
| - // Component extension manifest must contain a 'key' property with a unique |
| - // public key, serialized in base64. You can create a suitable value with the |
| - // following commands on a unixy system: |
| - // |
| - // ssh-keygen -t rsa -b 1024 -N '' -f /tmp/key.pem |
| - // openssl rsa -pubout -outform DER < /tmp/key.pem 2>/dev/null | base64 -w 0 |
| - typedef std::list<std::pair<FilePath::StringType, int> > |
| - ComponentExtensionList; |
| - ComponentExtensionList component_extensions; |
| - |
| - // Bookmark manager. |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("bookmark_manager"), |
| - IDR_BOOKMARKS_MANIFEST)); |
| - |
| -#if defined(FILE_MANAGER_EXTENSION) |
| - AddFileManagerExtension(&component_extensions); |
| -#endif |
| - |
| -#if defined(USE_VIRTUAL_KEYBOARD) |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("keyboard"), |
| - IDR_KEYBOARD_MANIFEST)); |
| -#endif |
| - |
| -#if defined(OS_CHROMEOS) |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"), |
| - IDR_MOBILE_MANIFEST)); |
| - |
| - const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| - if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
| - FilePath auth_extension_path = |
| - command_line->GetSwitchValuePath(switches::kAuthExtensionPath); |
| - component_extensions.push_back(std::make_pair( |
| - auth_extension_path.value(), |
| - IDR_GAIA_TEST_AUTH_MANIFEST)); |
| - } else { |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("/usr/share/chromeos-assets/gaia_auth"), |
| - IDR_GAIA_AUTH_MANIFEST)); |
| - } |
| - |
| -#if defined(OFFICIAL_BUILD) |
| - if (browser_defaults::enable_help_app) { |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("/usr/share/chromeos-assets/helpapp"), |
| - IDR_HELP_MANIFEST)); |
| - } |
| -#endif |
| -#endif |
| - |
| - // Web Store. |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("web_store"), |
| - IDR_WEBSTORE_MANIFEST)); |
| - |
| -#if !defined(OS_CHROMEOS) |
| - // Cloud Print component app. Not required on Chrome OS. |
| - component_extensions.push_back(std::make_pair( |
| - FILE_PATH_LITERAL("cloud_print"), |
| - IDR_CLOUDPRINT_MANIFEST)); |
| -#endif // !defined(OS_CHROMEOS) |
| - |
| - for (ComponentExtensionList::iterator iter = component_extensions.begin(); |
| - iter != component_extensions.end(); ++iter) { |
| - FilePath path(iter->first); |
| - if (!path.IsAbsolute()) { |
| - if (PathService::Get(chrome::DIR_RESOURCES, &path)) { |
| - path = path.Append(iter->first); |
| - } else { |
| - NOTREACHED(); |
| - } |
| - } |
| - |
| - std::string manifest = |
| - ResourceBundle::GetSharedInstance().GetRawDataResource( |
| - iter->second).as_string(); |
| - extension_service_->register_component_extension( |
| - ExtensionService::ComponentExtensionInfo(manifest, path)); |
| - } |
| - |
| -#if defined(OS_CHROMEOS) |
| - // Register access extensions only if accessibility is enabled. |
| - if (g_browser_process->local_state()-> |
| - GetBoolean(prefs::kAccessibilityEnabled)) { |
| - FilePath path = FilePath(extension_misc::kAccessExtensionPath) |
| - .AppendASCII(extension_misc::kChromeVoxDirectoryName); |
| - std::string manifest = |
| - ResourceBundle::GetSharedInstance().GetRawDataResource( |
| - IDR_CHROMEVOX_MANIFEST).as_string(); |
| - extension_service_->register_component_extension( |
| - ExtensionService::ComponentExtensionInfo(manifest, path)); |
| - } |
| -#endif |
| -} |
| - |
| void ProfileImpl::InitPromoResources() { |
| if (promo_resource_service_) |
| return; |