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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 extension->GetType())); | 302 extension->GetType())); |
303 } | 303 } |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 if (!valid) | 307 if (!valid) |
308 return CrxInstallError( | 308 return CrxInstallError( |
309 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); | 309 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); |
310 } | 310 } |
311 | 311 |
312 // The checks below are skipped for themes and external installs. | 312 // The checks below are skipped for themes, external installs, and bookmark |
313 // apps. | |
313 // TODO(pamg): After ManagementPolicy refactoring is complete, remove this | 314 // TODO(pamg): After ManagementPolicy refactoring is complete, remove this |
314 // and other uses of install_source_ that are no longer needed now that the | 315 // and other uses of install_source_ that are no longer needed now that the |
315 // SandboxedUnpacker sets extension->location. | 316 // SandboxedUnpacker sets extension->location. |
316 if (extension->is_theme() || Manifest::IsExternalLocation(install_source_)) | 317 if (extension->is_theme() || extension->from_bookmark() || |
318 Manifest::IsExternalLocation(install_source_)) { | |
317 return CrxInstallError(); | 319 return CrxInstallError(); |
320 } | |
318 | 321 |
319 if (!extensions_enabled_) { | 322 if (!extensions_enabled_) { |
320 return CrxInstallError( | 323 return CrxInstallError( |
321 CrxInstallError::ERROR_DECLINED, | 324 CrxInstallError::ERROR_DECLINED, |
322 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_NOT_ENABLED)); | 325 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_NOT_ENABLED)); |
323 } | 326 } |
324 | 327 |
325 if (install_cause_ == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { | 328 if (install_cause_ == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { |
326 if (FeatureSwitch::easy_off_store_install()->IsEnabled()) { | 329 if (FeatureSwitch::easy_off_store_install()->IsEnabled()) { |
327 const char kHistogramName[] = "Extensions.OffStoreInstallDecisionEasy"; | 330 const char kHistogramName[] = "Extensions.OffStoreInstallDecisionEasy"; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
502 CrxInstallError::ERROR_DECLINED, | 505 CrxInstallError::ERROR_DECLINED, |
503 l10n_util::GetStringFUTF16( | 506 l10n_util::GetStringFUTF16( |
504 IDS_EXTENSION_INSTALL_DEPENDENCY_NOT_WHITELISTED, | 507 IDS_EXTENSION_INSTALL_DEPENDENCY_NOT_WHITELISTED, |
505 base::UTF8ToUTF16(extension()->name()), | 508 base::UTF8ToUTF16(extension()->name()), |
506 base::UTF8ToUTF16(imported_module->name())))); | 509 base::UTF8ToUTF16(imported_module->name())))); |
507 return; | 510 return; |
508 } | 511 } |
509 } | 512 } |
510 } | 513 } |
511 | 514 |
512 // Run the policy, requirements and blacklist checks in parallel. | 515 // Run the policy, requirements and blacklist checks in parallel. Skip the |
513 install_checker_.Start( | 516 // checks if the extension is a bookmark app. |
benwells
2015/10/30 02:24:13
Why is this skipped for bookmark apps but not for
dominickn
2015/10/30 02:42:30
I'm not sure. The log indicates that the theme exe
| |
514 ExtensionInstallChecker::CHECK_ALL, | 517 if (extension()->from_bookmark()) { |
515 false /* fail fast */, | 518 CrxInstaller::OnInstallChecksComplete(0); |
516 base::Bind(&CrxInstaller::OnInstallChecksComplete, this)); | 519 } else { |
520 install_checker_.Start( | |
521 ExtensionInstallChecker::CHECK_ALL, | |
522 false /* fail fast */, | |
523 base::Bind(&CrxInstaller::OnInstallChecksComplete, this)); | |
524 } | |
517 } | 525 } |
518 | 526 |
519 void CrxInstaller::OnInstallChecksComplete(int failed_checks) { | 527 void CrxInstaller::OnInstallChecksComplete(int failed_checks) { |
520 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 528 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
521 if (!service_weak_) | 529 if (!service_weak_) |
522 return; | 530 return; |
523 | 531 |
524 // Check for requirement errors. | 532 // Check for requirement errors. |
525 if (!install_checker_.requirement_errors().empty()) { | 533 if (!install_checker_.requirement_errors().empty()) { |
526 if (error_on_unsupported_requirements_) { | 534 if (error_on_unsupported_requirements_) { |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 908 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
901 return; | 909 return; |
902 | 910 |
903 if (client_) { | 911 if (client_) { |
904 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 912 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
905 client_->ConfirmReEnable(this, extension()); | 913 client_->ConfirmReEnable(this, extension()); |
906 } | 914 } |
907 } | 915 } |
908 | 916 |
909 } // namespace extensions | 917 } // namespace extensions |
OLD | NEW |