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 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
13 #include "chrome/browser/storage/storage_info_fetcher.h" | 13 #include "chrome/browser/storage/storage_info_fetcher.h" |
14 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 14 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 15 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
15 #include "components/content_settings/core/browser/content_settings_observer.h" | 16 #include "components/content_settings/core/browser/content_settings_observer.h" |
16 #include "content/public/browser/host_zoom_map.h" | 17 #include "content/public/browser/host_zoom_map.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 | 20 |
20 class HostContentSettingsMap; | 21 class HostContentSettingsMap; |
21 class Profile; | 22 class Profile; |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class ListValue; | 25 class ListValue; |
(...skipping 22 matching lines...) Expand all Loading... |
47 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, | 48 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, |
48 const ContentSettingsPattern& secondary_pattern, | 49 const ContentSettingsPattern& secondary_pattern, |
49 ContentSettingsType content_type, | 50 ContentSettingsType content_type, |
50 std::string resource_identifier) override; | 51 std::string resource_identifier) override; |
51 | 52 |
52 // content::NotificationObserver: | 53 // content::NotificationObserver: |
53 void Observe(int type, | 54 void Observe(int type, |
54 const content::NotificationSource& source, | 55 const content::NotificationSource& source, |
55 const content::NotificationDetails& details) override; | 56 const content::NotificationDetails& details) override; |
56 | 57 |
| 58 // ChromeZoomLevelPrefs::DefaultZoomScopeSubscription subscription. |
| 59 void OnZoomScopeChanged(); |
57 // content::HostZoomMap subscription. | 60 // content::HostZoomMap subscription. |
58 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | 61 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
59 | 62 |
60 private: | 63 private: |
61 friend class SiteSettingsHandlerTest; | 64 friend class SiteSettingsHandlerTest; |
62 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, GetAndSetDefault); | 65 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, GetAndSetDefault); |
63 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Origins); | 66 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Origins); |
64 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ExceptionHelpers); | 67 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ExceptionHelpers); |
65 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Patterns); | 68 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Patterns); |
66 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Incognito); | 69 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Incognito); |
67 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ZoomLevels); | 70 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ZoomLevels); |
| 71 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ZoomScope); |
68 | 72 |
69 // Asynchronously fetches the usage for a given origin. Replies back with | 73 // Asynchronously fetches the usage for a given origin. Replies back with |
70 // OnGetUsageInfo above. | 74 // OnGetUsageInfo above. |
71 void HandleFetchUsageTotal(const base::ListValue* args); | 75 void HandleFetchUsageTotal(const base::ListValue* args); |
72 | 76 |
73 // Deletes the storage being used for a given host. | 77 // Deletes the storage being used for a given host. |
74 void HandleClearUsage(const base::ListValue* args); | 78 void HandleClearUsage(const base::ListValue* args); |
75 | 79 |
76 // Handles the request for a list of all USB devices. | 80 // Handles the request for a list of all USB devices. |
77 void HandleFetchUsbDevices(const base::ListValue* args); | 81 void HandleFetchUsbDevices(const base::ListValue* args); |
(...skipping 17 matching lines...) Expand all Loading... |
95 | 99 |
96 // Returns whether a given pattern is valid. | 100 // Returns whether a given pattern is valid. |
97 void HandleIsPatternValid(const base::ListValue* args); | 101 void HandleIsPatternValid(const base::ListValue* args); |
98 | 102 |
99 // Looks up whether an incognito session is active. | 103 // Looks up whether an incognito session is active. |
100 void HandleUpdateIncognitoStatus(const base::ListValue* args); | 104 void HandleUpdateIncognitoStatus(const base::ListValue* args); |
101 | 105 |
102 // Notifies the JS side whether incognito is enabled. | 106 // Notifies the JS side whether incognito is enabled. |
103 void SendIncognitoStatus(Profile* profile, bool was_destroyed); | 107 void SendIncognitoStatus(Profile* profile, bool was_destroyed); |
104 | 108 |
| 109 // Handles the request for the default zoom scope. |
| 110 void HandleFetchZoomScope(const base::ListValue* args); |
| 111 |
| 112 // Sends the default zoom scope down to the web ui. |
| 113 void SendZoomScope(); |
| 114 |
105 // Handles the request for a list of all zoom levels. | 115 // Handles the request for a list of all zoom levels. |
106 void HandleFetchZoomLevels(const base::ListValue* args); | 116 void HandleFetchZoomLevels(const base::ListValue* args); |
107 | 117 |
108 // Sends the zoom level list down to the web ui. | 118 // Sends the zoom level list down to the web ui. |
109 void SendZoomLevels(); | 119 void SendZoomLevels(); |
110 | 120 |
| 121 // Sets the default zoom scope. |
| 122 void HandleSetZoomScopeIsPerOrigin(const base::ListValue* args); |
| 123 |
111 // Removes a particular zoom level for a given host. | 124 // Removes a particular zoom level for a given host. |
112 void HandleRemoveZoomLevel(const base::ListValue* args); | 125 void HandleRemoveZoomLevel(const base::ListValue* args); |
113 | 126 |
114 Profile* profile_; | 127 Profile* profile_; |
115 | 128 |
116 content::NotificationRegistrar notification_registrar_; | 129 content::NotificationRegistrar notification_registrar_; |
117 | 130 |
| 131 // Keeps track of the default zoom scope. |
| 132 std::unique_ptr<ChromeZoomLevelPrefs::DefaultZoomScopeSubscription> |
| 133 default_zoom_scope_subscription_; |
118 // Keeps track of events related to zooming. | 134 // Keeps track of events related to zooming. |
119 std::unique_ptr<content::HostZoomMap::Subscription> | 135 std::unique_ptr<content::HostZoomMap::Subscription> |
120 host_zoom_map_subscription_; | 136 host_zoom_map_subscription_; |
121 | 137 |
122 // The host for which to fetch usage. | 138 // The host for which to fetch usage. |
123 std::string usage_host_; | 139 std::string usage_host_; |
124 | 140 |
125 // The origin for which to clear usage. | 141 // The origin for which to clear usage. |
126 std::string clearing_origin_; | 142 std::string clearing_origin_; |
127 | 143 |
128 // Change observer for content settings. | 144 // Change observer for content settings. |
129 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 145 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
130 | 146 |
131 DISALLOW_COPY_AND_ASSIGN(SiteSettingsHandler); | 147 DISALLOW_COPY_AND_ASSIGN(SiteSettingsHandler); |
132 }; | 148 }; |
133 | 149 |
134 } // namespace settings | 150 } // namespace settings |
135 | 151 |
136 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ | 152 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ |
OLD | NEW |