| 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 Value* temp = NULL; | 1098 Value* temp = NULL; |
| 1099 if (!manifest->Get(keys::kLaunchContainer, &temp)) | 1099 if (!manifest->Get(keys::kLaunchContainer, &temp)) |
| 1100 return true; | 1100 return true; |
| 1101 | 1101 |
| 1102 std::string launch_container_string; | 1102 std::string launch_container_string; |
| 1103 if (!temp->GetAsString(&launch_container_string)) { | 1103 if (!temp->GetAsString(&launch_container_string)) { |
| 1104 *error = errors::kInvalidLaunchContainer; | 1104 *error = errors::kInvalidLaunchContainer; |
| 1105 return false; | 1105 return false; |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 if (launch_container_string == values::kLaunchContainerPanel) { | 1108 if (launch_container_string == values::kLaunchContainerShell) { |
| 1109 launch_container_ = extension_misc::LAUNCH_SHELL; |
| 1110 } else if (launch_container_string == values::kLaunchContainerPanel) { |
| 1109 launch_container_ = extension_misc::LAUNCH_PANEL; | 1111 launch_container_ = extension_misc::LAUNCH_PANEL; |
| 1110 } else if (launch_container_string == values::kLaunchContainerTab) { | 1112 } else if (launch_container_string == values::kLaunchContainerTab) { |
| 1111 launch_container_ = extension_misc::LAUNCH_TAB; | 1113 launch_container_ = extension_misc::LAUNCH_TAB; |
| 1112 } else { | 1114 } else { |
| 1113 *error = errors::kInvalidLaunchContainer; | 1115 *error = errors::kInvalidLaunchContainer; |
| 1114 return false; | 1116 return false; |
| 1115 } | 1117 } |
| 1116 | 1118 |
| 1117 // Validate the container width if present. | 1119 // Validate the container width if present. |
| 1118 if (manifest->Get(keys::kLaunchWidth, &temp)) { | 1120 if (manifest->Get(keys::kLaunchWidth, &temp)) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 &extent_, | 1544 &extent_, |
| 1543 errors::kInvalidWebURLs, errors::kInvalidWebURL, | 1545 errors::kInvalidWebURLs, errors::kInvalidWebURL, |
| 1544 parse_strictness, error) || | 1546 parse_strictness, error) || |
| 1545 !EnsureNotHybridApp(manifest_value_.get(), error) || | 1547 !EnsureNotHybridApp(manifest_value_.get(), error) || |
| 1546 !LoadLaunchURL(manifest_value_.get(), error) || | 1548 !LoadLaunchURL(manifest_value_.get(), error) || |
| 1547 !LoadLaunchContainer(manifest_value_.get(), error)) { | 1549 !LoadLaunchContainer(manifest_value_.get(), error)) { |
| 1548 return false; | 1550 return false; |
| 1549 } | 1551 } |
| 1550 | 1552 |
| 1551 if (is_platform_app_) { | 1553 if (is_platform_app_) { |
| 1552 if (launch_container() != extension_misc::LAUNCH_PANEL) { | 1554 if (launch_container() != extension_misc::LAUNCH_SHELL) { |
| 1553 *error = errors::kInvalidLaunchContainerForPlatform; | 1555 *error = errors::kInvalidLaunchContainerForPlatform; |
| 1554 return false; | 1556 return false; |
| 1555 } | 1557 } |
| 1558 } else if (launch_container() == extension_misc::LAUNCH_SHELL) { |
| 1559 *error = errors::kInvalidLaunchContainerForNonPlatform; |
| 1560 return false; |
| 1556 } | 1561 } |
| 1557 | 1562 |
| 1558 // Initialize the permissions (optional). | 1563 // Initialize the permissions (optional). |
| 1559 ExtensionAPIPermissionSet api_permissions; | 1564 ExtensionAPIPermissionSet api_permissions; |
| 1560 URLPatternSet host_permissions; | 1565 URLPatternSet host_permissions; |
| 1561 if (!ParsePermissions(&source, | 1566 if (!ParsePermissions(&source, |
| 1562 keys::kPermissions, | 1567 keys::kPermissions, |
| 1563 flags, | 1568 flags, |
| 1564 error, | 1569 error, |
| 1565 &api_permissions, | 1570 &api_permissions, |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3069 already_disabled(false), | 3074 already_disabled(false), |
| 3070 extension(extension) {} | 3075 extension(extension) {} |
| 3071 | 3076 |
| 3072 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3077 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3073 const Extension* extension, | 3078 const Extension* extension, |
| 3074 const ExtensionPermissionSet* permissions, | 3079 const ExtensionPermissionSet* permissions, |
| 3075 Reason reason) | 3080 Reason reason) |
| 3076 : reason(reason), | 3081 : reason(reason), |
| 3077 extension(extension), | 3082 extension(extension), |
| 3078 permissions(permissions) {} | 3083 permissions(permissions) {} |
| OLD | NEW |