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

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

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 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 #ifndef CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "components/content_settings/core/common/content_settings.h" 14 #include "components/content_settings/core/common/content_settings.h"
15 #include "components/content_settings/core/common/content_settings_pattern.h" 15 #include "components/content_settings/core/common/content_settings_pattern.h"
16 #include "components/content_settings/core/common/content_settings_types.h" 16 #include "components/content_settings/core/common/content_settings_types.h"
17 #include "content/public/browser/web_ui.h" 17 #include "content/public/browser/web_ui.h"
18 #include "extensions/common/extension.h"
18 19
19 class ChooserContextBase; 20 class ChooserContextBase;
20 class HostContentSettingsMap; 21 class HostContentSettingsMap;
21 class Profile; 22 class Profile;
22 23
23 namespace base { 24 namespace base {
24 class DictionaryValue; 25 class DictionaryValue;
25 class ListValue; 26 class ListValue;
26 } 27 }
27 28
28 namespace site_settings { 29 namespace site_settings {
29 30
30 // Maps from a secondary pattern to a setting. 31 // Maps from a secondary pattern to a setting.
31 typedef std::map<ContentSettingsPattern, ContentSetting> 32 typedef std::map<ContentSettingsPattern, ContentSetting>
32 OnePatternSettings; 33 OnePatternSettings;
33 // Maps from a primary pattern/source pair to a OnePatternSettings. All the 34 // Maps from a primary pattern/source pair to a OnePatternSettings. All the
34 // mappings in OnePatternSettings share the given primary pattern and source. 35 // mappings in OnePatternSettings share the given primary pattern and source.
35 typedef std::map<std::pair<ContentSettingsPattern, std::string>, 36 typedef std::map<std::pair<ContentSettingsPattern, std::string>,
36 OnePatternSettings> 37 OnePatternSettings>
37 AllPatternsSettings; 38 AllPatternsSettings;
38 39
39 extern const char kSetting[]; 40 extern const char kSetting[];
40 extern const char kOrigin[]; 41 extern const char kOrigin[];
41 extern const char kPolicyProviderId[]; 42 extern const char kPolicyProviderId[];
42 extern const char kSource[]; 43 extern const char kSource[];
44 extern const char kIncognito[];
43 extern const char kEmbeddingOrigin[]; 45 extern const char kEmbeddingOrigin[];
44 extern const char kPreferencesSource[]; 46 extern const char kPreferencesSource[];
45 47
46 // Group types. 48 // Group types.
47 extern const char kGroupTypeUsb[]; 49 extern const char kGroupTypeUsb[];
48 50
49 // Returns whether a group name has been registered for the given type. 51 // Returns whether a group name has been registered for the given type.
50 bool HasRegisteredGroupName(ContentSettingsType type); 52 bool HasRegisteredGroupName(ContentSettingsType type);
51 53
52 // Gets a content settings type from the group name identifier. 54 // Gets a content settings type from the group name identifier.
53 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name); 55 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name);
54 56
55 // Gets a string identifier for the group name. 57 // Gets a string identifier for the group name.
56 std::string ContentSettingsTypeToGroupName(ContentSettingsType type); 58 std::string ContentSettingsTypeToGroupName(ContentSettingsType type);
57 59
60 // Helper function to construct a dictonary for an exception.
61 std::unique_ptr<base::DictionaryValue> GetExceptionForPage(
62 const ContentSettingsPattern& pattern,
63 const ContentSettingsPattern& secondary_pattern,
64 const ContentSetting& setting,
65 const std::string& provider_name,
66 bool incognito);
67
68 // Helper function to construct a dictonary for a hosted app exception.
69 void AddExceptionForHostedApp(const std::string& url_pattern,
70 const extensions::Extension& app, base::ListValue* exceptions);
71
58 // Fills in |exceptions| with Values for the given |type| from |map|. 72 // Fills in |exceptions| with Values for the given |type| from |map|.
59 // If |filter| is not null then only exceptions with matching primary patterns 73 // If |filter| is not null then only exceptions with matching primary patterns
60 // will be returned. 74 // will be returned.
61 void GetExceptionsFromHostContentSettingsMap( 75 void GetExceptionsFromHostContentSettingsMap(
62 const HostContentSettingsMap* map, 76 const HostContentSettingsMap* map,
63 ContentSettingsType type, 77 ContentSettingsType type,
64 content::WebUI* web_ui, 78 content::WebUI* web_ui,
65 bool incognito, 79 bool incognito,
66 const std::string* filter, 80 const std::string* filter,
67 base::ListValue* exceptions); 81 base::ListValue* exceptions);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Fills in |exceptions| with Values for the given |chooser_type| from map. 140 // Fills in |exceptions| with Values for the given |chooser_type| from map.
127 void GetChooserExceptionsFromProfile( 141 void GetChooserExceptionsFromProfile(
128 Profile* profile, 142 Profile* profile,
129 bool incognito, 143 bool incognito,
130 const ChooserTypeNameEntry& chooser_type, 144 const ChooserTypeNameEntry& chooser_type,
131 base::ListValue* exceptions); 145 base::ListValue* exceptions);
132 146
133 } // namespace site_settings 147 } // namespace site_settings
134 148
135 #endif // CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_ 149 #endif // CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc ('k') | chrome/browser/ui/webui/site_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698