Chromium Code Reviews| 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); |
|
Finnur
2016/09/20 15:46:13
The changes in this file are purely code moving fr
|
| + 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( |