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 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/extensions/extension_util.h" | 35 #include "chrome/browser/extensions/extension_util.h" |
36 #include "chrome/browser/extensions/external_install_manager.h" | 36 #include "chrome/browser/extensions/external_install_manager.h" |
37 #include "chrome/browser/extensions/external_provider_impl.h" | 37 #include "chrome/browser/extensions/external_provider_impl.h" |
38 #include "chrome/browser/extensions/install_verifier.h" | 38 #include "chrome/browser/extensions/install_verifier.h" |
39 #include "chrome/browser/extensions/installed_loader.h" | 39 #include "chrome/browser/extensions/installed_loader.h" |
40 #include "chrome/browser/extensions/pending_extension_manager.h" | 40 #include "chrome/browser/extensions/pending_extension_manager.h" |
41 #include "chrome/browser/extensions/permissions_updater.h" | 41 #include "chrome/browser/extensions/permissions_updater.h" |
42 #include "chrome/browser/extensions/shared_module_service.h" | 42 #include "chrome/browser/extensions/shared_module_service.h" |
43 #include "chrome/browser/extensions/unpacked_installer.h" | 43 #include "chrome/browser/extensions/unpacked_installer.h" |
44 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.
h" | 44 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.
h" |
45 #include "chrome/browser/extensions/updater/extension_cache.h" | |
46 #include "chrome/browser/extensions/updater/extension_downloader.h" | 45 #include "chrome/browser/extensions/updater/extension_downloader.h" |
47 #include "chrome/browser/extensions/updater/extension_updater.h" | 46 #include "chrome/browser/extensions/updater/extension_updater.h" |
48 #include "chrome/browser/google/google_brand.h" | 47 #include "chrome/browser/google/google_brand.h" |
49 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
50 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 49 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
51 #include "chrome/browser/ui/webui/favicon_source.h" | 50 #include "chrome/browser/ui/webui/favicon_source.h" |
52 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 51 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
53 #include "chrome/browser/ui/webui/theme_source.h" | 52 #include "chrome/browser/ui/webui/theme_source.h" |
54 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
55 #include "chrome/common/crash_keys.h" | 54 #include "chrome/common/crash_keys.h" |
56 #include "chrome/common/extensions/extension_constants.h" | 55 #include "chrome/common/extensions/extension_constants.h" |
57 #include "chrome/common/extensions/features/feature_channel.h" | 56 #include "chrome/common/extensions/features/feature_channel.h" |
58 #include "chrome/common/extensions/manifest_url_handler.h" | 57 #include "chrome/common/extensions/manifest_url_handler.h" |
59 #include "chrome/common/url_constants.h" | 58 #include "chrome/common/url_constants.h" |
60 #include "components/crx_file/id_util.h" | 59 #include "components/crx_file/id_util.h" |
61 #include "components/startup_metric_utils/startup_metric_utils.h" | 60 #include "components/startup_metric_utils/startup_metric_utils.h" |
62 #include "content/public/browser/devtools_agent_host.h" | 61 #include "content/public/browser/devtools_agent_host.h" |
63 #include "content/public/browser/notification_service.h" | 62 #include "content/public/browser/notification_service.h" |
64 #include "content/public/browser/render_process_host.h" | 63 #include "content/public/browser/render_process_host.h" |
65 #include "content/public/browser/storage_partition.h" | 64 #include "content/public/browser/storage_partition.h" |
66 #include "extensions/browser/event_router.h" | 65 #include "extensions/browser/event_router.h" |
67 #include "extensions/browser/extension_host.h" | 66 #include "extensions/browser/extension_host.h" |
68 #include "extensions/browser/extension_prefs.h" | 67 #include "extensions/browser/extension_prefs.h" |
69 #include "extensions/browser/extension_registry.h" | 68 #include "extensions/browser/extension_registry.h" |
70 #include "extensions/browser/extension_system.h" | 69 #include "extensions/browser/extension_system.h" |
| 70 #include "extensions/browser/extensions_browser_client.h" |
71 #include "extensions/browser/install_flag.h" | 71 #include "extensions/browser/install_flag.h" |
72 #include "extensions/browser/runtime_data.h" | 72 #include "extensions/browser/runtime_data.h" |
73 #include "extensions/browser/uninstall_reason.h" | 73 #include "extensions/browser/uninstall_reason.h" |
74 #include "extensions/browser/update_observer.h" | 74 #include "extensions/browser/update_observer.h" |
| 75 #include "extensions/browser/updater/extension_cache.h" |
75 #include "extensions/common/extension_messages.h" | 76 #include "extensions/common/extension_messages.h" |
76 #include "extensions/common/extension_urls.h" | 77 #include "extensions/common/extension_urls.h" |
77 #include "extensions/common/feature_switch.h" | 78 #include "extensions/common/feature_switch.h" |
78 #include "extensions/common/file_util.h" | 79 #include "extensions/common/file_util.h" |
79 #include "extensions/common/manifest_constants.h" | 80 #include "extensions/common/manifest_constants.h" |
80 #include "extensions/common/manifest_handlers/background_info.h" | 81 #include "extensions/common/manifest_handlers/background_info.h" |
81 #include "extensions/common/one_shot_event.h" | 82 #include "extensions/common/one_shot_event.h" |
82 #include "extensions/common/permissions/permission_message_provider.h" | 83 #include "extensions/common/permissions/permission_message_provider.h" |
83 #include "extensions/common/permissions/permissions_data.h" | 84 #include "extensions/common/permissions/permissions_data.h" |
84 | 85 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const std::string& install_parameter, | 179 const std::string& install_parameter, |
179 const GURL& update_url, | 180 const GURL& update_url, |
180 Manifest::Location location, | 181 Manifest::Location location, |
181 int creation_flags, | 182 int creation_flags, |
182 bool mark_acknowledged) { | 183 bool mark_acknowledged) { |
183 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 184 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
184 CHECK(crx_file::id_util::IdIsValid(id)); | 185 CHECK(crx_file::id_util::IdIsValid(id)); |
185 | 186 |
186 if (Manifest::IsExternalLocation(location)) { | 187 if (Manifest::IsExternalLocation(location)) { |
187 // All extensions that are not user specific can be cached. | 188 // All extensions that are not user specific can be cached. |
188 extensions::ExtensionCache::GetInstance()->AllowCaching(id); | 189 extensions::ExtensionsBrowserClient::Get()->GetExtensionCache() |
| 190 ->AllowCaching(id); |
189 } | 191 } |
190 | 192 |
191 const Extension* extension = GetExtensionById(id, true); | 193 const Extension* extension = GetExtensionById(id, true); |
192 if (extension) { | 194 if (extension) { |
193 // Already installed. Skip this install if the current location has | 195 // Already installed. Skip this install if the current location has |
194 // higher priority than |location|. | 196 // higher priority than |location|. |
195 Manifest::Location current = extension->location(); | 197 Manifest::Location current = extension->location(); |
196 if (current == Manifest::GetHigherPriorityLocation(current, location)) | 198 if (current == Manifest::GetHigherPriorityLocation(current, location)) |
197 return false; | 199 return false; |
198 // Otherwise, overwrite the current installation. | 200 // Otherwise, overwrite the current installation. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 base::StringToInt(command_line->GetSwitchValueASCII( | 302 base::StringToInt(command_line->GetSwitchValueASCII( |
301 switches::kExtensionsUpdateFrequency), | 303 switches::kExtensionsUpdateFrequency), |
302 &update_frequency); | 304 &update_frequency); |
303 } | 305 } |
304 updater_.reset(new extensions::ExtensionUpdater( | 306 updater_.reset(new extensions::ExtensionUpdater( |
305 this, | 307 this, |
306 extension_prefs, | 308 extension_prefs, |
307 profile->GetPrefs(), | 309 profile->GetPrefs(), |
308 profile, | 310 profile, |
309 update_frequency, | 311 update_frequency, |
310 extensions::ExtensionCache::GetInstance(), | 312 extensions::ExtensionsBrowserClient::Get()->GetExtensionCache(), |
311 base::Bind(ChromeExtensionDownloaderFactory::CreateForProfile, | 313 base::Bind(ChromeExtensionDownloaderFactory::CreateForProfile, |
312 profile))); | 314 profile))); |
313 } | 315 } |
314 | 316 |
315 component_loader_.reset( | 317 component_loader_.reset( |
316 new extensions::ComponentLoader(this, | 318 new extensions::ComponentLoader(this, |
317 profile->GetPrefs(), | 319 profile->GetPrefs(), |
318 g_browser_process->local_state(), | 320 g_browser_process->local_state(), |
319 profile)); | 321 profile)); |
320 | 322 |
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 } | 2369 } |
2368 | 2370 |
2369 void ExtensionService::OnProfileDestructionStarted() { | 2371 void ExtensionService::OnProfileDestructionStarted() { |
2370 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2372 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2371 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2373 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2372 it != ids_to_unload.end(); | 2374 it != ids_to_unload.end(); |
2373 ++it) { | 2375 ++it) { |
2374 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2376 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2375 } | 2377 } |
2376 } | 2378 } |
OLD | NEW |