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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.h

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_
7 #pragma once
8
9 #include "chrome/browser/plugin_data_remover_helper.h"
10 #include "chrome/browser/prefs/pref_change_registrar.h"
11 #include "chrome/browser/ui/webui/options/options_ui.h"
12 #include "chrome/common/content_settings_types.h"
13 #include "chrome/common/content_settings.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16
17 class HostContentSettingsMap;
18 class ProtocolHandlerRegistry;
19
20 class ContentSettingsHandler : public OptionsPageUIHandler {
21 public:
22 ContentSettingsHandler();
23 virtual ~ContentSettingsHandler();
24
25 // OptionsPageUIHandler implementation.
26 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE;
27
28 virtual void InitializeHandler() OVERRIDE;
29
30 virtual void RegisterMessages() OVERRIDE;
31
32 // content::NotificationObserver implementation.
33 virtual void Observe(int type,
34 const content::NotificationSource& source,
35 const content::NotificationDetails& details) OVERRIDE;
36
37 // Gets a string identifier for the group name, for use in HTML.
38 static std::string ContentSettingsTypeToGroupName(ContentSettingsType type);
39
40 private:
41 // Functions that call into the page -----------------------------------------
42
43 // Updates the page with the default settings (allow, ask, block, etc.)
44 void UpdateSettingDefaultFromModel(ContentSettingsType type);
45
46 // Clobbers and rebuilds the specific content setting type exceptions table.
47 void UpdateExceptionsViewFromModel(ContentSettingsType type);
48 // Clobbers and rebuilds the specific content setting type exceptions
49 // OTR table.
50 void UpdateOTRExceptionsViewFromModel(ContentSettingsType type);
51 // Clobbers and rebuilds all the exceptions tables in the page (both normal
52 // and OTR tables).
53 void UpdateAllExceptionsViewsFromModel();
54 // As above, but only OTR tables.
55 void UpdateAllOTRExceptionsViewsFromModel();
56 // Clobbers and rebuilds just the geolocation exception table.
57 void UpdateGeolocationExceptionsView();
58 // Clobbers and rebuilds just the desktop notification exception table.
59 void UpdateNotificationExceptionsView();
60 // Clobbers and rebuilds an exception table that's managed by the host content
61 // settings map.
62 void UpdateExceptionsViewFromHostContentSettingsMap(ContentSettingsType type);
63 // As above, but acts on the OTR table for the content setting type.
64 void UpdateExceptionsViewFromOTRHostContentSettingsMap(
65 ContentSettingsType type);
66 // Updates the radio buttons for enabling / disabling handlers.
67 void UpdateHandlersEnabledRadios();
68
69 // Callbacks used by the page ------------------------------------------------
70
71 // Sets the default value for a specific content type. |args| includes the
72 // content type and a string describing the new default the user has
73 // chosen.
74 void SetContentFilter(const ListValue* args);
75
76 // Removes the given row from the table. The first entry in |args| is the
77 // content type, and the rest of the arguments depend on the content type
78 // to be removed.
79 void RemoveException(const ListValue* args);
80
81 // Changes the value of an exception. Called after the user is done editing an
82 // exception.
83 void SetException(const ListValue* args);
84
85 // Called to decide whether a given pattern is valid, or if it should be
86 // rejected. Called while the user is editing an exception pattern.
87 void CheckExceptionPatternValidity(const ListValue* args);
88
89 // Utility functions ---------------------------------------------------------
90
91 // Applies content settings whitelists to reduce breakage / user confusion.
92 void ApplyWhitelist(ContentSettingsType content_type,
93 ContentSetting default_setting);
94
95 // Gets the HostContentSettingsMap for the normal profile.
96 HostContentSettingsMap* GetContentSettingsMap();
97
98 // Gets the HostContentSettingsMap for the incognito profile, or NULL if there
99 // is no active incognito session.
100 HostContentSettingsMap* GetOTRContentSettingsMap();
101
102 // Gets the default setting in string form. If |provider_id| is not NULL, the
103 // id of the provider which provided the default setting is assigned to it.
104 std::string GetSettingDefaultFromModel(ContentSettingsType type,
105 std::string* provider_id);
106
107 // Gets the ProtocolHandlerRegistry for the normal profile.
108 ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
109
110 // Member variables ---------------------------------------------------------
111
112 content::NotificationRegistrar notification_registrar_;
113 PrefChangeRegistrar pref_change_registrar_;
114
115 DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler);
116 };
117
118 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698