| 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_OPTIONS_STARTUP_PAGES_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/prefs/public/pref_change_registrar.h" | 11 #include "base/prefs/public/pref_change_registrar.h" |
| 12 #include "base/prefs/public/pref_observer.h" | |
| 13 #include "chrome/browser/api/prefs/pref_member.h" | 12 #include "chrome/browser/api/prefs/pref_member.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 13 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui.h" | 14 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 16 #include "ui/base/models/table_model_observer.h" | 15 #include "ui/base/models/table_model_observer.h" |
| 17 | 16 |
| 18 class AutocompleteController; | 17 class AutocompleteController; |
| 19 class CustomHomePagesTableModel; | 18 class CustomHomePagesTableModel; |
| 20 class TemplateURLService; | 19 class TemplateURLService; |
| 21 | 20 |
| 22 namespace options { | 21 namespace options { |
| 23 | 22 |
| 24 // Chrome browser options page UI handler. | 23 // Chrome browser options page UI handler. |
| 25 class StartupPagesHandler : public OptionsPageUIHandler, | 24 class StartupPagesHandler : public OptionsPageUIHandler, |
| 26 public AutocompleteControllerDelegate, | 25 public AutocompleteControllerDelegate, |
| 27 public PrefObserver, | |
| 28 public ui::TableModelObserver { | 26 public ui::TableModelObserver { |
| 29 public: | 27 public: |
| 30 StartupPagesHandler(); | 28 StartupPagesHandler(); |
| 31 virtual ~StartupPagesHandler(); | 29 virtual ~StartupPagesHandler(); |
| 32 | 30 |
| 33 // OptionsPageUIHandler implementation. | 31 // OptionsPageUIHandler implementation. |
| 34 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 32 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
| 35 virtual void InitializeHandler() OVERRIDE; | 33 virtual void InitializeHandler() OVERRIDE; |
| 36 virtual void InitializePage() OVERRIDE; | 34 virtual void InitializePage() OVERRIDE; |
| 37 virtual void RegisterMessages() OVERRIDE; | 35 virtual void RegisterMessages() OVERRIDE; |
| 38 | 36 |
| 39 // AutocompleteControllerDelegate implementation. | 37 // AutocompleteControllerDelegate implementation. |
| 40 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | 38 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; |
| 41 | 39 |
| 42 // ui::TableModelObserver implementation. | 40 // ui::TableModelObserver implementation. |
| 43 virtual void OnModelChanged() OVERRIDE; | 41 virtual void OnModelChanged() OVERRIDE; |
| 44 virtual void OnItemsChanged(int start, int length) OVERRIDE; | 42 virtual void OnItemsChanged(int start, int length) OVERRIDE; |
| 45 virtual void OnItemsAdded(int start, int length) OVERRIDE; | 43 virtual void OnItemsAdded(int start, int length) OVERRIDE; |
| 46 virtual void OnItemsRemoved(int start, int length) OVERRIDE; | 44 virtual void OnItemsRemoved(int start, int length) OVERRIDE; |
| 47 | 45 |
| 48 private: | 46 private: |
| 49 // PrefObserver implementation. | |
| 50 virtual void OnPreferenceChanged(PrefServiceBase* service, | |
| 51 const std::string& pref_name) OVERRIDE; | |
| 52 | |
| 53 // Saves the changes that have been made. Called from WebUI. | 47 // Saves the changes that have been made. Called from WebUI. |
| 54 void CommitChanges(const ListValue* args); | 48 void CommitChanges(const ListValue* args); |
| 55 | 49 |
| 56 // Cancels the changes that have been made. Called from WebUI. | 50 // Cancels the changes that have been made. Called from WebUI. |
| 57 void CancelChanges(const ListValue* args); | 51 void CancelChanges(const ListValue* args); |
| 58 | 52 |
| 59 // Removes the startup page at the given indexes. Called from WebUI. | 53 // Removes the startup page at the given indexes. Called from WebUI. |
| 60 void RemoveStartupPages(const ListValue* args); | 54 void RemoveStartupPages(const ListValue* args); |
| 61 | 55 |
| 62 // Adds a startup page with the given URL after the given index. | 56 // Adds a startup page with the given URL after the given index. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 93 // CustomHomePagesTableModel, consider changing it to something more like | 87 // CustomHomePagesTableModel, consider changing it to something more like |
| 94 // TemplateURLService. | 88 // TemplateURLService. |
| 95 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; | 89 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; |
| 96 | 90 |
| 97 DISALLOW_COPY_AND_ASSIGN(StartupPagesHandler); | 91 DISALLOW_COPY_AND_ASSIGN(StartupPagesHandler); |
| 98 }; | 92 }; |
| 99 | 93 |
| 100 } // namespace options | 94 } // namespace options |
| 101 | 95 |
| 102 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_ | 96 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_ |
| OLD | NEW |