Chromium Code Reviews| 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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 18 #include "base/string16.h" | 18 #include "base/string16.h" |
| 19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
| 20 #include "base/string_piece.h" | 20 #include "base/string_piece.h" |
| 21 #include "base/string_split.h" | 21 #include "base/string_split.h" |
| 22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "base/version.h" | 25 #include "base/version.h" |
| 26 #include "crypto/sha2.h" | |
| 27 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
| 28 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/chrome_version_info.h" | 28 #include "chrome/common/chrome_version_info.h" |
| 30 #include "chrome/common/extensions/csp_validator.h" | 29 #include "chrome/common/extensions/csp_validator.h" |
| 31 #include "chrome/common/extensions/extension_action.h" | 30 #include "chrome/common/extensions/extension_action.h" |
| 32 #include "chrome/common/extensions/extension_constants.h" | 31 #include "chrome/common/extensions/extension_constants.h" |
| 33 #include "chrome/common/extensions/extension_error_utils.h" | 32 #include "chrome/common/extensions/extension_error_utils.h" |
| 34 #include "chrome/common/extensions/extension_resource.h" | 33 #include "chrome/common/extensions/extension_resource.h" |
| 35 #include "chrome/common/extensions/feature.h" | 34 #include "chrome/common/extensions/feature.h" |
| 36 #include "chrome/common/extensions/file_browser_handler.h" | 35 #include "chrome/common/extensions/file_browser_handler.h" |
| 37 #include "chrome/common/extensions/manifest.h" | 36 #include "chrome/common/extensions/manifest.h" |
| 38 #include "chrome/common/extensions/simple_feature_provider.h" | 37 #include "chrome/common/extensions/simple_feature_provider.h" |
| 39 #include "chrome/common/extensions/user_script.h" | 38 #include "chrome/common/extensions/user_script.h" |
| 40 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
| 40 #include "crypto/sha2.h" | |
| 41 #include "googleurl/src/url_util.h" | 41 #include "googleurl/src/url_util.h" |
| 42 #include "grit/chromium_strings.h" | 42 #include "grit/chromium_strings.h" |
| 43 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
| 44 #include "grit/theme_resources.h" | 44 #include "grit/theme_resources.h" |
| 45 #include "net/base/registry_controlled_domain.h" | 45 #include "net/base/registry_controlled_domain.h" |
| 46 #include "third_party/skia/include/core/SkBitmap.h" | 46 #include "third_party/skia/include/core/SkBitmap.h" |
| 47 #include "ui/base/keycodes/keyboard_codes.h" | 47 #include "ui/base/keycodes/keyboard_codes.h" |
| 48 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
| 49 #include "ui/base/resource/resource_bundle.h" | 49 #include "ui/base/resource/resource_bundle.h" |
| 50 #include "webkit/glue/image_decoder.h" | 50 #include "webkit/glue/image_decoder.h" |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1310 } | 1310 } |
| 1311 if (launch_max_height_ > 0 && launch_max_height_ < launch_min_height_) { | 1311 if (launch_max_height_ > 0 && launch_max_height_ < launch_min_height_) { |
| 1312 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1312 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1313 errors::kInvalidLaunchValue, | 1313 errors::kInvalidLaunchValue, |
| 1314 keys::kLaunchMaxHeight); | 1314 keys::kLaunchMaxHeight); |
| 1315 return false; | 1315 return false; |
| 1316 } | 1316 } |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 if (is_platform_app()) { | 1319 if (is_platform_app()) { |
| 1320 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
|
Aaron Boodman
2012/03/22 19:16:30
Can we instead put this check in Manifest::GetType
| |
| 1321 switches::kEnablePlatformApps)) { | |
| 1322 *error = ASCIIToUTF16(errors::kPlatformAppFlagRequired); | |
| 1323 return false; | |
| 1324 } | |
| 1320 if (launch_container_ != extension_misc::LAUNCH_SHELL) { | 1325 if (launch_container_ != extension_misc::LAUNCH_SHELL) { |
| 1321 *error = ASCIIToUTF16(errors::kInvalidLaunchContainerForPlatform); | 1326 *error = ASCIIToUTF16(errors::kInvalidLaunchContainerForPlatform); |
| 1322 return false; | 1327 return false; |
| 1323 } | 1328 } |
| 1324 } else if (launch_container_ == extension_misc::LAUNCH_SHELL) { | 1329 } else if (launch_container_ == extension_misc::LAUNCH_SHELL) { |
| 1325 *error = ASCIIToUTF16(errors::kInvalidLaunchContainerForNonPlatform); | 1330 *error = ASCIIToUTF16(errors::kInvalidLaunchContainerForNonPlatform); |
| 1326 return false; | 1331 return false; |
| 1327 } | 1332 } |
| 1328 | 1333 |
| 1329 return true; | 1334 return true; |
| (...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3498 already_disabled(false), | 3503 already_disabled(false), |
| 3499 extension(extension) {} | 3504 extension(extension) {} |
| 3500 | 3505 |
| 3501 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3506 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3502 const Extension* extension, | 3507 const Extension* extension, |
| 3503 const ExtensionPermissionSet* permissions, | 3508 const ExtensionPermissionSet* permissions, |
| 3504 Reason reason) | 3509 Reason reason) |
| 3505 : reason(reason), | 3510 : reason(reason), |
| 3506 extension(extension), | 3511 extension(extension), |
| 3507 permissions(permissions) {} | 3512 permissions(permissions) {} |
| OLD | NEW |