| OLD | NEW |
| 1 // Copyright (c) 2012 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/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/file_util.h" | 11 #include "base/file_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/extensions/extension_system.h" | 30 #include "chrome/browser/extensions/extension_system.h" |
| 31 #include "chrome/browser/extensions/management_policy.h" | 31 #include "chrome/browser/extensions/management_policy.h" |
| 32 #include "chrome/browser/extensions/permissions_updater.h" | 32 #include "chrome/browser/extensions/permissions_updater.h" |
| 33 #include "chrome/browser/extensions/requirements_checker.h" | 33 #include "chrome/browser/extensions/requirements_checker.h" |
| 34 #include "chrome/browser/extensions/webstore_installer.h" | 34 #include "chrome/browser/extensions/webstore_installer.h" |
| 35 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| 36 #include "chrome/browser/shell_integration.h" | 36 #include "chrome/browser/shell_integration.h" |
| 37 #include "chrome/browser/web_applications/web_app.h" | 37 #include "chrome/browser/web_applications/web_app.h" |
| 38 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
| 39 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
| 40 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 40 #include "chrome/common/extensions/extension_constants.h" | 41 #include "chrome/common/extensions/extension_constants.h" |
| 41 #include "chrome/common/extensions/extension_file_util.h" | 42 #include "chrome/common/extensions/extension_file_util.h" |
| 42 #include "chrome/common/extensions/extension_icon_set.h" | 43 #include "chrome/common/extensions/extension_icon_set.h" |
| 43 #include "chrome/common/extensions/feature_switch.h" | 44 #include "chrome/common/extensions/feature_switch.h" |
| 44 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
| 45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 46 #include "content/public/browser/resource_dispatcher_host.h" | 47 #include "content/public/browser/resource_dispatcher_host.h" |
| 47 #include "content/public/browser/user_metrics.h" | 48 #include "content/public/browser/user_metrics.h" |
| 48 #include "grit/chromium_strings.h" | 49 #include "grit/chromium_strings.h" |
| 49 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 profile_(frontend_weak->profile()), | 99 profile_(frontend_weak->profile()), |
| 99 client_(client), | 100 client_(client), |
| 100 apps_require_extension_mime_type_(false), | 101 apps_require_extension_mime_type_(false), |
| 101 allow_silent_install_(false), | 102 allow_silent_install_(false), |
| 102 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), | 103 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), |
| 103 creation_flags_(Extension::NO_FLAGS), | 104 creation_flags_(Extension::NO_FLAGS), |
| 104 off_store_install_allow_reason_(OffStoreInstallDisallowed), | 105 off_store_install_allow_reason_(OffStoreInstallDisallowed), |
| 105 did_handle_successfully_(true), | 106 did_handle_successfully_(true), |
| 106 record_oauth2_grant_(false), | 107 record_oauth2_grant_(false), |
| 107 error_on_unsupported_requirements_(false), | 108 error_on_unsupported_requirements_(false), |
| 108 requirements_checker_(new extensions::RequirementsChecker()), | 109 requirements_checker_(new RequirementsChecker()), |
| 109 has_requirement_errors_(false), | 110 has_requirement_errors_(false), |
| 110 install_wait_for_idle_(true) { | 111 install_wait_for_idle_(true) { |
| 111 installer_task_runner_ = frontend_weak->GetFileTaskRunner(); | 112 installer_task_runner_ = frontend_weak->GetFileTaskRunner(); |
| 112 if (!approval) | 113 if (!approval) |
| 113 return; | 114 return; |
| 114 | 115 |
| 115 CHECK(profile_->IsSameProfile(approval->profile)); | 116 CHECK(profile_->IsSameProfile(approval->profile)); |
| 116 if (client_) { | 117 if (client_) { |
| 117 client_->install_ui()->SetUseAppInstalledBubble( | 118 client_->install_ui()->SetUseAppInstalledBubble( |
| 118 approval->use_app_installed_bubble); | 119 approval->use_app_installed_bubble); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // the temp dir. | 377 // the temp dir. |
| 377 unpacked_extension_root_ = extension_dir; | 378 unpacked_extension_root_ = extension_dir; |
| 378 | 379 |
| 379 CrxInstallerError error = AllowInstall(extension); | 380 CrxInstallerError error = AllowInstall(extension); |
| 380 if (error.type() != CrxInstallerError::ERROR_NONE) { | 381 if (error.type() != CrxInstallerError::ERROR_NONE) { |
| 381 ReportFailureFromFileThread(error); | 382 ReportFailureFromFileThread(error); |
| 382 return; | 383 return; |
| 383 } | 384 } |
| 384 | 385 |
| 385 if (client_) { | 386 if (client_) { |
| 386 Extension::DecodeIcon(extension_.get(), | 387 IconsInfo::DecodeIcon(extension_.get(), |
| 387 extension_misc::EXTENSION_ICON_LARGE, | 388 extension_misc::EXTENSION_ICON_LARGE, |
| 388 ExtensionIconSet::MATCH_BIGGER, | 389 ExtensionIconSet::MATCH_BIGGER, |
| 389 &install_icon_); | 390 &install_icon_); |
| 390 } | 391 } |
| 391 | 392 |
| 392 if (!BrowserThread::PostTask( | 393 if (!BrowserThread::PostTask( |
| 393 BrowserThread::UI, FROM_HERE, | 394 BrowserThread::UI, FROM_HERE, |
| 394 base::Bind(&CrxInstaller::CheckRequirements, this))) | 395 base::Bind(&CrxInstaller::CheckRequirements, this))) |
| 395 NOTREACHED(); | 396 NOTREACHED(); |
| 396 } | 397 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 temp_dir_ = FilePath(); | 669 temp_dir_ = FilePath(); |
| 669 } | 670 } |
| 670 | 671 |
| 671 if (delete_source_ && !source_file_.value().empty()) { | 672 if (delete_source_ && !source_file_.value().empty()) { |
| 672 extension_file_util::DeleteFile(source_file_, false); | 673 extension_file_util::DeleteFile(source_file_, false); |
| 673 source_file_ = FilePath(); | 674 source_file_ = FilePath(); |
| 674 } | 675 } |
| 675 } | 676 } |
| 676 | 677 |
| 677 } // namespace extensions | 678 } // namespace extensions |
| OLD | NEW |