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 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 Value* temp = NULL; | 1096 Value* temp = NULL; |
1097 if (!manifest->Get(keys::kLaunchContainer, &temp)) | 1097 if (!manifest->Get(keys::kLaunchContainer, &temp)) |
1098 return true; | 1098 return true; |
1099 | 1099 |
1100 std::string launch_container_string; | 1100 std::string launch_container_string; |
1101 if (!temp->GetAsString(&launch_container_string)) { | 1101 if (!temp->GetAsString(&launch_container_string)) { |
1102 *error = errors::kInvalidLaunchContainer; | 1102 *error = errors::kInvalidLaunchContainer; |
1103 return false; | 1103 return false; |
1104 } | 1104 } |
1105 | 1105 |
1106 if (launch_container_string == values::kLaunchContainerPanel) { | 1106 if (launch_container_string == values::kLaunchContainerShell) { |
| 1107 launch_container_ = extension_misc::LAUNCH_SHELL; |
| 1108 } else if (launch_container_string == values::kLaunchContainerPanel) { |
1107 launch_container_ = extension_misc::LAUNCH_PANEL; | 1109 launch_container_ = extension_misc::LAUNCH_PANEL; |
1108 } else if (launch_container_string == values::kLaunchContainerTab) { | 1110 } else if (launch_container_string == values::kLaunchContainerTab) { |
1109 launch_container_ = extension_misc::LAUNCH_TAB; | 1111 launch_container_ = extension_misc::LAUNCH_TAB; |
1110 } else { | 1112 } else { |
1111 *error = errors::kInvalidLaunchContainer; | 1113 *error = errors::kInvalidLaunchContainer; |
1112 return false; | 1114 return false; |
1113 } | 1115 } |
1114 | 1116 |
1115 // Validate the container width if present. | 1117 // Validate the container width if present. |
1116 if (manifest->Get(keys::kLaunchWidth, &temp)) { | 1118 if (manifest->Get(keys::kLaunchWidth, &temp)) { |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 &extent_, | 1536 &extent_, |
1535 errors::kInvalidWebURLs, errors::kInvalidWebURL, | 1537 errors::kInvalidWebURLs, errors::kInvalidWebURL, |
1536 parse_strictness, error) || | 1538 parse_strictness, error) || |
1537 !EnsureNotHybridApp(manifest_value_.get(), error) || | 1539 !EnsureNotHybridApp(manifest_value_.get(), error) || |
1538 !LoadLaunchURL(manifest_value_.get(), error) || | 1540 !LoadLaunchURL(manifest_value_.get(), error) || |
1539 !LoadLaunchContainer(manifest_value_.get(), error)) { | 1541 !LoadLaunchContainer(manifest_value_.get(), error)) { |
1540 return false; | 1542 return false; |
1541 } | 1543 } |
1542 | 1544 |
1543 if (is_platform_app_) { | 1545 if (is_platform_app_) { |
1544 if (launch_container() != extension_misc::LAUNCH_PANEL) { | 1546 if (launch_container() != extension_misc::LAUNCH_SHELL) { |
1545 *error = errors::kInvalidLaunchContainerForPlatform; | 1547 *error = errors::kInvalidLaunchContainerForPlatform; |
1546 return false; | 1548 return false; |
1547 } | 1549 } |
| 1550 } else if (launch_container() == extension_misc::LAUNCH_SHELL) { |
| 1551 *error = errors::kInvalidLaunchContainerForNonPlatform; |
| 1552 return false; |
1548 } | 1553 } |
1549 | 1554 |
1550 // Initialize the permissions (optional). | 1555 // Initialize the permissions (optional). |
1551 ExtensionAPIPermissionSet api_permissions; | 1556 ExtensionAPIPermissionSet api_permissions; |
1552 URLPatternSet host_permissions; | 1557 URLPatternSet host_permissions; |
1553 if (!ParsePermissions(&source, | 1558 if (!ParsePermissions(&source, |
1554 keys::kPermissions, | 1559 keys::kPermissions, |
1555 flags, | 1560 flags, |
1556 error, | 1561 error, |
1557 &api_permissions, | 1562 &api_permissions, |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 already_disabled(false), | 3066 already_disabled(false), |
3062 extension(extension) {} | 3067 extension(extension) {} |
3063 | 3068 |
3064 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3069 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3065 const Extension* extension, | 3070 const Extension* extension, |
3066 const ExtensionPermissionSet* permissions, | 3071 const ExtensionPermissionSet* permissions, |
3067 Reason reason) | 3072 Reason reason) |
3068 : reason(reason), | 3073 : reason(reason), |
3069 extension(extension), | 3074 extension(extension), |
3070 permissions(permissions) {} | 3075 permissions(permissions) {} |
OLD | NEW |