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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/permissions/chooser_context_base.h" | 12 #include "chrome/browser/permissions/chooser_context_base.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/usb/usb_chooser_context_factory.h" | 14 #include "chrome/browser/usb/usb_chooser_context_factory.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
16 #include "components/content_settings/core/browser/host_content_settings_map.h" | 16 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 17 #include "components/content_settings/core/common/content_settings.h" |
17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
18 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
19 | 20 |
20 namespace site_settings { | 21 namespace site_settings { |
21 | 22 |
22 const char kAppName[] = "appName"; | 23 const char kAppName[] = "appName"; |
23 const char kAppId[] = "appId"; | 24 const char kAppId[] = "appId"; |
24 const char kSetting[] = "setting"; | 25 const char kSetting[] = "setting"; |
25 const char kOrigin[] = "origin"; | 26 const char kOrigin[] = "origin"; |
26 const char kDisplayName[] = "displayName"; | 27 const char kDisplayName[] = "displayName"; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // Off-the-record HostContentSettingsMap contains incognito content settings | 197 // Off-the-record HostContentSettingsMap contains incognito content settings |
197 // as well as normal content settings. Here, we use the incongnito settings | 198 // as well as normal content settings. Here, we use the incongnito settings |
198 // only. | 199 // only. |
199 if (map->is_incognito() && !i->incognito) | 200 if (map->is_incognito() && !i->incognito) |
200 continue; | 201 continue; |
201 | 202 |
202 if (filter && i->primary_pattern.ToString() != *filter) | 203 if (filter && i->primary_pattern.ToString() != *filter) |
203 continue; | 204 continue; |
204 | 205 |
205 all_patterns_settings[std::make_pair(i->primary_pattern, i->source)] | 206 all_patterns_settings[std::make_pair(i->primary_pattern, i->source)] |
206 [i->secondary_pattern] = i->setting; | 207 [i->secondary_pattern] = i->GetContentSetting(); |
207 } | 208 } |
208 | 209 |
209 // Keep the exceptions sorted by provider so they will be displayed in | 210 // Keep the exceptions sorted by provider so they will be displayed in |
210 // precedence order. | 211 // precedence order. |
211 std::vector<std::unique_ptr<base::DictionaryValue>> | 212 std::vector<std::unique_ptr<base::DictionaryValue>> |
212 all_provider_exceptions[HostContentSettingsMap::NUM_PROVIDER_TYPES]; | 213 all_provider_exceptions[HostContentSettingsMap::NUM_PROVIDER_TYPES]; |
213 | 214 |
214 // |all_patterns_settings| is sorted from the lowest precedence pattern to | 215 // |all_patterns_settings| is sorted from the lowest precedence pattern to |
215 // the highest (see operator< in ContentSettingsPattern), so traverse it in | 216 // the highest (see operator< in ContentSettingsPattern), so traverse it in |
216 // reverse to show the patterns with the highest precedence (the more specific | 217 // reverse to show the patterns with the highest precedence (the more specific |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 456 } |
456 } | 457 } |
457 | 458 |
458 for (auto& one_provider_exceptions : all_provider_exceptions) { | 459 for (auto& one_provider_exceptions : all_provider_exceptions) { |
459 for (auto& exception : one_provider_exceptions) | 460 for (auto& exception : one_provider_exceptions) |
460 exceptions->Append(std::move(exception)); | 461 exceptions->Append(std::move(exception)); |
461 } | 462 } |
462 } | 463 } |
463 | 464 |
464 } // namespace site_settings | 465 } // namespace site_settings |
OLD | NEW |