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

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

Issue 10698140: Remove "2" suffixes from options2 code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/prefs/pref_member.h"
13 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h"
14 #include "chrome/browser/search_engines/template_url_service_observer.h"
15 #include "chrome/browser/shell_integration.h"
16 #include "chrome/browser/sync/profile_sync_service_observer.h"
17 #include "chrome/browser/ui/select_file_dialog.h"
18 #include "chrome/browser/ui/webui/options2/options_ui2.h"
19 #include "ui/base/models/table_model_observer.h"
20
21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/system/pointer_device_observer.h"
23 #else
24 #include "chrome/browser/prefs/pref_set_observer.h"
25 #endif // defined(OS_CHROMEOS)
26
27 class AutocompleteController;
28 class CloudPrintSetupHandler;
29 class CustomHomePagesTableModel;
30 class TemplateURLService;
31
32 namespace options2 {
33
34 // Chrome browser options page UI handler.
35 class BrowserOptionsHandler
36 : public OptionsPageUIHandler,
37 public CloudPrintSetupHandlerDelegate,
38 public ProfileSyncServiceObserver,
39 public SelectFileDialog::Listener,
40 public ShellIntegration::DefaultWebClientObserver,
41 #if defined(OS_CHROMEOS)
42 public chromeos::system::PointerDeviceObserver::Observer,
43 #endif
44 public TemplateURLServiceObserver {
45 public:
46 BrowserOptionsHandler();
47 virtual ~BrowserOptionsHandler();
48
49 // OptionsPageUIHandler implementation.
50 virtual void GetLocalizedValues(DictionaryValue* values) OVERRIDE;
51 virtual void InitializeHandler() OVERRIDE;
52 virtual void InitializePage() OVERRIDE;
53 virtual void RegisterMessages() OVERRIDE;
54
55 // ProfileSyncServiceObserver implementation.
56 virtual void OnStateChanged() OVERRIDE;
57
58 // ShellIntegration::DefaultWebClientObserver implementation.
59 virtual void SetDefaultWebClientUIState(
60 ShellIntegration::DefaultWebClientUIState state) OVERRIDE;
61 virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE;
62
63 // TemplateURLServiceObserver implementation.
64 virtual void OnTemplateURLServiceChanged() OVERRIDE;
65
66 private:
67 // content::NotificationObserver implementation.
68 virtual void Observe(int type,
69 const content::NotificationSource& source,
70 const content::NotificationDetails& details) OVERRIDE;
71
72 // SelectFileDialog::Listener implementation
73 virtual void FileSelected(const FilePath& path,
74 int index,
75 void* params) OVERRIDE;
76
77 // CloudPrintSetupHandler::Delegate implementation.
78 virtual void OnCloudPrintSetupClosed() OVERRIDE;
79
80 #if defined(OS_CHROMEOS)
81 // PointerDeviceObserver::Observer implementation.
82 virtual void TouchpadExists(bool exists) OVERRIDE;
83 virtual void MouseExists(bool exists) OVERRIDE;
84 #endif
85
86 // Makes this the default browser. Called from WebUI.
87 void BecomeDefaultBrowser(const base::ListValue* args);
88
89 // Sets the search engine at the given index to be default. Called from WebUI.
90 void SetDefaultSearchEngine(const base::ListValue* args);
91
92 // Enables/disables Instant.
93 void EnableInstant(const base::ListValue* args);
94 void DisableInstant(const base::ListValue* args);
95
96 // Enables/disables auto-launching of Chrome on computer startup.
97 void ToggleAutoLaunch(const base::ListValue* args);
98
99 // Checks (on the file thread) whether the user is in the auto-launch trial
100 // and whether Chrome is set to auto-launch at login. Gets a reply on the UI
101 // thread (see CheckAutoLaunchCallback). A weak pointer to this is passed in
102 // as a parameter to avoid the need to lock between this function and the
103 // destructor. |profile_path| is the full path to the current profile.
104 void CheckAutoLaunch(base::WeakPtr<BrowserOptionsHandler> weak_this,
105 const FilePath& profile_path);
106
107 // Sets up (on the UI thread) the necessary bindings for toggling auto-launch
108 // (if the user is part of the auto-launch and makes sure the HTML UI knows
109 // whether Chrome will auto-launch at login.
110 void CheckAutoLaunchCallback(bool is_in_auto_launch_group,
111 bool will_launch_at_login);
112
113 // Returns the string ID for the given default browser state.
114 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state);
115
116 // Gets the current default browser state, and asynchronously reports it to
117 // the WebUI page.
118 void UpdateDefaultBrowserState();
119
120 // Updates the UI with the given state for the default browser.
121 void SetDefaultBrowserUIString(int status_string_id);
122
123 // Loads the possible default search engine list and reports it to the WebUI.
124 void AddTemplateUrlServiceObserver();
125
126 // Creates a list of dictionaries where each dictionary is of the form:
127 // profileInfo = {
128 // name: "Profile Name",
129 // iconURL: "chrome://path/to/icon/image",
130 // filePath: "/path/to/profile/data/on/disk",
131 // isCurrentProfile: false
132 // };
133 scoped_ptr<ListValue> GetProfilesInfoList();
134
135 // Sends an array of Profile objects to javascript.
136 void SendProfilesInfo();
137
138 // Asynchronously opens a new browser window to create a new profile.
139 void CreateProfile(const base::ListValue* args);
140
141 // Generates a DictionaryValue object that represents a new profile's
142 // name and icon.
143 // |args| is not used.
144 void CreateProfileInfo(const base::ListValue* args);
145
146 void ObserveThemeChanged();
147 void ThemesReset(const base::ListValue* args);
148 #if defined(TOOLKIT_GTK)
149 void ThemesSetGTK(const base::ListValue* args);
150 #endif
151
152 #if defined(OS_CHROMEOS)
153 void UpdateAccountPicture();
154 #endif
155
156 // Callback for the "selectDownloadLocation" message. This will prompt the
157 // user for a destination folder using platform-specific APIs.
158 void HandleSelectDownloadLocation(const ListValue* args);
159
160 // Callback for the "autoOpenFileTypesResetToDefault" message. This will
161 // remove all auto-open file-type settings.
162 void HandleAutoOpenButton(const ListValue* args);
163
164 // Callback for the "metricsReportingCheckboxAction" message. This is called
165 // if the user toggles the metrics reporting checkbox.
166 void HandleMetricsReportingCheckbox(const ListValue* args);
167
168 // Callback for the "defaultFontSizeAction" message. This is called if the
169 // user changes the default font size. |args| is an array that contains
170 // one item, the font size as a numeric value.
171 void HandleDefaultFontSize(const ListValue* args);
172
173 // Callback for the "defaultZoomFactorAction" message. This is called if the
174 // user changes the default zoom factor. |args| is an array that contains
175 // one item, the zoom factor as a numeric value.
176 void HandleDefaultZoomFactor(const ListValue* args);
177
178 // Callback for the "Check for server certificate revocation" checkbox. This
179 // is called if the user toggles the "Check for server certificate revocation"
180 // checkbox.
181 void HandleCheckRevocationCheckbox(const ListValue* args);
182
183 // Callback for the "Use SSL 3.0" checkbox. This is called if the user toggles
184 // the "Use SSL 3.0" checkbox.
185 void HandleUseSSL3Checkbox(const ListValue* args);
186
187 // Callback for the "Use TLS 1.0" checkbox. This is called if the user toggles
188 // the "Use TLS 1.0" checkbox.
189 void HandleUseTLS1Checkbox(const ListValue* args);
190
191 #if !defined(OS_CHROMEOS)
192 // Callback for the "showNetworkProxySettings" message. This will invoke
193 // an appropriate dialog for configuring proxy settings.
194 void ShowNetworkProxySettings(const ListValue* args);
195 #endif
196
197 #if !defined(USE_NSS)
198 // Callback for the "showManageSSLCertificates" message. This will invoke
199 // an appropriate certificate management action based on the platform.
200 void ShowManageSSLCertificates(const ListValue* args);
201 #endif
202
203 // Callback for the Cloud Print manage button. This will open a new
204 // tab pointed at the management URL.
205 void ShowCloudPrintManagePage(const ListValue* args);
206
207 // Register localized values used by Cloud Print
208 void RegisterCloudPrintValues(DictionaryValue* values);
209
210 #if !defined(OS_CHROMEOS)
211 // Callback for the Sign in to Cloud Print button. This will start
212 // the authentication process.
213 void ShowCloudPrintSetupDialog(const ListValue* args);
214
215 // Callback for the Disable Cloud Print button. This will sign out
216 // of cloud print.
217 void HandleDisableCloudPrintConnector(const ListValue* args);
218
219 // Pings the service to send us it's current notion of the enabled state.
220 void RefreshCloudPrintStatusFromService();
221
222 // Setup the enabled or disabled state of the cloud print connector
223 // management UI.
224 void SetupCloudPrintConnectorSection();
225
226 // Remove cloud print connector section if cloud print connector management
227 // UI is disabled.
228 void RemoveCloudPrintConnectorSection();
229 #endif
230
231 #if defined(OS_CHROMEOS)
232 // Called when the accessibility checkbox values are changed.
233 // |args| will contain the checkbox checked state as a string
234 // ("true" or "false").
235 void SpokenFeedbackChangeCallback(const base::ListValue* args);
236 void HighContrastChangeCallback(const base::ListValue* args);
237 void ScreenMagnifierChangeCallback(const base::ListValue* args);
238 void VirtualKeyboardChangeCallback(const base::ListValue* args);
239 #endif
240
241 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
242 // Sets up the checked state for the "Continue running background apps..."
243 // checkbox.
244 void SetupBackgroundModeSettings();
245
246 // Callback for the "Continue running background apps..." checkbox.
247 void HandleBackgroundModeCheckbox(const ListValue* args);
248 #endif
249
250 // Setup the checked state for the metrics reporting checkbox.
251 void SetupMetricsReportingCheckbox();
252
253 // Setup the visibility for the metrics reporting setting.
254 void SetupMetricsReportingSettingVisibility();
255
256 // Setup the visibility for the password generation setting.
257 void SetupPasswordGenerationSettingVisibility();
258
259 // Setup the font size selector control.
260 void SetupFontSizeSelector();
261
262 // Setup the page zoom selector control.
263 void SetupPageZoomSelector();
264
265 // Setup the visibility of the reset button.
266 void SetupAutoOpenFileTypes();
267
268 // Setup the proxy settings section UI.
269 void SetupProxySettingsSection();
270
271 // Setup the checked state for SSL related checkboxes.
272 void SetupSSLConfigSettings();
273
274 #if defined(OS_CHROMEOS)
275 // Setup the accessibility features for ChromeOS.
276 void SetupAccessibilityFeatures();
277 #endif
278
279 // Returns a newly created dictionary with a number of properties that
280 // correspond to the status of sync.
281 scoped_ptr<DictionaryValue> GetSyncStateDictionary();
282
283 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
284
285 StringPrefMember homepage_;
286 BooleanPrefMember default_browser_policy_;
287
288 TemplateURLService* template_url_service_; // Weak.
289
290 // Used to get |weak_ptr_| to self for use on the File thread.
291 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_file_;
292 // Used to post update tasks to the UI thread.
293 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_ui_;
294
295 // True if the multiprofiles switch is enabled.
296 bool multiprofile_;
297
298 scoped_refptr<SelectFileDialog> select_folder_dialog_;
299
300 #if !defined(OS_CHROMEOS)
301 BooleanPrefMember enable_metrics_recording_;
302 StringPrefMember cloud_print_connector_email_;
303 BooleanPrefMember cloud_print_connector_enabled_;
304 bool cloud_print_connector_ui_enabled_;
305 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_;
306 #endif
307
308 // SSLConfigService prefs.
309 BooleanPrefMember rev_checking_enabled_;
310
311 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
312 BooleanPrefMember background_mode_enabled_;
313 #endif
314
315 StringPrefMember auto_open_files_;
316 IntegerPrefMember default_font_size_;
317 DoublePrefMember default_zoom_level_;
318
319 #if !defined(OS_CHROMEOS)
320 scoped_ptr<PrefSetObserver> proxy_prefs_;
321 #endif // !defined(OS_CHROMEOS)
322
323 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler);
324 };
325
326 } // namespace options2
327
328 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698