Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 return true; | 896 return true; |
| 897 } | 897 } |
| 898 return false; | 898 return false; |
| 899 } | 899 } |
| 900 | 900 |
| 901 bool Extension::LoadIsApp(const DictionaryValue* manifest, | 901 bool Extension::LoadIsApp(const DictionaryValue* manifest, |
| 902 std::string* error) { | 902 std::string* error) { |
| 903 if (manifest->HasKey(keys::kApp)) | 903 if (manifest->HasKey(keys::kApp)) |
| 904 is_app_ = true; | 904 is_app_ = true; |
| 905 | 905 |
| 906 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 907 switches::kEnablePlatformApps)) { | |
| 908 if (manifest->HasKey(keys::kPlatformApp)) | |
| 909 is_platform_app_ = true; | |
| 910 } | |
| 911 | |
| 906 return true; | 912 return true; |
| 907 } | 913 } |
| 908 | 914 |
| 909 bool Extension::LoadExtent(const DictionaryValue* manifest, | 915 bool Extension::LoadExtent(const DictionaryValue* manifest, |
| 910 const char* key, | 916 const char* key, |
| 911 URLPatternSet* extent, | 917 URLPatternSet* extent, |
| 912 const char* list_error, | 918 const char* list_error, |
| 913 const char* value_error, | 919 const char* value_error, |
| 914 URLPattern::ParseOption parse_strictness, | 920 URLPattern::ParseOption parse_strictness, |
| 915 std::string* error) { | 921 std::string* error) { |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 return id == std::string("nckgahadagoaajjgafhacjanaoiihapd"); | 1271 return id == std::string("nckgahadagoaajjgafhacjanaoiihapd"); |
| 1266 } | 1272 } |
| 1267 | 1273 |
| 1268 Extension::Extension(const FilePath& path, Location location) | 1274 Extension::Extension(const FilePath& path, Location location) |
| 1269 : incognito_split_mode_(false), | 1275 : incognito_split_mode_(false), |
| 1270 offline_enabled_(false), | 1276 offline_enabled_(false), |
| 1271 location_(location), | 1277 location_(location), |
| 1272 converted_from_user_script_(false), | 1278 converted_from_user_script_(false), |
| 1273 is_theme_(false), | 1279 is_theme_(false), |
| 1274 is_app_(false), | 1280 is_app_(false), |
| 1281 is_platform_app_(false), | |
| 1275 is_storage_isolated_(false), | 1282 is_storage_isolated_(false), |
| 1276 launch_container_(extension_misc::LAUNCH_TAB), | 1283 launch_container_(extension_misc::LAUNCH_TAB), |
| 1277 launch_width_(0), | 1284 launch_width_(0), |
| 1278 launch_height_(0), | 1285 launch_height_(0), |
| 1279 wants_file_access_(false), | 1286 wants_file_access_(false), |
| 1280 creation_flags_(0) { | 1287 creation_flags_(0) { |
| 1281 DCHECK(path.empty() || path.IsAbsolute()); | 1288 DCHECK(path.empty() || path.IsAbsolute()); |
| 1282 path_ = MaybeNormalizePath(path); | 1289 path_ = MaybeNormalizePath(path); |
| 1283 } | 1290 } |
| 1284 | 1291 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1505 !LoadExtent(manifest_value_.get(), keys::kWebURLs, | 1512 !LoadExtent(manifest_value_.get(), keys::kWebURLs, |
| 1506 &extent_, | 1513 &extent_, |
| 1507 errors::kInvalidWebURLs, errors::kInvalidWebURL, | 1514 errors::kInvalidWebURLs, errors::kInvalidWebURL, |
| 1508 parse_strictness, error) || | 1515 parse_strictness, error) || |
| 1509 !EnsureNotHybridApp(manifest_value_.get(), error) || | 1516 !EnsureNotHybridApp(manifest_value_.get(), error) || |
| 1510 !LoadLaunchURL(manifest_value_.get(), error) || | 1517 !LoadLaunchURL(manifest_value_.get(), error) || |
| 1511 !LoadLaunchContainer(manifest_value_.get(), error)) { | 1518 !LoadLaunchContainer(manifest_value_.get(), error)) { |
| 1512 return false; | 1519 return false; |
| 1513 } | 1520 } |
| 1514 | 1521 |
| 1522 if (is_platform_app_) { | |
| 1523 if (launch_container() != extension_misc::LAUNCH_PANEL) { | |
|
Aaron Boodman
2011/11/05 16:10:21
Nit: why not put this in the LoadLaunchContainer()
miket_OOO
2011/11/07 17:07:46
Doing so would contribute to a problem I see with
| |
| 1524 *error = errors::kInvalidLaunchContainerForPlatform; | |
| 1525 return false; | |
| 1526 } | |
| 1527 } | |
| 1528 | |
| 1515 // Initialize the permissions (optional). | 1529 // Initialize the permissions (optional). |
| 1516 ExtensionAPIPermissionSet api_permissions; | 1530 ExtensionAPIPermissionSet api_permissions; |
| 1517 URLPatternSet host_permissions; | 1531 URLPatternSet host_permissions; |
| 1518 if (!ParsePermissions(&source, | 1532 if (!ParsePermissions(&source, |
| 1519 keys::kPermissions, | 1533 keys::kPermissions, |
| 1520 flags, | 1534 flags, |
| 1521 error, | 1535 error, |
| 1522 &api_permissions, | 1536 &api_permissions, |
| 1523 &host_permissions)) { | 1537 &host_permissions)) { |
| 1524 return false; | 1538 return false; |
| (...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3003 already_disabled(false), | 3017 already_disabled(false), |
| 3004 extension(extension) {} | 3018 extension(extension) {} |
| 3005 | 3019 |
| 3006 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3020 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3007 const Extension* extension, | 3021 const Extension* extension, |
| 3008 const ExtensionPermissionSet* permissions, | 3022 const ExtensionPermissionSet* permissions, |
| 3009 Reason reason) | 3023 Reason reason) |
| 3010 : reason(reason), | 3024 : reason(reason), |
| 3011 extension(extension), | 3025 extension(extension), |
| 3012 permissions(permissions) {} | 3026 permissions(permissions) {} |
| OLD | NEW |