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" |
| 10 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 11 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
10 #include "chrome/browser/prefs/pref_change_registrar.h" | 12 #include "chrome/browser/prefs/pref_change_registrar.h" |
11 #include "chrome/browser/prefs/pref_member.h" | 13 #include "chrome/browser/prefs/pref_member.h" |
12 #include "chrome/browser/search_engines/template_url_service_observer.h" | 14 #include "chrome/browser/search_engines/template_url_service_observer.h" |
13 #include "chrome/browser/shell_integration.h" | 15 #include "chrome/browser/shell_integration.h" |
14 #include "chrome/browser/ui/webui/options/options_ui.h" | 16 #include "chrome/browser/ui/webui/options/options_ui.h" |
15 #include "ui/base/models/table_model_observer.h" | 17 #include "ui/base/models/table_model_observer.h" |
16 | 18 |
17 class AutocompleteController; | 19 class AutocompleteController; |
18 class CustomHomePagesTableModel; | 20 class CustomHomePagesTableModel; |
19 class TemplateURLService; | 21 class TemplateURLService; |
20 | 22 |
21 // Chrome browser options page UI handler. | 23 // Chrome browser options page UI handler. |
22 class BrowserOptionsHandler : public OptionsPageUIHandler, | 24 class BrowserOptionsHandler : public OptionsPageUIHandler, |
23 public AutocompleteControllerDelegate, | 25 public AutocompleteControllerDelegate, |
24 public ShellIntegration::DefaultWebClientObserver, | 26 public ShellIntegration::DefaultWebClientObserver, |
25 public TemplateURLServiceObserver, | 27 public TemplateURLServiceObserver, |
26 public ui::TableModelObserver { | 28 public ui::TableModelObserver { |
27 public: | 29 public: |
28 BrowserOptionsHandler(); | 30 BrowserOptionsHandler(); |
29 virtual ~BrowserOptionsHandler(); | 31 virtual ~BrowserOptionsHandler(); |
30 | 32 |
31 virtual void Initialize(); | 33 virtual void Initialize(); |
32 | 34 |
33 // OptionsPageUIHandler implementation. | 35 // OptionsPageUIHandler implementation. |
34 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 36 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
35 virtual void RegisterMessages(); | 37 virtual void RegisterMessages() OVERRIDE; |
36 | 38 |
37 // AutocompleteControllerDelegate implementation. | 39 // AutocompleteControllerDelegate implementation. |
38 virtual void OnResultChanged(bool default_match_changed); | 40 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; |
39 | 41 |
40 // ShellIntegration::DefaultWebClientObserver implementation. | 42 // ShellIntegration::DefaultWebClientObserver implementation. |
41 virtual void SetDefaultWebClientUIState( | 43 virtual void SetDefaultWebClientUIState( |
42 ShellIntegration::DefaultWebClientUIState state); | 44 ShellIntegration::DefaultWebClientUIState state) OVERRIDE; |
43 | 45 |
44 // TemplateURLServiceObserver implementation. | 46 // TemplateURLServiceObserver implementation. |
45 virtual void OnTemplateURLServiceChanged(); | 47 virtual void OnTemplateURLServiceChanged() OVERRIDE; |
46 | 48 |
47 // ui::TableModelObserver implementation. | 49 // ui::TableModelObserver implementation. |
48 virtual void OnModelChanged(); | 50 virtual void OnModelChanged() OVERRIDE; |
49 virtual void OnItemsChanged(int start, int length); | 51 virtual void OnItemsChanged(int start, int length) OVERRIDE; |
50 virtual void OnItemsAdded(int start, int length); | 52 virtual void OnItemsAdded(int start, int length) OVERRIDE; |
51 virtual void OnItemsRemoved(int start, int length); | 53 virtual void OnItemsRemoved(int start, int length) OVERRIDE; |
52 | 54 |
53 private: | 55 private: |
54 // NotificationObserver implementation. | 56 // NotificationObserver implementation. |
55 virtual void Observe(int type, | 57 virtual void Observe(int type, |
56 const NotificationSource& source, | 58 const NotificationSource& source, |
57 const NotificationDetails& details); | 59 const NotificationDetails& details) OVERRIDE; |
58 | 60 |
59 // Sets the home page to the given string. Called from WebUI. | 61 // Sets the home page to the given string. Called from WebUI. |
60 void SetHomePage(const ListValue* args); | 62 void SetHomePage(const ListValue* args); |
61 | 63 |
62 // Makes this the default browser. Called from WebUI. | 64 // Makes this the default browser. Called from WebUI. |
63 void BecomeDefaultBrowser(const ListValue* args); | 65 void BecomeDefaultBrowser(const ListValue* args); |
64 | 66 |
65 // Sets the search engine at the given index to be default. Called from WebUI. | 67 // Sets the search engine at the given index to be default. Called from WebUI. |
66 void SetDefaultSearchEngine(const ListValue* args); | 68 void SetDefaultSearchEngine(const ListValue* args); |
67 | 69 |
(...skipping 11 matching lines...) Expand all Loading... |
79 // Sets the startup page set to the current pages. Called from WebUI. | 81 // Sets the startup page set to the current pages. Called from WebUI. |
80 void SetStartupPagesToCurrentPages(const ListValue* args); | 82 void SetStartupPagesToCurrentPages(const ListValue* args); |
81 | 83 |
82 // Writes the current set of startup pages to prefs. Called from WebUI. | 84 // Writes the current set of startup pages to prefs. Called from WebUI. |
83 void DragDropStartupPage(const ListValue* args); | 85 void DragDropStartupPage(const ListValue* args); |
84 | 86 |
85 // Gets autocomplete suggestions asychronously for the given string. | 87 // Gets autocomplete suggestions asychronously for the given string. |
86 // Called from WebUI. | 88 // Called from WebUI. |
87 void RequestAutocompleteSuggestions(const ListValue* args); | 89 void RequestAutocompleteSuggestions(const ListValue* args); |
88 | 90 |
89 // Called when the 'Always show the bookmarks bar' checkbox is toggled. | |
90 // Notifies any listeners interested in this event. |args| is ignored. | |
91 void ToggleShowBookmarksBar(const ListValue* args); | |
92 | |
93 // Enables/disables Instant. | 91 // Enables/disables Instant. |
94 void EnableInstant(const ListValue* args); | 92 void EnableInstant(const ListValue* args); |
95 void DisableInstant(const ListValue* args); | 93 void DisableInstant(const ListValue* args); |
96 | 94 |
97 // Called to request information about the Instant field trial. | 95 // Called to request information about the Instant field trial. |
98 void GetInstantFieldTrialStatus(const ListValue* args); | 96 void GetInstantFieldTrialStatus(const ListValue* args); |
99 | 97 |
100 // Returns the string ID for the given default browser state. | 98 // Returns the string ID for the given default browser state. |
101 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); | 99 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); |
102 | 100 |
(...skipping 29 matching lines...) Expand all Loading... |
132 // CustomHomePagesTableModel, consider changing it to something more like | 130 // CustomHomePagesTableModel, consider changing it to something more like |
133 // TemplateURLService. | 131 // TemplateURLService. |
134 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; | 132 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; |
135 | 133 |
136 scoped_ptr<AutocompleteController> autocomplete_controller_; | 134 scoped_ptr<AutocompleteController> autocomplete_controller_; |
137 | 135 |
138 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); | 136 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); |
139 }; | 137 }; |
140 | 138 |
141 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ | 139 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ |
OLD | NEW |