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

Side by Side Diff: chrome/browser/ui/webui/settings/site_settings_handler.h

Issue 2323693002: Site Settings Desktop: Implement Zoom Levels category. (Closed)
Patch Set: 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_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 <vector> 8 #include <vector>
9 9
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
11 #include "chrome/browser/storage/storage_info_fetcher.h" 11 #include "chrome/browser/storage/storage_info_fetcher.h"
12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" 12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
13 #include "components/content_settings/core/browser/content_settings_observer.h" 13 #include "components/content_settings/core/browser/content_settings_observer.h"
14 #include "content/public/browser/host_zoom_map.h"
14 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
16 17
17 class HostContentSettingsMap; 18 class HostContentSettingsMap;
18 class Profile; 19 class Profile;
19 20
20 namespace base { 21 namespace base {
21 class ListValue; 22 class ListValue;
22 } 23 }
23 24
24 namespace settings { 25 namespace settings {
25 26
26 // Chrome "ContentSettings" settings page UI handler. 27 // Chrome "ContentSettings" settings page UI handler.
27 class SiteSettingsHandler : public SettingsPageUIHandler, 28 class SiteSettingsHandler : public SettingsPageUIHandler,
28 public content_settings::Observer, 29 public content_settings::Observer,
29 public content::NotificationObserver { 30 public content::NotificationObserver {
30 public: 31 public:
31 explicit SiteSettingsHandler(Profile* profile); 32 explicit SiteSettingsHandler(Profile* profile);
32 ~SiteSettingsHandler() override; 33 ~SiteSettingsHandler() override;
33 34
34 // SettingsPageUIHandler: 35 // SettingsPageUIHandler:
35 void RegisterMessages() override; 36 void RegisterMessages() override;
36 void OnJavascriptAllowed() override; 37 void OnJavascriptAllowed() override;
37 void OnJavascriptDisallowed() override; 38 void OnJavascriptDisallowed() override;
38 39
39 // Usage info. 40 // Usage info.
40 void OnGetUsageInfo(const storage::UsageInfoEntries& entries); 41 void OnGetUsageInfo(const storage::UsageInfoEntries& entries);
41 void OnUsageInfoCleared(storage::QuotaStatusCode code); 42 void OnUsageInfoCleared(storage::QuotaStatusCode code);
42 43
43 // content_settings::Observer: 44 // content_settings::Observer:
44 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, 45 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
45 const ContentSettingsPattern& secondary_pattern, 46 const ContentSettingsPattern& secondary_pattern,
46 ContentSettingsType content_type, 47 ContentSettingsType content_type,
47 std::string resource_identifier) override; 48 std::string resource_identifier) override;
48 49
49 // content::NotificationObserver: 50 // content::NotificationObserver:
50 void Observe(int type, 51 void Observe(int type,
51 const content::NotificationSource& source, 52 const content::NotificationSource& source,
52 const content::NotificationDetails& details) override; 53 const content::NotificationDetails& details) override;
53 54
55 // content::HostZoomMap subscription.
56 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
57
54 private: 58 private:
55 friend class SiteSettingsHandlerTest; 59 friend class SiteSettingsHandlerTest;
56 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, GetAndSetDefault); 60 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, GetAndSetDefault);
57 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Origins); 61 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Origins);
58 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Patterns); 62 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Patterns);
59 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Incognito); 63 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, Incognito);
64 FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, ZoomLevels);
60 65
61 // Asynchronously fetches the usage for a given origin. Replies back with 66 // Asynchronously fetches the usage for a given origin. Replies back with
62 // OnGetUsageInfo above. 67 // OnGetUsageInfo above.
63 void HandleFetchUsageTotal(const base::ListValue* args); 68 void HandleFetchUsageTotal(const base::ListValue* args);
64 69
65 // Deletes the storage being used for a given host. 70 // Deletes the storage being used for a given host.
66 void HandleClearUsage(const base::ListValue* args); 71 void HandleClearUsage(const base::ListValue* args);
67 72
68 // Handles the request for a list of all USB devices. 73 // Handles the request for a list of all USB devices.
69 void HandleFetchUsbDevices(const base::ListValue* args); 74 void HandleFetchUsbDevices(const base::ListValue* args);
(...skipping 14 matching lines...) Expand all
84 89
85 // Returns whether a given pattern is valid. 90 // Returns whether a given pattern is valid.
86 void HandleIsPatternValid(const base::ListValue* args); 91 void HandleIsPatternValid(const base::ListValue* args);
87 92
88 // Looks up whether an incognito session is active. 93 // Looks up whether an incognito session is active.
89 void HandleUpdateIncognitoStatus(const base::ListValue* args); 94 void HandleUpdateIncognitoStatus(const base::ListValue* args);
90 95
91 // Notifies the JS side whether incognito is enabled. 96 // Notifies the JS side whether incognito is enabled.
92 void SendIncognitoStatus(Profile* profile, bool was_destroyed); 97 void SendIncognitoStatus(Profile* profile, bool was_destroyed);
93 98
99 // Handles the request for a list of all zoom levels.
100 void HandleFetchZoomLevels(const base::ListValue* args);
101
102 // Sends the zoom level list down to the web ui.
103 void SendZoomLevels();
104
105 // Removes a particular zoom level for a given host.
106 void HandleRemoveZoomLevel(const base::ListValue* args);
107
94 Profile* profile_; 108 Profile* profile_;
95 109
96 content::NotificationRegistrar notification_registrar_; 110 content::NotificationRegistrar notification_registrar_;
97 111
112 // Keeps track of events related to zooming.
113 std::unique_ptr<content::HostZoomMap::Subscription>
114 host_zoom_map_subscription_;
115
98 // The host for which to fetch usage. 116 // The host for which to fetch usage.
99 std::string usage_host_; 117 std::string usage_host_;
100 118
101 // The origin for which to clear usage. 119 // The origin for which to clear usage.
102 std::string clearing_origin_; 120 std::string clearing_origin_;
103 121
104 // Change observer for content settings. 122 // Change observer for content settings.
105 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; 123 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_;
106 124
107 DISALLOW_COPY_AND_ASSIGN(SiteSettingsHandler); 125 DISALLOW_COPY_AND_ASSIGN(SiteSettingsHandler);
108 }; 126 };
109 127
110 } // namespace settings 128 } // namespace settings
111 129
112 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_ 130 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SITE_SETTINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698