OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 | 52 |
53 using content::BrowserThread; | 53 using content::BrowserThread; |
54 | 54 |
55 namespace extensions { | 55 namespace extensions { |
56 | 56 |
57 // Constants for keeping track of extension preferences in a dictionary. | 57 // Constants for keeping track of extension preferences in a dictionary. |
58 const char ExternalProviderImpl::kInstallParam[] = "install_parameter"; | 58 const char ExternalProviderImpl::kInstallParam[] = "install_parameter"; |
59 const char ExternalProviderImpl::kExternalCrx[] = "external_crx"; | 59 const char ExternalProviderImpl::kExternalCrx[] = "external_crx"; |
60 const char ExternalProviderImpl::kExternalVersion[] = "external_version"; | 60 const char ExternalProviderImpl::kExternalVersion[] = "external_version"; |
61 const char ExternalProviderImpl::kExternalUpdateUrl[] = "external_update_url"; | 61 const char ExternalProviderImpl::kExternalUpdateUrl[] = "external_update_url"; |
62 const char ExternalProviderImpl::kSupportedLocales[] = "supported_locales"; | |
63 const char ExternalProviderImpl::kIsBookmarkApp[] = "is_bookmark_app"; | 62 const char ExternalProviderImpl::kIsBookmarkApp[] = "is_bookmark_app"; |
64 const char ExternalProviderImpl::kIsFromWebstore[] = "is_from_webstore"; | 63 const char ExternalProviderImpl::kIsFromWebstore[] = "is_from_webstore"; |
65 const char ExternalProviderImpl::kKeepIfPresent[] = "keep_if_present"; | 64 const char ExternalProviderImpl::kKeepIfPresent[] = "keep_if_present"; |
65 const char ExternalProviderImpl::kWasInstalledByOem[] = "was_installed_by_oem"; | |
66 const char ExternalProviderImpl::kSupportedLocales[] = "supported_locales"; | |
66 | 67 |
67 ExternalProviderImpl::ExternalProviderImpl( | 68 ExternalProviderImpl::ExternalProviderImpl( |
68 VisitorInterface* service, | 69 VisitorInterface* service, |
69 const scoped_refptr<ExternalLoader>& loader, | 70 const scoped_refptr<ExternalLoader>& loader, |
70 Profile* profile, | 71 Profile* profile, |
71 Manifest::Location crx_location, | 72 Manifest::Location crx_location, |
72 Manifest::Location download_location, | 73 Manifest::Location download_location, |
73 int creation_flags) | 74 int creation_flags) |
74 : crx_location_(crx_location), | 75 : crx_location_(crx_location), |
75 download_location_(download_location), | 76 download_location_(download_location), |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 ExtensionSystem::Get(profile_)->extension_service(); | 214 ExtensionSystem::Get(profile_)->extension_service(); |
214 const Extension* extension = extension_service ? | 215 const Extension* extension = extension_service ? |
215 extension_service->GetExtensionById(extension_id, true) : NULL; | 216 extension_service->GetExtensionById(extension_id, true) : NULL; |
216 if (!extension) { | 217 if (!extension) { |
217 VLOG(1) << "Skip installing (or uninstall) external extension: " | 218 VLOG(1) << "Skip installing (or uninstall) external extension: " |
218 << extension_id << " because the extension should be kept " | 219 << extension_id << " because the extension should be kept " |
219 << "only if it is already installed."; | 220 << "only if it is already installed."; |
220 continue; | 221 continue; |
221 } | 222 } |
222 } | 223 } |
224 bool was_installed_by_oem; | |
225 if (extension->GetBoolean(kWasInstalledByOem, &was_installed_by_oem) && | |
stevenjb
2014/04/09 18:17:38
We only set this property in the Chrome code on Ch
| |
226 was_installed_by_oem) { | |
227 creation_flags |= Extension::WAS_INSTALLED_BY_OEM; | |
228 } | |
223 | 229 |
224 std::string install_parameter; | 230 std::string install_parameter; |
225 extension->GetString(kInstallParam, &install_parameter); | 231 extension->GetString(kInstallParam, &install_parameter); |
226 | 232 |
227 if (has_external_crx) { | 233 if (has_external_crx) { |
228 if (crx_location_ == Manifest::INVALID_LOCATION) { | 234 if (crx_location_ == Manifest::INVALID_LOCATION) { |
229 LOG(WARNING) << "This provider does not support installing external " | 235 LOG(WARNING) << "This provider does not support installing external " |
230 << "extensions from crx files."; | 236 << "extensions from crx files."; |
231 continue; | 237 continue; |
232 } | 238 } |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 service, | 550 service, |
545 new ExternalComponentLoader(profile), | 551 new ExternalComponentLoader(profile), |
546 profile, | 552 profile, |
547 Manifest::INVALID_LOCATION, | 553 Manifest::INVALID_LOCATION, |
548 Manifest::EXTERNAL_COMPONENT, | 554 Manifest::EXTERNAL_COMPONENT, |
549 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 555 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
550 } | 556 } |
551 } | 557 } |
552 | 558 |
553 } // namespace extensions | 559 } // namespace extensions |
OLD | NEW |