OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 12 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
13 #include "chrome/browser/prefs/pref_change_registrar.h" | |
14 #include "chrome/browser/prefs/pref_member.h" | 13 #include "chrome/browser/prefs/pref_member.h" |
15 #include "chrome/browser/search_engines/template_url_service_observer.h" | 14 #include "chrome/browser/search_engines/template_url_service_observer.h" |
16 #include "chrome/browser/shell_integration.h" | 15 #include "chrome/browser/shell_integration.h" |
17 #include "chrome/browser/sync/profile_sync_service_observer.h" | 16 #include "chrome/browser/sync/profile_sync_service_observer.h" |
18 #include "chrome/browser/ui/webui/options2/options_ui2.h" | 17 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
19 #include "ui/base/models/table_model_observer.h" | 18 #include "ui/base/models/table_model_observer.h" |
20 | 19 |
21 class AutocompleteController; | 20 class AutocompleteController; |
22 class CustomHomePagesTableModel; | 21 class CustomHomePagesTableModel; |
23 class TemplateURLService; | 22 class TemplateURLService; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Returns the string ID for the given default browser state. | 95 // Returns the string ID for the given default browser state. |
97 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); | 96 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); |
98 | 97 |
99 // Gets the current default browser state, and asynchronously reports it to | 98 // Gets the current default browser state, and asynchronously reports it to |
100 // the WebUI page. | 99 // the WebUI page. |
101 void UpdateDefaultBrowserState(); | 100 void UpdateDefaultBrowserState(); |
102 | 101 |
103 // Updates the UI with the given state for the default browser. | 102 // Updates the UI with the given state for the default browser. |
104 void SetDefaultBrowserUIString(int status_string_id); | 103 void SetDefaultBrowserUIString(int status_string_id); |
105 | 104 |
106 // Updates the label of the 'Show Home page'. | |
107 void UpdateHomePageLabel() const; | |
108 | |
109 // Loads the possible default search engine list and reports it to the WebUI. | 105 // Loads the possible default search engine list and reports it to the WebUI. |
110 void UpdateSearchEngines(); | 106 void UpdateSearchEngines(); |
111 | 107 |
112 // Sends an array of Profile objects to javascript. | 108 // Sends an array of Profile objects to javascript. |
113 // Each object is of the form: | 109 // Each object is of the form: |
114 // profileInfo = { | 110 // profileInfo = { |
115 // name: "Profile Name", | 111 // name: "Profile Name", |
116 // iconURL: "chrome://path/to/icon/image", | 112 // iconURL: "chrome://path/to/icon/image", |
117 // filePath: "/path/to/profile/data/on/disk", | 113 // filePath: "/path/to/profile/data/on/disk", |
118 // isCurrentProfile: false | 114 // isCurrentProfile: false |
(...skipping 18 matching lines...) Expand all Loading... |
137 void IncreaseScreenBrightnessCallback(const base::ListValue* args); | 133 void IncreaseScreenBrightnessCallback(const base::ListValue* args); |
138 | 134 |
139 void UpdateAccountPicture(); | 135 void UpdateAccountPicture(); |
140 #endif | 136 #endif |
141 | 137 |
142 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; | 138 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; |
143 | 139 |
144 StringPrefMember homepage_; | 140 StringPrefMember homepage_; |
145 BooleanPrefMember default_browser_policy_; | 141 BooleanPrefMember default_browser_policy_; |
146 | 142 |
147 // Used to observe updates to the preference of the list of URLs to load | |
148 // on startup, which can be updated via sync. | |
149 PrefChangeRegistrar pref_change_registrar_; | |
150 | |
151 TemplateURLService* template_url_service_; // Weak. | 143 TemplateURLService* template_url_service_; // Weak. |
152 | 144 |
153 scoped_ptr<AutocompleteController> autocomplete_controller_; | 145 scoped_ptr<AutocompleteController> autocomplete_controller_; |
154 | 146 |
155 // Used to get |weak_ptr_| to self for use on the File thread. | 147 // Used to get |weak_ptr_| to self for use on the File thread. |
156 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_file_; | 148 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_file_; |
157 // Used to post update tasks to the UI thread. | 149 // Used to post update tasks to the UI thread. |
158 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_ui_; | 150 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_ui_; |
159 | 151 |
160 // True if the multiprofiles switch is enabled. | 152 // True if the multiprofiles switch is enabled. |
161 bool multiprofile_; | 153 bool multiprofile_; |
162 | 154 |
163 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); | 155 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); |
164 }; | 156 }; |
165 | 157 |
166 } // namespace options2 | 158 } // namespace options2 |
167 | 159 |
168 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ | 160 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ |
OLD | NEW |