OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_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 "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 12 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
12 #include "chrome/browser/prefs/pref_change_registrar.h" | 13 #include "chrome/browser/prefs/pref_change_registrar.h" |
13 #include "chrome/browser/prefs/pref_member.h" | 14 #include "chrome/browser/prefs/pref_member.h" |
14 #include "chrome/browser/search_engines/template_url_service_observer.h" | 15 #include "chrome/browser/search_engines/template_url_service_observer.h" |
15 #include "chrome/browser/shell_integration.h" | 16 #include "chrome/browser/shell_integration.h" |
16 #include "chrome/browser/ui/webui/options/options_ui.h" | 17 #include "chrome/browser/ui/webui/options/options_ui.h" |
17 #include "ui/base/models/table_model_observer.h" | 18 #include "ui/base/models/table_model_observer.h" |
18 | 19 |
19 class AutocompleteController; | 20 class AutocompleteController; |
20 class CustomHomePagesTableModel; | 21 class CustomHomePagesTableModel; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void DragDropStartupPage(const ListValue* args); | 83 void DragDropStartupPage(const ListValue* args); |
83 | 84 |
84 // Gets autocomplete suggestions asychronously for the given string. | 85 // Gets autocomplete suggestions asychronously for the given string. |
85 // Called from WebUI. | 86 // Called from WebUI. |
86 void RequestAutocompleteSuggestions(const ListValue* args); | 87 void RequestAutocompleteSuggestions(const ListValue* args); |
87 | 88 |
88 // Enables/disables Instant. | 89 // Enables/disables Instant. |
89 void EnableInstant(const ListValue* args); | 90 void EnableInstant(const ListValue* args); |
90 void DisableInstant(const ListValue* args); | 91 void DisableInstant(const ListValue* args); |
91 | 92 |
| 93 // Enables/disables auto-launching of Chrome on computer startup. |
| 94 void ToggleAutoLaunch(const ListValue* args); |
| 95 |
| 96 // Checks (on the file thread) whether the user is in the auto-launch trial |
| 97 // and whether Chrome is set to auto-launch at login. Gets a reply on the UI |
| 98 // thread (see CheckAutoLaunchCallback). A weak pointer to this is passed in |
| 99 // as a parameter to avoid the need to lock between this function and the |
| 100 // destructor. |
| 101 |
| 102 void CheckAutoLaunch(base::WeakPtr<BrowserOptionsHandler> weak_this); |
| 103 // Sets up (on the UI thread) the necessary bindings for toggling auto-launch |
| 104 // (if the user is part of the auto-launch and makes sure the HTML UI knows |
| 105 // whether Chrome will auto-launch at login. |
| 106 void CheckAutoLaunchCallback(bool is_in_auto_launch_group, |
| 107 bool will_launch_at_login); |
| 108 |
92 // Called to request information about the Instant field trial. | 109 // Called to request information about the Instant field trial. |
93 void GetInstantFieldTrialStatus(const ListValue* args); | 110 void GetInstantFieldTrialStatus(const ListValue* args); |
94 | 111 |
95 // Returns the string ID for the given default browser state. | 112 // Returns the string ID for the given default browser state. |
96 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); | 113 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); |
97 | 114 |
98 // Gets the current default browser state, and asynchronously reports it to | 115 // Gets the current default browser state, and asynchronously reports it to |
99 // the WebUI page. | 116 // the WebUI page. |
100 void UpdateDefaultBrowserState(); | 117 void UpdateDefaultBrowserState(); |
101 | 118 |
(...skipping 21 matching lines...) Expand all Loading... |
123 | 140 |
124 TemplateURLService* template_url_service_; // Weak. | 141 TemplateURLService* template_url_service_; // Weak. |
125 | 142 |
126 // TODO(stuartmorgan): Once there are no other clients of | 143 // TODO(stuartmorgan): Once there are no other clients of |
127 // CustomHomePagesTableModel, consider changing it to something more like | 144 // CustomHomePagesTableModel, consider changing it to something more like |
128 // TemplateURLService. | 145 // TemplateURLService. |
129 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; | 146 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; |
130 | 147 |
131 scoped_ptr<AutocompleteController> autocomplete_controller_; | 148 scoped_ptr<AutocompleteController> autocomplete_controller_; |
132 | 149 |
| 150 // Used to get |weak_ptr_| to self for use on the File thread. |
| 151 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_file_; |
| 152 // Used to post update tasks to the UI thread. |
| 153 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_ui_; |
| 154 |
133 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); | 155 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); |
134 }; | 156 }; |
135 | 157 |
136 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ | 158 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ |
OLD | NEW |