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

Unified Diff: chrome/browser/ui/webui/site_settings_helper.cc

Issue 2350303004: Site Settings Desktop: Fix crash when altering exception. (Closed)
Patch Set: Address feedback Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/site_settings_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/site_settings_helper.cc
diff --git a/chrome/browser/ui/webui/site_settings_helper.cc b/chrome/browser/ui/webui/site_settings_helper.cc
index 3adec20b21e613d24ae78fd1caf672d2886b6f3e..08e6243494afc0829173ceb31adf7bf9d97daacf 100644
--- a/chrome/browser/ui/webui/site_settings_helper.cc
+++ b/chrome/browser/ui/webui/site_settings_helper.cc
@@ -18,6 +18,8 @@
namespace site_settings {
+const char kAppName[] = "appName";
+const char kAppId[] = "appId";
const char kSetting[] = "setting";
const char kOrigin[] = "origin";
const char kPolicyProviderId[] = "policy";
@@ -78,6 +80,26 @@ std::string ContentSettingsTypeToGroupName(ContentSettingsType type) {
return std::string();
}
+// Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from
+// the web extent of a hosted |app|.
+void AddExceptionForHostedApp(const std::string& url_pattern,
+ const extensions::Extension& app, base::ListValue* exceptions) {
+ std::unique_ptr<base::DictionaryValue> exception(new base::DictionaryValue());
+
+ std::string setting_string =
+ content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW);
+ DCHECK(!setting_string.empty());
+
+ exception->SetString(site_settings::kSetting, setting_string);
+ exception->SetString(site_settings::kOrigin, url_pattern);
+ exception->SetString(site_settings::kEmbeddingOrigin, url_pattern);
+ exception->SetString(site_settings::kSource, "HostedApp");
+ exception->SetBoolean(site_settings::kIncognito, false);
+ exception->SetString(kAppName, app.name());
+ exception->SetString(kAppId, app.id());
+ exceptions->Append(std::move(exception));
+}
+
// Create a DictionaryValue* that will act as a data source for a single row
// in a HostContentSettingsMap-controlled exceptions table (e.g., cookies).
std::unique_ptr<base::DictionaryValue> GetExceptionForPage(
« no previous file with comments | « chrome/browser/ui/webui/site_settings_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698