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

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

Issue 634313004: Display dialog when app install succeeds / fails on Athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/threading/thread_restrictions.h" 21 #include "base/threading/thread_restrictions.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "base/version.h" 23 #include "base/version.h"
24 #include "chrome/browser/extensions/convert_user_script.h" 24 #include "chrome/browser/extensions/convert_user_script.h"
25 #include "chrome/browser/extensions/convert_web_app.h" 25 #include "chrome/browser/extensions/convert_web_app.h"
26 #include "chrome/browser/extensions/crx_installer_error.h"
27 #include "chrome/browser/extensions/extension_assets_manager.h" 26 #include "chrome/browser/extensions/extension_assets_manager.h"
28 #include "chrome/browser/extensions/extension_error_reporter.h" 27 #include "chrome/browser/extensions/extension_error_reporter.h"
29 #include "chrome/browser/extensions/extension_install_ui.h"
30 #include "chrome/browser/extensions/extension_service.h" 28 #include "chrome/browser/extensions/extension_service.h"
31 #include "chrome/browser/extensions/install_tracker.h" 29 #include "chrome/browser/extensions/install_tracker.h"
32 #include "chrome/browser/extensions/install_tracker_factory.h" 30 #include "chrome/browser/extensions/install_tracker_factory.h"
33 #include "chrome/browser/extensions/permissions_updater.h" 31 #include "chrome/browser/extensions/permissions_updater.h"
34 #include "chrome/browser/extensions/webstore_installer.h" 32 #include "chrome/browser/extensions/webstore_installer.h"
35 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/web_applications/web_app.h" 34 #include "chrome/browser/web_applications/web_app.h"
37 #include "chrome/common/chrome_paths.h" 35 #include "chrome/common/chrome_paths.h"
38 #include "chrome/common/extensions/extension_constants.h" 36 #include "chrome/common/extensions/extension_constants.h"
39 #include "chrome/grit/generated_resources.h" 37 #include "chrome/grit/generated_resources.h"
40 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
41 #include "content/public/browser/notification_service.h" 39 #include "content/public/browser/notification_service.h"
42 #include "content/public/browser/resource_dispatcher_host.h" 40 #include "content/public/browser/resource_dispatcher_host.h"
43 #include "content/public/browser/user_metrics.h" 41 #include "content/public/browser/user_metrics.h"
44 #include "extensions/browser/extension_prefs.h" 42 #include "extensions/browser/extension_prefs.h"
45 #include "extensions/browser/extension_system.h" 43 #include "extensions/browser/extension_system.h"
44 #include "extensions/browser/install/crx_installer_error.h"
45 #include "extensions/browser/install/extension_install_ui.h"
46 #include "extensions/browser/install_flag.h" 46 #include "extensions/browser/install_flag.h"
47 #include "extensions/browser/notification_types.h" 47 #include "extensions/browser/notification_types.h"
48 #include "extensions/common/extension_icon_set.h" 48 #include "extensions/common/extension_icon_set.h"
49 #include "extensions/common/feature_switch.h" 49 #include "extensions/common/feature_switch.h"
50 #include "extensions/common/file_util.h" 50 #include "extensions/common/file_util.h"
51 #include "extensions/common/manifest.h" 51 #include "extensions/common/manifest.h"
52 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" 52 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
53 #include "extensions/common/manifest_handlers/shared_module_info.h" 53 #include "extensions/common/manifest_handlers/shared_module_info.h"
54 #include "extensions/common/manifest_url_handlers.h" 54 #include "extensions/common/manifest_url_handlers.h"
55 #include "extensions/common/permissions/permission_message_provider.h" 55 #include "extensions/common/permissions/permission_message_provider.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 install_flags_(kInstallFlagNone), 132 install_flags_(kInstallFlagNone),
133 install_checker_(service_weak->profile()) { 133 install_checker_(service_weak->profile()) {
134 installer_task_runner_ = service_weak->GetFileTaskRunner(); 134 installer_task_runner_ = service_weak->GetFileTaskRunner();
135 if (!approval) 135 if (!approval)
136 return; 136 return;
137 137
138 CHECK(profile()->IsSameProfile(approval->profile)); 138 CHECK(profile()->IsSameProfile(approval->profile));
139 if (client_) { 139 if (client_) {
140 client_->install_ui()->SetUseAppInstalledBubble( 140 client_->install_ui()->SetUseAppInstalledBubble(
141 approval->use_app_installed_bubble); 141 approval->use_app_installed_bubble);
142 client_->install_ui()->set_skip_post_install_ui( 142 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui);
143 approval->skip_post_install_ui);
144 } 143 }
145 144
146 if (approval->skip_install_dialog) { 145 if (approval->skip_install_dialog) {
147 // Mark the extension as approved, but save the expected manifest and ID 146 // Mark the extension as approved, but save the expected manifest and ID
148 // so we can check that they match the CRX's. 147 // so we can check that they match the CRX's.
149 approved_ = true; 148 approved_ = true;
150 expected_manifest_check_level_ = approval->manifest_check_level; 149 expected_manifest_check_level_ = approval->manifest_check_level;
151 if (expected_manifest_check_level_ != 150 if (expected_manifest_check_level_ !=
152 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) 151 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE)
153 expected_manifest_.reset(approval->manifest->DeepCopy()); 152 expected_manifest_.reset(approval->manifest->DeepCopy());
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // NOTE: extension may still be blacklisted, but we're forced to silently 563 // NOTE: extension may still be blacklisted, but we're forced to silently
565 // install it. In this case, ExtensionService::OnExtensionInstalled needs to 564 // install it. In this case, ExtensionService::OnExtensionInstalled needs to
566 // deal with it. 565 // deal with it.
567 566
568 // Check for policy errors. 567 // Check for policy errors.
569 if (!install_checker_.policy_error().empty()) { 568 if (!install_checker_.policy_error().empty()) {
570 // We don't want to show the error infobar for installs from the WebStore, 569 // We don't want to show the error infobar for installs from the WebStore,
571 // because the WebStore already shows an error dialog itself. 570 // because the WebStore already shows an error dialog itself.
572 // Note: |client_| can be NULL in unit_tests! 571 // Note: |client_| can be NULL in unit_tests!
573 if (extension()->from_webstore() && client_) 572 if (extension()->from_webstore() && client_)
574 client_->install_ui()->set_skip_post_install_ui(true); 573 client_->install_ui()->SetSkipPostInstallUI(true);
575 ReportFailureFromUIThread( 574 ReportFailureFromUIThread(
576 CrxInstallerError(base::UTF8ToUTF16(install_checker_.policy_error()))); 575 CrxInstallerError(base::UTF8ToUTF16(install_checker_.policy_error())));
577 return; 576 return;
578 } 577 }
579 578
580 ConfirmInstall(); 579 ConfirmInstall();
581 } 580 }
582 581
583 void CrxInstaller::ConfirmInstall() { 582 void CrxInstaller::ConfirmInstall() {
584 DCHECK_CURRENTLY_ON(BrowserThread::UI); 583 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) 907 if (!prefs->DidExtensionEscalatePermissions(extension()->id()))
909 return; 908 return;
910 909
911 if (client_) { 910 if (client_) {
912 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). 911 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort().
913 client_->ConfirmReEnable(this, extension()); 912 client_->ConfirmReEnable(this, extension());
914 } 913 }
915 } 914 }
916 915
917 } // namespace extensions 916 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698