| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 49 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| 50 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 50 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 51 #include "chrome/browser/ui/webui/theme_source.h" | 51 #include "chrome/browser/ui/webui/theme_source.h" |
| 52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/crash_keys.h" | 53 #include "chrome/common/crash_keys.h" |
| 54 #include "chrome/common/extensions/extension_constants.h" | 54 #include "chrome/common/extensions/extension_constants.h" |
| 55 #include "chrome/common/extensions/features/feature_channel.h" | 55 #include "chrome/common/extensions/features/feature_channel.h" |
| 56 #include "chrome/common/extensions/manifest_url_handler.h" | 56 #include "chrome/common/extensions/manifest_url_handler.h" |
| 57 #include "chrome/common/pref_names.h" | 57 #include "chrome/common/pref_names.h" |
| 58 #include "chrome/common/url_constants.h" | 58 #include "chrome/common/url_constants.h" |
| 59 #include "components/crx_file/id_util.h" |
| 59 #include "components/signin/core/browser/signin_manager.h" | 60 #include "components/signin/core/browser/signin_manager.h" |
| 60 #include "components/startup_metric_utils/startup_metric_utils.h" | 61 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 61 #include "content/public/browser/devtools_agent_host.h" | 62 #include "content/public/browser/devtools_agent_host.h" |
| 62 #include "content/public/browser/notification_service.h" | 63 #include "content/public/browser/notification_service.h" |
| 63 #include "content/public/browser/render_process_host.h" | 64 #include "content/public/browser/render_process_host.h" |
| 64 #include "content/public/browser/storage_partition.h" | 65 #include "content/public/browser/storage_partition.h" |
| 65 #include "extensions/browser/event_router.h" | 66 #include "extensions/browser/event_router.h" |
| 66 #include "extensions/browser/extension_host.h" | 67 #include "extensions/browser/extension_host.h" |
| 67 #include "extensions/browser/extension_prefs.h" | 68 #include "extensions/browser/extension_prefs.h" |
| 68 #include "extensions/browser/extension_registry.h" | 69 #include "extensions/browser/extension_registry.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 183 } |
| 183 | 184 |
| 184 bool ExtensionService::OnExternalExtensionUpdateUrlFound( | 185 bool ExtensionService::OnExternalExtensionUpdateUrlFound( |
| 185 const std::string& id, | 186 const std::string& id, |
| 186 const std::string& install_parameter, | 187 const std::string& install_parameter, |
| 187 const GURL& update_url, | 188 const GURL& update_url, |
| 188 Manifest::Location location, | 189 Manifest::Location location, |
| 189 int creation_flags, | 190 int creation_flags, |
| 190 bool mark_acknowledged) { | 191 bool mark_acknowledged) { |
| 191 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 192 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 192 CHECK(Extension::IdIsValid(id)); | 193 CHECK(crx_file::id_util::IdIsValid(id)); |
| 193 | 194 |
| 194 if (Manifest::IsExternalLocation(location)) { | 195 if (Manifest::IsExternalLocation(location)) { |
| 195 // All extensions that are not user specific can be cached. | 196 // All extensions that are not user specific can be cached. |
| 196 extensions::ExtensionCache::GetInstance()->AllowCaching(id); | 197 extensions::ExtensionCache::GetInstance()->AllowCaching(id); |
| 197 } | 198 } |
| 198 | 199 |
| 199 const Extension* extension = GetExtensionById(id, true); | 200 const Extension* extension = GetExtensionById(id, true); |
| 200 if (extension) { | 201 if (extension) { |
| 201 // Already installed. Skip this install if the current location has | 202 // Already installed. Skip this install if the current location has |
| 202 // higher priority than |location|. | 203 // higher priority than |location|. |
| (...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 } | 1946 } |
| 1946 | 1947 |
| 1947 bool ExtensionService::OnExternalExtensionFileFound( | 1948 bool ExtensionService::OnExternalExtensionFileFound( |
| 1948 const std::string& id, | 1949 const std::string& id, |
| 1949 const Version* version, | 1950 const Version* version, |
| 1950 const base::FilePath& path, | 1951 const base::FilePath& path, |
| 1951 Manifest::Location location, | 1952 Manifest::Location location, |
| 1952 int creation_flags, | 1953 int creation_flags, |
| 1953 bool mark_acknowledged) { | 1954 bool mark_acknowledged) { |
| 1954 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1955 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1955 CHECK(Extension::IdIsValid(id)); | 1956 CHECK(crx_file::id_util::IdIsValid(id)); |
| 1956 if (extension_prefs_->IsExternalExtensionUninstalled(id)) | 1957 if (extension_prefs_->IsExternalExtensionUninstalled(id)) |
| 1957 return false; | 1958 return false; |
| 1958 | 1959 |
| 1959 // Before even bothering to unpack, check and see if we already have this | 1960 // Before even bothering to unpack, check and see if we already have this |
| 1960 // version. This is important because these extensions are going to get | 1961 // version. This is important because these extensions are going to get |
| 1961 // installed on every startup. | 1962 // installed on every startup. |
| 1962 const Extension* existing = GetExtensionById(id, true); | 1963 const Extension* existing = GetExtensionById(id, true); |
| 1963 | 1964 |
| 1964 if (existing) { | 1965 if (existing) { |
| 1965 // The default apps will have the location set as INTERNAL. Since older | 1966 // The default apps will have the location set as INTERNAL. Since older |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 } | 2359 } |
| 2359 | 2360 |
| 2360 void ExtensionService::OnProfileDestructionStarted() { | 2361 void ExtensionService::OnProfileDestructionStarted() { |
| 2361 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2362 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2362 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2363 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2363 it != ids_to_unload.end(); | 2364 it != ids_to_unload.end(); |
| 2364 ++it) { | 2365 ++it) { |
| 2365 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2366 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2366 } | 2367 } |
| 2367 } | 2368 } |
| OLD | NEW |