| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/ui/webui/site_settings_helper.h" | 5 #include "chrome/browser/ui/webui/site_settings_helper.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 DCHECK(policy_exceptions.empty()); | 237 DCHECK(policy_exceptions.empty()); |
| 238 GetPolicyAllowedUrls(type, &policy_exceptions, web_ui, incognito); | 238 GetPolicyAllowedUrls(type, &policy_exceptions, web_ui, incognito); |
| 239 } | 239 } |
| 240 | 240 |
| 241 for (auto& one_provider_exceptions : all_provider_exceptions) { | 241 for (auto& one_provider_exceptions : all_provider_exceptions) { |
| 242 for (auto& exception : one_provider_exceptions) | 242 for (auto& exception : one_provider_exceptions) |
| 243 exceptions->Append(std::move(exception)); | 243 exceptions->Append(std::move(exception)); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void GetContentCategorySetting( |
| 248 const HostContentSettingsMap* map, |
| 249 ContentSettingsType content_type, |
| 250 base::DictionaryValue* object) { |
| 251 std::string provider; |
| 252 std::string setting = content_settings::ContentSettingToString( |
| 253 map->GetDefaultContentSetting(content_type, &provider)); |
| 254 DCHECK(!setting.empty()); |
| 255 |
| 256 object->SetString(site_settings::kSetting, setting); |
| 257 if (provider != "default") |
| 258 object->SetString(site_settings::kSource, provider); |
| 259 } |
| 260 |
| 247 void GetPolicyAllowedUrls( | 261 void GetPolicyAllowedUrls( |
| 248 ContentSettingsType type, | 262 ContentSettingsType type, |
| 249 std::vector<std::unique_ptr<base::DictionaryValue>>* exceptions, | 263 std::vector<std::unique_ptr<base::DictionaryValue>>* exceptions, |
| 250 content::WebUI* web_ui, | 264 content::WebUI* web_ui, |
| 251 bool incognito) { | 265 bool incognito) { |
| 252 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 266 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| 253 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 267 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 254 | 268 |
| 255 PrefService* prefs = Profile::FromWebUI(web_ui)->GetPrefs(); | 269 PrefService* prefs = Profile::FromWebUI(web_ui)->GetPrefs(); |
| 256 const base::ListValue* policy_urls = prefs->GetList( | 270 const base::ListValue* policy_urls = prefs->GetList( |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 421 } |
| 408 } | 422 } |
| 409 | 423 |
| 410 for (auto& one_provider_exceptions : all_provider_exceptions) { | 424 for (auto& one_provider_exceptions : all_provider_exceptions) { |
| 411 for (auto& exception : one_provider_exceptions) | 425 for (auto& exception : one_provider_exceptions) |
| 412 exceptions->Append(std::move(exception)); | 426 exceptions->Append(std::move(exception)); |
| 413 } | 427 } |
| 414 } | 428 } |
| 415 | 429 |
| 416 } // namespace site_settings | 430 } // namespace site_settings |
| OLD | NEW |