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

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 merge conflicts. 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
« 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) 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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 if (!temp->GetAsInteger(&launch_height_) || launch_height_ < 0) { 1133 if (!temp->GetAsInteger(&launch_height_) || launch_height_ < 0) {
1134 launch_height_ = 0; 1134 launch_height_ = 0;
1135 *error = errors::kInvalidLaunchHeight; 1135 *error = errors::kInvalidLaunchHeight;
1136 return false; 1136 return false;
1137 } 1137 }
1138 } 1138 }
1139 1139
1140 return true; 1140 return true;
1141 } 1141 }
1142 1142
1143 bool Extension::LoadAppIsolation(const DictionaryValue* manifest,
1144 std::string* error) {
1145 // Only parse app isolation features if this switch is present.
1146 if (!CommandLine::ForCurrentProcess()->HasSwitch(
1147 switches::kEnableExperimentalAppManifests))
1148 return true;
1149
1150 Value* temp = NULL;
1151 if (!manifest->Get(keys::kIsolation, &temp))
1152 return true;
1153
1154 if (temp->GetType() != Value::TYPE_LIST) {
1155 *error = errors::kInvalidIsolation;
1156 return false;
1157 }
1158
1159 ListValue* isolation_list = static_cast<ListValue*>(temp);
1160 for (size_t i = 0; i < isolation_list->GetSize(); ++i) {
1161 std::string isolation_string;
1162 if (!isolation_list->GetString(i, &isolation_string)) {
1163 *error = ExtensionErrorUtils::FormatErrorMessage(
1164 errors::kInvalidIsolationValue,
1165 base::UintToString(i));
1166 return false;
1167 }
1168
1169 // Check for isolated storage.
1170 if (isolation_string == values::kIsolatedStorage) {
1171 is_storage_isolated_ = true;
1172 } else {
1173 LOG(WARNING) << "Did not recognize isolation type: "
1174 << isolation_string;
1175 }
1176 }
1177 return true;
1178 }
1179
1143 bool Extension::EnsureNotHybridApp(const DictionaryValue* manifest, 1180 bool Extension::EnsureNotHybridApp(const DictionaryValue* manifest,
1144 std::string* error) { 1181 std::string* error) {
1145 if (web_extent().is_empty()) 1182 if (web_extent().is_empty())
1146 return true; 1183 return true;
1147 1184
1148 for (DictionaryValue::key_iterator key = manifest->begin_keys(); 1185 for (DictionaryValue::key_iterator key = manifest->begin_keys();
1149 key != manifest->end_keys(); ++key) { 1186 key != manifest->end_keys(); ++key) {
1150 if (!IsBaseCrxKey(*key) && 1187 if (!IsBaseCrxKey(*key) &&
1151 *key != keys::kApp && 1188 *key != keys::kApp &&
1152 *key != keys::kPermissions && 1189 *key != keys::kPermissions &&
1153 *key != keys::kOptionsPage) { 1190 *key != keys::kOptionsPage) {
1154 *error = errors::kHostedAppsCannotIncludeExtensionFeatures; 1191 *error = errors::kHostedAppsCannotIncludeExtensionFeatures;
1155 return false; 1192 return false;
1156 } 1193 }
1157 } 1194 }
1158 1195
1159 return true; 1196 return true;
1160 } 1197 }
1161 1198
1162 Extension::Extension(const FilePath& path, Location location) 1199 Extension::Extension(const FilePath& path, Location location)
1163 : incognito_split_mode_(false), 1200 : incognito_split_mode_(false),
1164 location_(location), 1201 location_(location),
1165 converted_from_user_script_(false), 1202 converted_from_user_script_(false),
1166 is_theme_(false), 1203 is_theme_(false),
1167 is_app_(false), 1204 is_app_(false),
1205 is_storage_isolated_(false),
1168 launch_container_(extension_misc::LAUNCH_TAB), 1206 launch_container_(extension_misc::LAUNCH_TAB),
1169 launch_width_(0), 1207 launch_width_(0),
1170 launch_height_(0) { 1208 launch_height_(0) {
1171 DCHECK(path.IsAbsolute()); 1209 DCHECK(path.IsAbsolute());
1172 path_ = MaybeNormalizePath(path); 1210 path_ = MaybeNormalizePath(path);
1173 } 1211 }
1174 Extension::~Extension() { 1212 Extension::~Extension() {
1175 } 1213 }
1176 ExtensionResource Extension::GetResource( 1214 ExtensionResource Extension::GetResource(
1177 const std::string& relative_path) const { 1215 const std::string& relative_path) const {
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 } 1834 }
1797 1835
1798 // Load App settings. 1836 // Load App settings.
1799 if (!LoadIsApp(manifest_value_.get(), error) || 1837 if (!LoadIsApp(manifest_value_.get(), error) ||
1800 !LoadExtent(manifest_value_.get(), keys::kWebURLs, 1838 !LoadExtent(manifest_value_.get(), keys::kWebURLs,
1801 &extent_, 1839 &extent_,
1802 errors::kInvalidWebURLs, errors::kInvalidWebURL, 1840 errors::kInvalidWebURLs, errors::kInvalidWebURL,
1803 parse_strictness, error) || 1841 parse_strictness, error) ||
1804 !EnsureNotHybridApp(manifest_value_.get(), error) || 1842 !EnsureNotHybridApp(manifest_value_.get(), error) ||
1805 !LoadLaunchURL(manifest_value_.get(), error) || 1843 !LoadLaunchURL(manifest_value_.get(), error) ||
1806 !LoadLaunchContainer(manifest_value_.get(), error)) { 1844 !LoadLaunchContainer(manifest_value_.get(), error) ||
1845 !LoadAppIsolation(manifest_value_.get(), error)) {
1807 return false; 1846 return false;
1808 } 1847 }
1809 1848
1810 // Initialize options page url (optional). 1849 // Initialize options page url (optional).
1811 // Funtion LoadIsApp() set is_app_ above. 1850 // Funtion LoadIsApp() set is_app_ above.
1812 if (source.HasKey(keys::kOptionsPage)) { 1851 if (source.HasKey(keys::kOptionsPage)) {
1813 std::string options_str; 1852 std::string options_str;
1814 if (!source.GetString(keys::kOptionsPage, &options_str)) { 1853 if (!source.GetString(keys::kOptionsPage, &options_str)) {
1815 *error = errors::kInvalidOptionsPage; 1854 *error = errors::kInvalidOptionsPage;
1816 return false; 1855 return false;
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 2545
2507 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} 2546 UninstalledExtensionInfo::~UninstalledExtensionInfo() {}
2508 2547
2509 2548
2510 UnloadedExtensionInfo::UnloadedExtensionInfo( 2549 UnloadedExtensionInfo::UnloadedExtensionInfo(
2511 const Extension* extension, 2550 const Extension* extension,
2512 Reason reason) 2551 Reason reason)
2513 : reason(reason), 2552 : reason(reason),
2514 already_disabled(false), 2553 already_disabled(false),
2515 extension(extension) {} 2554 extension(extension) {}
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