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

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

Issue 2525943002: Display content settings for extensions with extension name. (Closed)
Patch Set: fix missing . Created 4 years 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 #include "extensions/common/extension.h"
19 19
20 class ChooserContextBase; 20 class ChooserContextBase;
21 class HostContentSettingsMap; 21 class HostContentSettingsMap;
22 class Profile; 22 class Profile;
23 23
24 namespace base { 24 namespace base {
25 class DictionaryValue; 25 class DictionaryValue;
26 class ListValue; 26 class ListValue;
27 } 27 }
28 28
29 namespace extensions {
30 class ExtensionRegistry;
31 }
32
29 namespace site_settings { 33 namespace site_settings {
30 34
31 // Maps from a secondary pattern to a setting. 35 // Maps from a secondary pattern to a setting.
32 typedef std::map<ContentSettingsPattern, ContentSetting> 36 typedef std::map<ContentSettingsPattern, ContentSetting>
33 OnePatternSettings; 37 OnePatternSettings;
34 // Maps from a primary pattern/source pair to a OnePatternSettings. All the 38 // Maps from a primary pattern/source pair to a OnePatternSettings. All the
35 // mappings in OnePatternSettings share the given primary pattern and source. 39 // mappings in OnePatternSettings share the given primary pattern and source.
36 typedef std::map<std::pair<ContentSettingsPattern, std::string>, 40 typedef std::map<std::pair<ContentSettingsPattern, std::string>,
37 OnePatternSettings> 41 OnePatternSettings>
38 AllPatternsSettings; 42 AllPatternsSettings;
39 43
40 extern const char kSetting[]; 44 extern const char kSetting[];
41 extern const char kOrigin[]; 45 extern const char kOrigin[];
46 extern const char kDisplayName[];
47 extern const char kOriginForFavicon[];
42 extern const char kPolicyProviderId[]; 48 extern const char kPolicyProviderId[];
43 extern const char kSource[]; 49 extern const char kSource[];
44 extern const char kIncognito[]; 50 extern const char kIncognito[];
45 extern const char kEmbeddingOrigin[]; 51 extern const char kEmbeddingOrigin[];
46 extern const char kPreferencesSource[]; 52 extern const char kPreferencesSource[];
47 53
48 // Group types. 54 // Group types.
49 extern const char kGroupTypeUsb[]; 55 extern const char kGroupTypeUsb[];
50 56
51 // Returns whether a group name has been registered for the given type. 57 // Returns whether a group name has been registered for the given type.
52 bool HasRegisteredGroupName(ContentSettingsType type); 58 bool HasRegisteredGroupName(ContentSettingsType type);
53 59
54 // Gets a content settings type from the group name identifier. 60 // Gets a content settings type from the group name identifier.
55 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name); 61 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name);
56 62
57 // Gets a string identifier for the group name. 63 // Gets a string identifier for the group name.
58 std::string ContentSettingsTypeToGroupName(ContentSettingsType type); 64 std::string ContentSettingsTypeToGroupName(ContentSettingsType type);
59 65
60 // Helper function to construct a dictonary for an exception. 66 // Helper function to construct a dictonary for an exception.
61 std::unique_ptr<base::DictionaryValue> GetExceptionForPage( 67 std::unique_ptr<base::DictionaryValue> GetExceptionForPage(
62 const ContentSettingsPattern& pattern, 68 const ContentSettingsPattern& pattern,
63 const ContentSettingsPattern& secondary_pattern, 69 const ContentSettingsPattern& secondary_pattern,
70 const std::string& display_name,
64 const ContentSetting& setting, 71 const ContentSetting& setting,
65 const std::string& provider_name, 72 const std::string& provider_name,
66 bool incognito); 73 bool incognito);
67 74
68 // Helper function to construct a dictonary for a hosted app exception. 75 // Helper function to construct a dictonary for a hosted app exception.
69 void AddExceptionForHostedApp(const std::string& url_pattern, 76 void AddExceptionForHostedApp(const std::string& url_pattern,
70 const extensions::Extension& app, base::ListValue* exceptions); 77 const extensions::Extension& app, base::ListValue* exceptions);
71 78
72 // Fills in |exceptions| with Values for the given |type| from |map|. 79 // Fills in |exceptions| with Values for the given |type| from |map|.
73 // If |filter| is not null then only exceptions with matching primary patterns 80 // If |filter| is not null then only exceptions with matching primary patterns
74 // will be returned. 81 // will be returned.
75 void GetExceptionsFromHostContentSettingsMap( 82 void GetExceptionsFromHostContentSettingsMap(
76 const HostContentSettingsMap* map, 83 const HostContentSettingsMap* map,
77 ContentSettingsType type, 84 ContentSettingsType type,
85 const extensions::ExtensionRegistry* extension_registry,
78 content::WebUI* web_ui, 86 content::WebUI* web_ui,
79 bool incognito, 87 bool incognito,
80 const std::string* filter, 88 const std::string* filter,
81 base::ListValue* exceptions); 89 base::ListValue* exceptions);
82 90
83 // Returns exceptions constructed from the policy-set allowed URLs 91 // Returns exceptions constructed from the policy-set allowed URLs
84 // for the content settings |type| mic or camera. 92 // for the content settings |type| mic or camera.
85 void GetPolicyAllowedUrls( 93 void GetPolicyAllowedUrls(
86 ContentSettingsType type, 94 ContentSettingsType type,
87 std::vector<std::unique_ptr<base::DictionaryValue>>* exceptions, 95 std::vector<std::unique_ptr<base::DictionaryValue>>* exceptions,
96 const extensions::ExtensionRegistry* extension_registry,
88 content::WebUI* web_ui, 97 content::WebUI* web_ui,
89 bool incognito); 98 bool incognito);
90 99
91 // This struct facilitates lookup of a chooser context factory function by name 100 // This struct facilitates lookup of a chooser context factory function by name
92 // for a given content settings type and is declared early so that it can used 101 // for a given content settings type and is declared early so that it can used
93 // by functions below. 102 // by functions below.
94 struct ChooserTypeNameEntry { 103 struct ChooserTypeNameEntry {
95 ContentSettingsType type; 104 ContentSettingsType type;
96 ChooserContextBase* (*get_context)(Profile*); 105 ChooserContextBase* (*get_context)(Profile*);
97 const char* name; 106 const char* name;
(...skipping 17 matching lines...) Expand all
115 // Fills in |exceptions| with Values for the given |chooser_type| from map. 124 // Fills in |exceptions| with Values for the given |chooser_type| from map.
116 void GetChooserExceptionsFromProfile( 125 void GetChooserExceptionsFromProfile(
117 Profile* profile, 126 Profile* profile,
118 bool incognito, 127 bool incognito,
119 const ChooserTypeNameEntry& chooser_type, 128 const ChooserTypeNameEntry& chooser_type,
120 base::ListValue* exceptions); 129 base::ListValue* exceptions);
121 130
122 } // namespace site_settings 131 } // namespace site_settings
123 132
124 #endif // CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_ 133 #endif // CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698