Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 8429023: Add platform_app flag to manifest. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge conflict resolution. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 return id == std::string("nckgahadagoaajjgafhacjanaoiihapd"); 1274 return id == std::string("nckgahadagoaajjgafhacjanaoiihapd");
1269 } 1275 }
1270 1276
1271 Extension::Extension(const FilePath& path, Location location) 1277 Extension::Extension(const FilePath& path, Location location)
1272 : incognito_split_mode_(false), 1278 : incognito_split_mode_(false),
1273 offline_enabled_(false), 1279 offline_enabled_(false),
1274 location_(location), 1280 location_(location),
1275 converted_from_user_script_(false), 1281 converted_from_user_script_(false),
1276 is_theme_(false), 1282 is_theme_(false),
1277 is_app_(false), 1283 is_app_(false),
1284 is_platform_app_(false),
1278 is_storage_isolated_(false), 1285 is_storage_isolated_(false),
1279 launch_container_(extension_misc::LAUNCH_TAB), 1286 launch_container_(extension_misc::LAUNCH_TAB),
1280 launch_width_(0), 1287 launch_width_(0),
1281 launch_height_(0), 1288 launch_height_(0),
1282 wants_file_access_(false), 1289 wants_file_access_(false),
1283 creation_flags_(0) { 1290 creation_flags_(0) {
1284 DCHECK(path.empty() || path.IsAbsolute()); 1291 DCHECK(path.empty() || path.IsAbsolute());
1285 path_ = MaybeNormalizePath(path); 1292 path_ = MaybeNormalizePath(path);
1286 } 1293 }
1287 1294
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 !LoadExtent(manifest_value_.get(), keys::kWebURLs, 1515 !LoadExtent(manifest_value_.get(), keys::kWebURLs,
1509 &extent_, 1516 &extent_,
1510 errors::kInvalidWebURLs, errors::kInvalidWebURL, 1517 errors::kInvalidWebURLs, errors::kInvalidWebURL,
1511 parse_strictness, error) || 1518 parse_strictness, error) ||
1512 !EnsureNotHybridApp(manifest_value_.get(), error) || 1519 !EnsureNotHybridApp(manifest_value_.get(), error) ||
1513 !LoadLaunchURL(manifest_value_.get(), error) || 1520 !LoadLaunchURL(manifest_value_.get(), error) ||
1514 !LoadLaunchContainer(manifest_value_.get(), error)) { 1521 !LoadLaunchContainer(manifest_value_.get(), error)) {
1515 return false; 1522 return false;
1516 } 1523 }
1517 1524
1525 if (is_platform_app_) {
1526 if (launch_container() != extension_misc::LAUNCH_PANEL) {
1527 *error = errors::kInvalidLaunchContainerForPlatform;
1528 return false;
1529 }
1530 }
1531
1518 // Initialize the permissions (optional). 1532 // Initialize the permissions (optional).
1519 ExtensionAPIPermissionSet api_permissions; 1533 ExtensionAPIPermissionSet api_permissions;
1520 URLPatternSet host_permissions; 1534 URLPatternSet host_permissions;
1521 if (!ParsePermissions(&source, 1535 if (!ParsePermissions(&source,
1522 keys::kPermissions, 1536 keys::kPermissions,
1523 flags, 1537 flags,
1524 error, 1538 error,
1525 &api_permissions, 1539 &api_permissions,
1526 &host_permissions)) { 1540 &host_permissions)) {
1527 return false; 1541 return false;
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 already_disabled(false), 3030 already_disabled(false),
3017 extension(extension) {} 3031 extension(extension) {}
3018 3032
3019 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3033 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3020 const Extension* extension, 3034 const Extension* extension,
3021 const ExtensionPermissionSet* permissions, 3035 const ExtensionPermissionSet* permissions,
3022 Reason reason) 3036 Reason reason)
3023 : reason(reason), 3037 : reason(reason),
3024 extension(extension), 3038 extension(extension),
3025 permissions(permissions) {} 3039 permissions(permissions) {}
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698