| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 std::string error; | 294 std::string error; |
| 294 scoped_refptr<Extension> dummy_extension = | 295 scoped_refptr<Extension> dummy_extension = |
| 295 Extension::Create(base::FilePath(), | 296 Extension::Create(base::FilePath(), |
| 296 install_source_, | 297 install_source_, |
| 297 *expected_manifest_->value(), | 298 *expected_manifest_->value(), |
| 298 creation_flags_, | 299 creation_flags_, |
| 299 &error); | 300 &error); |
| 300 if (error.empty()) { | 301 if (error.empty()) { |
| 301 scoped_refptr<const PermissionSet> expected_permissions = | 302 scoped_refptr<const PermissionSet> expected_permissions = |
| 302 PermissionsData::GetActivePermissions(dummy_extension.get()); | 303 PermissionsData::GetActivePermissions(dummy_extension.get()); |
| 303 valid = !(expected_permissions->HasLessPrivilegesThan( | 304 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
| 304 PermissionsData::GetActivePermissions(extension), | 305 expected_permissions, |
| 305 extension->GetType())); | 306 PermissionsData::GetActivePermissions(extension), |
| 307 extension->GetType())); |
| 306 } | 308 } |
| 307 } | 309 } |
| 308 } | 310 } |
| 309 | 311 |
| 310 if (!valid) | 312 if (!valid) |
| 311 return CrxInstallerError( | 313 return CrxInstallerError( |
| 312 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); | 314 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); |
| 313 } | 315 } |
| 314 | 316 |
| 315 // The checks below are skipped for themes and external installs. | 317 // The checks below are skipped for themes and external installs. |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 862 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 861 return; | 863 return; |
| 862 | 864 |
| 863 if (client_) { | 865 if (client_) { |
| 864 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 866 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 865 client_->ConfirmReEnable(this, extension()); | 867 client_->ConfirmReEnable(this, extension()); |
| 866 } | 868 } |
| 867 } | 869 } |
| 868 | 870 |
| 869 } // namespace extensions | 871 } // namespace extensions |
| OLD | NEW |