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

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

Issue 6201005: Initial support for partitioning cookies for isolated apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix automation_util and thread issue. Created 9 years, 9 months 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 if (!temp->GetAsInteger(&launch_height_) || launch_height_ < 0) { 1102 if (!temp->GetAsInteger(&launch_height_) || launch_height_ < 0) {
1103 launch_height_ = 0; 1103 launch_height_ = 0;
1104 *error = errors::kInvalidLaunchHeight; 1104 *error = errors::kInvalidLaunchHeight;
1105 return false; 1105 return false;
1106 } 1106 }
1107 } 1107 }
1108 1108
1109 return true; 1109 return true;
1110 } 1110 }
1111 1111
1112 bool Extension::LoadAppIsolation(const DictionaryValue* manifest,
1113 std::string* error) {
1114 // Only parse app isolation features if this switch is present.
1115 if (!CommandLine::ForCurrentProcess()->HasSwitch(
1116 switches::kEnableExperimentalAppManifests))
1117 return true;
1118
1119 Value* temp = NULL;
1120 if (!manifest->Get(keys::kIsolation, &temp))
1121 return true;
1122
1123 if (temp->GetType() != Value::TYPE_LIST) {
1124 *error = errors::kInvalidIsolation;
1125 return false;
1126 }
1127
1128 ListValue* isolation_list = static_cast<ListValue*>(temp);
1129 for (size_t i = 0; i < isolation_list->GetSize(); ++i) {
1130 std::string isolation_string;
1131 if (!isolation_list->GetString(i, &isolation_string)) {
1132 *error = ExtensionErrorUtils::FormatErrorMessage(
1133 errors::kInvalidIsolationValue,
1134 base::UintToString(i));
1135 return false;
1136 }
1137
1138 // Check for isolated storage.
1139 if (isolation_string == values::kIsolatedStorage) {
1140 is_storage_isolated_ = true;
1141 } else {
1142 LOG(WARNING) << "Did not recognize isolation type: "
1143 << isolation_string;
1144 }
1145 }
1146 return true;
1147 }
1148
1112 bool Extension::EnsureNotHybridApp(const DictionaryValue* manifest, 1149 bool Extension::EnsureNotHybridApp(const DictionaryValue* manifest,
1113 std::string* error) { 1150 std::string* error) {
1114 if (web_extent().is_empty()) 1151 if (web_extent().is_empty())
1115 return true; 1152 return true;
1116 1153
1117 for (DictionaryValue::key_iterator key = manifest->begin_keys(); 1154 for (DictionaryValue::key_iterator key = manifest->begin_keys();
1118 key != manifest->end_keys(); ++key) { 1155 key != manifest->end_keys(); ++key) {
1119 if (!IsBaseCrxKey(*key) && 1156 if (!IsBaseCrxKey(*key) &&
1120 *key != keys::kApp && 1157 *key != keys::kApp &&
1121 *key != keys::kPermissions && 1158 *key != keys::kPermissions &&
1122 *key != keys::kOptionsPage) { 1159 *key != keys::kOptionsPage) {
1123 *error = errors::kHostedAppsCannotIncludeExtensionFeatures; 1160 *error = errors::kHostedAppsCannotIncludeExtensionFeatures;
1124 return false; 1161 return false;
1125 } 1162 }
1126 } 1163 }
1127 1164
1128 return true; 1165 return true;
1129 } 1166 }
1130 1167
1131 Extension::Extension(const FilePath& path, Location location) 1168 Extension::Extension(const FilePath& path, Location location)
1132 : incognito_split_mode_(false), 1169 : incognito_split_mode_(false),
1133 location_(location), 1170 location_(location),
1134 converted_from_user_script_(false), 1171 converted_from_user_script_(false),
1135 is_theme_(false), 1172 is_theme_(false),
1136 is_app_(false), 1173 is_app_(false),
1174 is_storage_isolated_(false),
1137 launch_container_(extension_misc::LAUNCH_TAB), 1175 launch_container_(extension_misc::LAUNCH_TAB),
1138 launch_width_(0), 1176 launch_width_(0),
1139 launch_height_(0) { 1177 launch_height_(0) {
1140 DCHECK(path.IsAbsolute()); 1178 DCHECK(path.IsAbsolute());
1141 path_ = MaybeNormalizePath(path); 1179 path_ = MaybeNormalizePath(path);
1142 } 1180 }
1143 Extension::~Extension() { 1181 Extension::~Extension() {
1144 } 1182 }
1145 ExtensionResource Extension::GetResource( 1183 ExtensionResource Extension::GetResource(
1146 const std::string& relative_path) const { 1184 const std::string& relative_path) const {
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 } 1803 }
1766 1804
1767 // Load App settings. 1805 // Load App settings.
1768 if (!LoadIsApp(manifest_value_.get(), error) || 1806 if (!LoadIsApp(manifest_value_.get(), error) ||
1769 !LoadExtent(manifest_value_.get(), keys::kWebURLs, 1807 !LoadExtent(manifest_value_.get(), keys::kWebURLs,
1770 &extent_, 1808 &extent_,
1771 errors::kInvalidWebURLs, errors::kInvalidWebURL, 1809 errors::kInvalidWebURLs, errors::kInvalidWebURL,
1772 parse_strictness, error) || 1810 parse_strictness, error) ||
1773 !EnsureNotHybridApp(manifest_value_.get(), error) || 1811 !EnsureNotHybridApp(manifest_value_.get(), error) ||
1774 !LoadLaunchURL(manifest_value_.get(), error) || 1812 !LoadLaunchURL(manifest_value_.get(), error) ||
1775 !LoadLaunchContainer(manifest_value_.get(), error)) { 1813 !LoadLaunchContainer(manifest_value_.get(), error) ||
1814 !LoadAppIsolation(manifest_value_.get(), error)) {
1776 return false; 1815 return false;
1777 } 1816 }
1778 1817
1779 // Initialize options page url (optional). 1818 // Initialize options page url (optional).
1780 // Funtion LoadIsApp() set is_app_ above. 1819 // Funtion LoadIsApp() set is_app_ above.
1781 if (source.HasKey(keys::kOptionsPage)) { 1820 if (source.HasKey(keys::kOptionsPage)) {
1782 std::string options_str; 1821 std::string options_str;
1783 if (!source.GetString(keys::kOptionsPage, &options_str)) { 1822 if (!source.GetString(keys::kOptionsPage, &options_str)) {
1784 *error = errors::kInvalidOptionsPage; 1823 *error = errors::kInvalidOptionsPage;
1785 return false; 1824 return false;
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 2514
2476 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} 2515 UninstalledExtensionInfo::~UninstalledExtensionInfo() {}
2477 2516
2478 2517
2479 UnloadedExtensionInfo::UnloadedExtensionInfo( 2518 UnloadedExtensionInfo::UnloadedExtensionInfo(
2480 const Extension* extension, 2519 const Extension* extension,
2481 Reason reason) 2520 Reason reason)
2482 : reason(reason), 2521 : reason(reason),
2483 already_disabled(false), 2522 already_disabled(false),
2484 extension(extension) {} 2523 extension(extension) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698