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 // Makes this the default browser. Called from WebUI. | 61 // Makes this the default browser. Called from WebUI. |
60 void BecomeDefaultBrowser(const ListValue* args); | 62 void BecomeDefaultBrowser(const ListValue* args); |
61 | 63 |
62 // Sets the search engine at the given index to be default. Called from WebUI. | 64 // Sets the search engine at the given index to be default. Called from WebUI. |
63 void SetDefaultSearchEngine(const ListValue* args); | 65 void SetDefaultSearchEngine(const ListValue* args); |
64 | 66 |
65 // Removes the startup page at the given indexes. Called from WebUI. | 67 // Removes the startup page at the given indexes. Called from WebUI. |
66 void RemoveStartupPages(const ListValue* args); | 68 void RemoveStartupPages(const ListValue* args); |
67 | 69 |
68 // Adds a startup page with the given URL after the given index. | 70 // Adds a startup page with the given URL after the given index. |
69 // Called from WebUI. | 71 // Called from WebUI. |
70 void AddStartupPage(const ListValue* args); | 72 void AddStartupPage(const ListValue* args); |
71 | 73 |
72 // Changes the startup page at the given index to the given URL. | 74 // Changes the startup page at the given index to the given URL. |
73 // Called from WebUI. | 75 // Called from WebUI. |
74 void EditStartupPage(const ListValue* args); | 76 void EditStartupPage(const ListValue* args); |
75 | 77 |
76 // Sets the startup page set to the current pages. Called from WebUI. | 78 // Sets the startup page set to the current pages. Called from WebUI. |
77 void SetStartupPagesToCurrentPages(const ListValue* args); | 79 void SetStartupPagesToCurrentPages(const ListValue* args); |
78 | 80 |
79 // Writes the current set of startup pages to prefs. Called from WebUI. | 81 // Writes the current set of startup pages to prefs. Called from WebUI. |
80 void DragDropStartupPage(const ListValue* args); | 82 void DragDropStartupPage(const ListValue* args); |
81 | 83 |
82 // Gets autocomplete suggestions asychronously for the given string. | 84 // Gets autocomplete suggestions asychronously for the given string. |
83 // Called from WebUI. | 85 // Called from WebUI. |
84 void RequestAutocompleteSuggestions(const ListValue* args); | 86 void RequestAutocompleteSuggestions(const ListValue* args); |
85 | 87 |
86 // Called when the 'Always show the bookmarks bar' checkbox is toggled. | |
87 // Notifies any listeners interested in this event. |args| is ignored. | |
88 void ToggleShowBookmarksBar(const ListValue* args); | |
89 | |
90 // Enables/disables Instant. | 88 // Enables/disables Instant. |
91 void EnableInstant(const ListValue* args); | 89 void EnableInstant(const ListValue* args); |
92 void DisableInstant(const ListValue* args); | 90 void DisableInstant(const ListValue* args); |
93 | 91 |
94 // Called to request information about the Instant field trial. | 92 // Called to request information about the Instant field trial. |
95 void GetInstantFieldTrialStatus(const ListValue* args); | 93 void GetInstantFieldTrialStatus(const ListValue* args); |
96 | 94 |
97 // Returns the string ID for the given default browser state. | 95 // Returns the string ID for the given default browser state. |
98 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); | 96 int StatusStringIdForState(ShellIntegration::DefaultWebClientState state); |
99 | 97 |
(...skipping 29 matching lines...) Expand all Loading... |
129 // CustomHomePagesTableModel, consider changing it to something more like | 127 // CustomHomePagesTableModel, consider changing it to something more like |
130 // TemplateURLService. | 128 // TemplateURLService. |
131 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; | 129 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; |
132 | 130 |
133 scoped_ptr<AutocompleteController> autocomplete_controller_; | 131 scoped_ptr<AutocompleteController> autocomplete_controller_; |
134 | 132 |
135 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); | 133 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); |
136 }; | 134 }; |
137 | 135 |
138 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ | 136 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_BROWSER_OPTIONS_HANDLER_H_ |
OLD | NEW |