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

Side by Side Diff: chrome/browser/ui/webui/site_settings_helper.cc

Issue 2938163002: Store base::Value in ContentSettingPatternSource instead of an enum (Closed)
Patch Set: ps Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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_utils.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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 // Off-the-record HostContentSettingsMap contains incognito content settings 196 // Off-the-record HostContentSettingsMap contains incognito content settings
196 // as well as normal content settings. Here, we use the incongnito settings 197 // as well as normal content settings. Here, we use the incongnito settings
197 // only. 198 // only.
198 if (map->is_incognito() && !i->incognito) 199 if (map->is_incognito() && !i->incognito)
199 continue; 200 continue;
200 201
201 if (filter && i->primary_pattern.ToString() != *filter) 202 if (filter && i->primary_pattern.ToString() != *filter)
202 continue; 203 continue;
203 204
204 all_patterns_settings[std::make_pair(i->primary_pattern, i->source)] 205 all_patterns_settings[std::make_pair(i->primary_pattern,
205 [i->secondary_pattern] = i->setting; 206 i->source)][i->secondary_pattern] =
207 content_settings::ValueToContentSetting(i->setting_value.get());
206 } 208 }
207 209
208 // 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
209 // precedence order. 211 // precedence order.
210 std::vector<std::unique_ptr<base::DictionaryValue>> 212 std::vector<std::unique_ptr<base::DictionaryValue>>
211 all_provider_exceptions[HostContentSettingsMap::NUM_PROVIDER_TYPES]; 213 all_provider_exceptions[HostContentSettingsMap::NUM_PROVIDER_TYPES];
212 214
213 // |all_patterns_settings| is sorted from the lowest precedence pattern to 215 // |all_patterns_settings| is sorted from the lowest precedence pattern to
214 // the highest (see operator< in ContentSettingsPattern), so traverse it in 216 // the highest (see operator< in ContentSettingsPattern), so traverse it in
215 // 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
454 } 456 }
455 } 457 }
456 458
457 for (auto& one_provider_exceptions : all_provider_exceptions) { 459 for (auto& one_provider_exceptions : all_provider_exceptions) {
458 for (auto& exception : one_provider_exceptions) 460 for (auto& exception : one_provider_exceptions)
459 exceptions->Append(std::move(exception)); 461 exceptions->Append(std::move(exception));
460 } 462 }
461 } 463 }
462 464
463 } // namespace site_settings 465 } // namespace site_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698