| 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 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" | 41 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h" |
| 42 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" | 42 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" |
| 43 #include "chrome/common/extensions/manifest_url_handler.h" | 43 #include "chrome/common/extensions/manifest_url_handler.h" |
| 44 #include "chrome/common/extensions/permissions/permission_set.h" | 44 #include "chrome/common/extensions/permissions/permission_set.h" |
| 45 #include "chrome/common/extensions/permissions/permissions_data.h" | 45 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
| 47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 48 #include "content/public/browser/resource_dispatcher_host.h" | 48 #include "content/public/browser/resource_dispatcher_host.h" |
| 49 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
| 50 #include "extensions/common/manifest.h" | 50 #include "extensions/common/manifest.h" |
| 51 #include "extensions/common/permissions/permission_message_provider.h" |
| 51 #include "extensions/common/user_script.h" | 52 #include "extensions/common/user_script.h" |
| 52 #include "grit/chromium_strings.h" | 53 #include "grit/chromium_strings.h" |
| 53 #include "grit/generated_resources.h" | 54 #include "grit/generated_resources.h" |
| 54 #include "grit/theme_resources.h" | 55 #include "grit/theme_resources.h" |
| 55 #include "third_party/skia/include/core/SkBitmap.h" | 56 #include "third_party/skia/include/core/SkBitmap.h" |
| 56 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
| 57 #include "ui/base/resource/resource_bundle.h" | 58 #include "ui/base/resource/resource_bundle.h" |
| 58 | 59 |
| 59 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 60 #include "chrome/browser/chromeos/login/user_manager.h" | 61 #include "chrome/browser/chromeos/login/user_manager.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 std::string error; | 266 std::string error; |
| 266 scoped_refptr<Extension> dummy_extension = | 267 scoped_refptr<Extension> dummy_extension = |
| 267 Extension::Create(base::FilePath(), | 268 Extension::Create(base::FilePath(), |
| 268 install_source_, | 269 install_source_, |
| 269 *expected_manifest_->value(), | 270 *expected_manifest_->value(), |
| 270 creation_flags_, | 271 creation_flags_, |
| 271 &error); | 272 &error); |
| 272 if (error.empty()) { | 273 if (error.empty()) { |
| 273 scoped_refptr<const PermissionSet> expected_permissions = | 274 scoped_refptr<const PermissionSet> expected_permissions = |
| 274 PermissionsData::GetActivePermissions(dummy_extension.get()); | 275 PermissionsData::GetActivePermissions(dummy_extension.get()); |
| 275 valid = !(expected_permissions->HasLessPrivilegesThan( | 276 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
| 276 PermissionsData::GetActivePermissions(extension), | 277 expected_permissions, |
| 277 extension->GetType())); | 278 PermissionsData::GetActivePermissions(extension), |
| 279 extension->GetType())); |
| 278 } | 280 } |
| 279 } | 281 } |
| 280 } | 282 } |
| 281 if (!valid) | 283 if (!valid) |
| 282 return CrxInstallerError( | 284 return CrxInstallerError( |
| 283 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); | 285 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); |
| 284 } | 286 } |
| 285 | 287 |
| 286 // The checks below are skipped for themes and external installs. | 288 // The checks below are skipped for themes and external installs. |
| 287 // TODO(pamg): After ManagementPolicy refactoring is complete, remove this | 289 // TODO(pamg): After ManagementPolicy refactoring is complete, remove this |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 833 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 832 return; | 834 return; |
| 833 | 835 |
| 834 if (client_) { | 836 if (client_) { |
| 835 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 837 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 836 client_->ConfirmReEnable(this, extension()); | 838 client_->ConfirmReEnable(this, extension()); |
| 837 } | 839 } |
| 838 } | 840 } |
| 839 | 841 |
| 840 } // namespace extensions | 842 } // namespace extensions |
| OLD | NEW |