Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 2783813002: Move ChromeRequirementsChecker to //extensions as a PreloadCheck (Closed)
Patch Set: rebase? Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <utility> 9 #include <utility>
10 10
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 base::Bind(&CrxInstaller::OnInstallChecksComplete, this)); 519 base::Bind(&CrxInstaller::OnInstallChecksComplete, this));
520 } 520 }
521 } 521 }
522 522
523 void CrxInstaller::OnInstallChecksComplete(int failed_checks) { 523 void CrxInstaller::OnInstallChecksComplete(int failed_checks) {
524 DCHECK_CURRENTLY_ON(BrowserThread::UI); 524 DCHECK_CURRENTLY_ON(BrowserThread::UI);
525 if (!service_weak_) 525 if (!service_weak_)
526 return; 526 return;
527 527
528 // Check for requirement errors. 528 // Check for requirement errors.
529 if (!install_checker_->requirement_errors().empty()) { 529 if (!install_checker_->requirements_error_message().empty()) {
530 if (error_on_unsupported_requirements_) { 530 if (error_on_unsupported_requirements_) {
531 ReportFailureFromUIThread( 531 ReportFailureFromUIThread(
532 CrxInstallError(CrxInstallError::ERROR_DECLINED, 532 CrxInstallError(CrxInstallError::ERROR_DECLINED,
533 base::UTF8ToUTF16(base::JoinString( 533 install_checker_->requirements_error_message()));
534 install_checker_->requirement_errors(), " "))));
535 return; 534 return;
536 } 535 }
537 install_flags_ |= kInstallFlagHasRequirementErrors; 536 install_flags_ |= kInstallFlagHasRequirementErrors;
538 } 537 }
539 538
540 // Check the blacklist state. 539 // Check the blacklist state.
541 if (install_checker_->blacklist_error() == PreloadCheck::BLACKLISTED_ID) { 540 if (install_checker_->blacklist_error() == PreloadCheck::BLACKLISTED_ID) {
542 install_flags_ |= kInstallFlagIsBlacklistedForMalware; 541 install_flags_ |= kInstallFlagIsBlacklistedForMalware;
543 } 542 }
544 543
(...skipping 17 matching lines...) Expand all
562 // install it. In this case, ExtensionService::OnExtensionInstalled needs to 561 // install it. In this case, ExtensionService::OnExtensionInstalled needs to
563 // deal with it. 562 // deal with it.
564 563
565 // Check for policy errors. 564 // Check for policy errors.
566 if (!install_checker_->policy_error().empty()) { 565 if (!install_checker_->policy_error().empty()) {
567 // We don't want to show the error infobar for installs from the WebStore, 566 // We don't want to show the error infobar for installs from the WebStore,
568 // because the WebStore already shows an error dialog itself. 567 // because the WebStore already shows an error dialog itself.
569 // Note: |client_| can be NULL in unit_tests! 568 // Note: |client_| can be NULL in unit_tests!
570 if (extension()->from_webstore() && client_) 569 if (extension()->from_webstore() && client_)
571 client_->install_ui()->SetSkipPostInstallUI(true); 570 client_->install_ui()->SetSkipPostInstallUI(true);
572 ReportFailureFromUIThread( 571 ReportFailureFromUIThread(CrxInstallError(
573 CrxInstallError(CrxInstallError::ERROR_DECLINED, 572 CrxInstallError::ERROR_DECLINED, install_checker_->policy_error()));
574 base::UTF8ToUTF16(install_checker_->policy_error())));
575 return; 573 return;
576 } 574 }
577 575
578 ConfirmInstall(); 576 ConfirmInstall();
579 } 577 }
580 578
581 void CrxInstaller::ConfirmInstall() { 579 void CrxInstaller::ConfirmInstall() {
582 DCHECK_CURRENTLY_ON(BrowserThread::UI); 580 DCHECK_CURRENTLY_ON(BrowserThread::UI);
583 ExtensionService* service = service_weak_.get(); 581 ExtensionService* service = service_weak_.get();
584 if (!service || service->browser_terminating()) 582 if (!service || service->browser_terminating())
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( 905 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(
908 service->profile(), extension()); 906 service->profile(), extension());
909 client_->ShowDialog(base::Bind(&CrxInstaller::OnInstallPromptDone, this), 907 client_->ShowDialog(base::Bind(&CrxInstaller::OnInstallPromptDone, this),
910 extension(), nullptr, 908 extension(), nullptr,
911 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type), 909 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type),
912 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); 910 ExtensionInstallPrompt::GetDefaultShowDialogCallback());
913 } 911 }
914 } 912 }
915 913
916 } // namespace extensions 914 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_requirements_checker.cc ('k') | chrome/browser/extensions/extension_install_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698