| 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 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/browser/extensions/extension_system.h" | 31 #include "chrome/browser/extensions/extension_system.h" |
| 32 #include "chrome/browser/extensions/permissions_updater.h" | 32 #include "chrome/browser/extensions/permissions_updater.h" |
| 33 #include "chrome/browser/extensions/webstore_installer.h" | 33 #include "chrome/browser/extensions/webstore_installer.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/web_applications/web_app.h" | 35 #include "chrome/browser/web_applications/web_app.h" |
| 36 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/extensions/extension_constants.h" | 37 #include "chrome/common/extensions/extension_constants.h" |
| 38 #include "chrome/common/extensions/extension_file_util.h" | 38 #include "chrome/common/extensions/extension_file_util.h" |
| 39 #include "chrome/common/extensions/extension_icon_set.h" | 39 #include "chrome/common/extensions/extension_icon_set.h" |
| 40 #include "chrome/common/extensions/feature_switch.h" | 40 #include "chrome/common/extensions/feature_switch.h" |
| 41 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" |
| 41 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" | 42 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" |
| 42 #include "chrome/common/extensions/manifest_url_handler.h" | 43 #include "chrome/common/extensions/manifest_url_handler.h" |
| 43 #include "chrome/common/extensions/permissions/permission_set.h" | 44 #include "chrome/common/extensions/permissions/permission_set.h" |
| 44 #include "chrome/common/extensions/permissions/permissions_data.h" | 45 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 45 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
| 46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/resource_dispatcher_host.h" | 48 #include "content/public/browser/resource_dispatcher_host.h" |
| 48 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
| 49 #include "extensions/common/manifest.h" | 50 #include "extensions/common/manifest.h" |
| 50 #include "extensions/common/user_script.h" | 51 #include "extensions/common/user_script.h" |
| 51 #include "grit/chromium_strings.h" | 52 #include "grit/chromium_strings.h" |
| 52 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
| 53 #include "grit/theme_resources.h" | 54 #include "grit/theme_resources.h" |
| 54 #include "third_party/skia/include/core/SkBitmap.h" | 55 #include "third_party/skia/include/core/SkBitmap.h" |
| 55 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
| 56 #include "ui/base/resource/resource_bundle.h" | 57 #include "ui/base/resource/resource_bundle.h" |
| 57 | 58 |
| 59 #if defined(OS_CHROMEOS) |
| 60 #include "chrome/browser/chromeos/login/user_manager.h" |
| 61 #endif |
| 62 |
| 58 using content::BrowserThread; | 63 using content::BrowserThread; |
| 59 using content::UserMetricsAction; | 64 using content::UserMetricsAction; |
| 60 using extensions::SharedModuleInfo; | 65 using extensions::SharedModuleInfo; |
| 61 | 66 |
| 62 namespace extensions { | 67 namespace extensions { |
| 63 | 68 |
| 64 namespace { | 69 namespace { |
| 65 | 70 |
| 66 // Used in histograms; do not change order. | 71 // Used in histograms; do not change order. |
| 67 enum OffStoreInstallDecision { | 72 enum OffStoreInstallDecision { |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 // deal with it. | 510 // deal with it. |
| 506 ConfirmInstall(); | 511 ConfirmInstall(); |
| 507 } | 512 } |
| 508 | 513 |
| 509 void CrxInstaller::ConfirmInstall() { | 514 void CrxInstaller::ConfirmInstall() { |
| 510 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 515 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 511 ExtensionService* service = service_weak_.get(); | 516 ExtensionService* service = service_weak_.get(); |
| 512 if (!service || service->browser_terminating()) | 517 if (!service || service->browser_terminating()) |
| 513 return; | 518 return; |
| 514 | 519 |
| 520 if (KioskOnlyInfo::IsKioskOnly(installer_.extension())) { |
| 521 bool in_kiosk_mode = false; |
| 522 #if defined(OS_CHROMEOS) |
| 523 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| 524 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); |
| 525 #endif |
| 526 if (!in_kiosk_mode) { |
| 527 ReportFailureFromUIThread(CrxInstallerError( |
| 528 l10n_util::GetStringUTF16( |
| 529 IDS_EXTENSION_INSTALL_KIOSK_MODE_ONLY))); |
| 530 } |
| 531 } |
| 532 |
| 515 string16 error = installer_.CheckManagementPolicy(); | 533 string16 error = installer_.CheckManagementPolicy(); |
| 516 if (!error.empty()) { | 534 if (!error.empty()) { |
| 517 // We don't want to show the error infobar for installs from the WebStore, | 535 // We don't want to show the error infobar for installs from the WebStore, |
| 518 // because the WebStore already shows an error dialog itself. | 536 // because the WebStore already shows an error dialog itself. |
| 519 // Note: |client_| can be NULL in unit_tests! | 537 // Note: |client_| can be NULL in unit_tests! |
| 520 if (extension()->from_webstore() && client_) | 538 if (extension()->from_webstore() && client_) |
| 521 client_->install_ui()->set_skip_post_install_ui(true); | 539 client_->install_ui()->set_skip_post_install_ui(true); |
| 522 ReportFailureFromUIThread(CrxInstallerError(error)); | 540 ReportFailureFromUIThread(CrxInstallerError(error)); |
| 523 return; | 541 return; |
| 524 } | 542 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 831 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 814 return; | 832 return; |
| 815 | 833 |
| 816 if (client_) { | 834 if (client_) { |
| 817 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 835 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 818 client_->ConfirmReEnable(this, extension()); | 836 client_->ConfirmReEnable(this, extension()); |
| 819 } | 837 } |
| 820 } | 838 } |
| 821 | 839 |
| 822 } // namespace extensions | 840 } // namespace extensions |
| OLD | NEW |