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

Unified 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: Refactor and address comments. Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index eecf6a98999ebf1813e607d54e62e7d6b9a560bb..64dd96478688525711488eba19c92caabb6fe9cf 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1061,6 +1061,43 @@ bool Extension::LoadLaunchContainer(const DictionaryValue* manifest,
return true;
}
+bool Extension::LoadAppIsolation(const DictionaryValue* manifest,
+ std::string* error) {
+ // Only parse app isolation features if this switch is present.
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableExperimentalAppManifests))
+ return true;
+
+ Value* temp = NULL;
+ if (!manifest->Get(keys::kIsolation, &temp))
+ return true;
+
+ if (temp->GetType() != Value::TYPE_LIST) {
+ *error = errors::kInvalidIsolation;
+ return false;
+ }
+
+ ListValue* isolation_list = static_cast<ListValue*>(temp);
+ for (size_t i = 0; i < isolation_list->GetSize(); ++i) {
+ std::string isolation_string;
+ if (!isolation_list->GetString(i, &isolation_string)) {
+ *error = ExtensionErrorUtils::FormatErrorMessage(
+ errors::kInvalidIsolationValue,
+ base::UintToString(i));
+ return false;
+ }
+
+ // Check for isolated storage.
+ if (isolation_string == values::kIsolatedStorage) {
+ is_storage_isolated_ = true;
+ } else {
+ LOG(WARNING) << "Did not recognize isolation type: "
+ << isolation_string;
+ }
+ }
+ return true;
+}
+
bool Extension::EnsureNotHybridApp(const DictionaryValue* manifest,
std::string* error) {
if (web_extent().is_empty())
@@ -1086,6 +1123,7 @@ Extension::Extension(const FilePath& path, Location location)
converted_from_user_script_(false),
is_theme_(false),
is_app_(false),
+ is_storage_isolated_(false),
launch_container_(extension_misc::LAUNCH_TAB),
launch_width_(0),
launch_height_(0) {
@@ -1717,7 +1755,8 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
errors::kInvalidWebURLs, errors::kInvalidWebURL, error) ||
!EnsureNotHybridApp(manifest_value_.get(), error) ||
!LoadLaunchURL(manifest_value_.get(), error) ||
- !LoadLaunchContainer(manifest_value_.get(), error)) {
+ !LoadLaunchContainer(manifest_value_.get(), error) ||
+ !LoadAppIsolation(manifest_value_.get(), error)) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698