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

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

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

Powered by Google App Engine
This is Rietveld 408576698