OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/extensions/extension_sync_service.h" | 29 #include "chrome/browser/extensions/extension_sync_service.h" |
30 #include "chrome/browser/extensions/extension_util.h" | 30 #include "chrome/browser/extensions/extension_util.h" |
31 #include "chrome/browser/extensions/external_install_manager.h" | 31 #include "chrome/browser/extensions/external_install_manager.h" |
32 #include "chrome/browser/extensions/external_provider_impl.h" | 32 #include "chrome/browser/extensions/external_provider_impl.h" |
33 #include "chrome/browser/extensions/install_verifier.h" | 33 #include "chrome/browser/extensions/install_verifier.h" |
34 #include "chrome/browser/extensions/installed_loader.h" | 34 #include "chrome/browser/extensions/installed_loader.h" |
35 #include "chrome/browser/extensions/pending_extension_manager.h" | 35 #include "chrome/browser/extensions/pending_extension_manager.h" |
36 #include "chrome/browser/extensions/shared_module_service.h" | 36 #include "chrome/browser/extensions/shared_module_service.h" |
37 #include "chrome/browser/extensions/updater/extension_cache.h" | 37 #include "chrome/browser/extensions/updater/extension_cache.h" |
38 #include "chrome/browser/profiles/profile.h" | 38 #include "chrome/browser/profiles/profile.h" |
| 39 #include "chrome/browser/signin/profile_identity_provider.h" |
| 40 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 41 #include "chrome/browser/signin/signin_manager_factory.h" |
39 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 42 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
40 #include "chrome/browser/ui/webui/favicon_source.h" | 43 #include "chrome/browser/ui/webui/favicon_source.h" |
41 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 44 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| 45 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
42 #include "chrome/browser/ui/webui/theme_source.h" | 46 #include "chrome/browser/ui/webui/theme_source.h" |
43 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/crash_keys.h" | 48 #include "chrome/common/crash_keys.h" |
45 #include "chrome/common/extensions/extension_constants.h" | 49 #include "chrome/common/extensions/extension_constants.h" |
46 #include "chrome/common/extensions/features/feature_channel.h" | 50 #include "chrome/common/extensions/features/feature_channel.h" |
47 #include "chrome/common/extensions/manifest_url_handler.h" | 51 #include "chrome/common/extensions/manifest_url_handler.h" |
48 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
49 #include "chrome/common/url_constants.h" | 53 #include "chrome/common/url_constants.h" |
| 54 #include "components/signin/core/browser/signin_manager.h" |
50 #include "components/startup_metric_utils/startup_metric_utils.h" | 55 #include "components/startup_metric_utils/startup_metric_utils.h" |
51 #include "content/public/browser/devtools_agent_host.h" | 56 #include "content/public/browser/devtools_agent_host.h" |
52 #include "content/public/browser/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
53 #include "content/public/browser/render_process_host.h" | 58 #include "content/public/browser/render_process_host.h" |
54 #include "content/public/browser/storage_partition.h" | 59 #include "content/public/browser/storage_partition.h" |
55 #include "extensions/browser/event_router.h" | 60 #include "extensions/browser/event_router.h" |
56 #include "extensions/browser/extension_host.h" | 61 #include "extensions/browser/extension_host.h" |
57 #include "extensions/browser/extension_prefs.h" | 62 #include "extensions/browser/extension_prefs.h" |
58 #include "extensions/browser/extension_registry.h" | 63 #include "extensions/browser/extension_registry.h" |
59 #include "extensions/browser/extension_system.h" | 64 #include "extensions/browser/extension_system.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 using extensions::SharedModuleService; | 111 using extensions::SharedModuleService; |
107 using extensions::UnloadedExtensionInfo; | 112 using extensions::UnloadedExtensionInfo; |
108 | 113 |
109 namespace errors = extensions::manifest_errors; | 114 namespace errors = extensions::manifest_errors; |
110 | 115 |
111 namespace { | 116 namespace { |
112 | 117 |
113 // Wait this many seconds after an extensions becomes idle before updating it. | 118 // Wait this many seconds after an extensions becomes idle before updating it. |
114 const int kUpdateIdleDelay = 5; | 119 const int kUpdateIdleDelay = 5; |
115 | 120 |
| 121 #if defined(ENABLE_EXTENSIONS) |
| 122 scoped_ptr<IdentityProvider> CreateWebstoreIdentityProvider(Profile* profile) { |
| 123 return make_scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( |
| 124 SigninManagerFactory::GetForProfile(profile), |
| 125 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 126 LoginUIServiceFactory::GetForProfile(profile))); |
| 127 } |
| 128 #endif // defined(ENABLE_EXTENSIONS) |
| 129 |
116 } // namespace | 130 } // namespace |
117 | 131 |
118 // ExtensionService. | 132 // ExtensionService. |
119 | 133 |
120 void ExtensionService::CheckExternalUninstall(const std::string& id) { | 134 void ExtensionService::CheckExternalUninstall(const std::string& id) { |
121 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 135 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
122 | 136 |
123 // Check if the providers know about this extension. | 137 // Check if the providers know about this extension. |
124 extensions::ProviderCollection::const_iterator i; | 138 extensions::ProviderCollection::const_iterator i; |
125 for (i = external_extension_providers_.begin(); | 139 for (i = external_extension_providers_.begin(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 base::StringToInt(command_line->GetSwitchValueASCII( | 311 base::StringToInt(command_line->GetSwitchValueASCII( |
298 switches::kExtensionsUpdateFrequency), | 312 switches::kExtensionsUpdateFrequency), |
299 &update_frequency); | 313 &update_frequency); |
300 } | 314 } |
301 updater_.reset(new extensions::ExtensionUpdater( | 315 updater_.reset(new extensions::ExtensionUpdater( |
302 this, | 316 this, |
303 extension_prefs, | 317 extension_prefs, |
304 profile->GetPrefs(), | 318 profile->GetPrefs(), |
305 profile, | 319 profile, |
306 update_frequency, | 320 update_frequency, |
307 extensions::ExtensionCache::GetInstance())); | 321 extensions::ExtensionCache::GetInstance(), |
| 322 CreateWebstoreIdentityProvider(profile_))); |
308 } | 323 } |
309 #endif | 324 #endif |
310 | 325 |
311 component_loader_.reset( | 326 component_loader_.reset( |
312 new extensions::ComponentLoader(this, | 327 new extensions::ComponentLoader(this, |
313 profile->GetPrefs(), | 328 profile->GetPrefs(), |
314 g_browser_process->local_state(), | 329 g_browser_process->local_state(), |
315 profile)); | 330 profile)); |
316 | 331 |
317 if (extensions_enabled_) { | 332 if (extensions_enabled_) { |
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 } | 2348 } |
2334 | 2349 |
2335 void ExtensionService::OnProfileDestructionStarted() { | 2350 void ExtensionService::OnProfileDestructionStarted() { |
2336 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2351 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2337 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2352 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2338 it != ids_to_unload.end(); | 2353 it != ids_to_unload.end(); |
2339 ++it) { | 2354 ++it) { |
2340 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2355 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2341 } | 2356 } |
2342 } | 2357 } |
OLD | NEW |