Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / startup_pages_handler.h
blob5978411c799b137f847c631bab97c1828bc27164
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/prefs/pref_change_registrar.h"
12 #include "base/prefs/pref_member.h"
13 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
14 #include "chrome/browser/ui/webui/options/options_ui.h"
15 #include "ui/base/models/table_model_observer.h"
17 class AutocompleteController;
18 class CustomHomePagesTableModel;
19 class TemplateURLService;
21 namespace options {
23 // Chrome browser options page UI handler.
24 class StartupPagesHandler : public OptionsPageUIHandler,
25 public AutocompleteControllerDelegate,
26 public ui::TableModelObserver {
27 public:
28 StartupPagesHandler();
29 virtual ~StartupPagesHandler();
31 // OptionsPageUIHandler implementation.
32 virtual void GetLocalizedValues(
33 base::DictionaryValue* localized_strings) OVERRIDE;
34 virtual void InitializeHandler() OVERRIDE;
35 virtual void InitializePage() OVERRIDE;
36 virtual void RegisterMessages() OVERRIDE;
38 // AutocompleteControllerDelegate implementation.
39 virtual void OnResultChanged(bool default_match_changed) OVERRIDE;
41 // ui::TableModelObserver implementation.
42 virtual void OnModelChanged() OVERRIDE;
43 virtual void OnItemsChanged(int start, int length) OVERRIDE;
44 virtual void OnItemsAdded(int start, int length) OVERRIDE;
45 virtual void OnItemsRemoved(int start, int length) OVERRIDE;
47 private:
48 // Saves the changes that have been made. Called from WebUI.
49 void CommitChanges(const base::ListValue* args);
51 // Cancels the changes that have been made. Called from WebUI.
52 void CancelChanges(const base::ListValue* args);
54 // Removes the startup page at the given indexes. Called from WebUI.
55 void RemoveStartupPages(const base::ListValue* args);
57 // Adds a startup page with the given URL after the given index.
58 // Called from WebUI.
59 void AddStartupPage(const base::ListValue* args);
61 // Changes the startup page at the given index to the given URL.
62 // Called from WebUI.
63 void EditStartupPage(const base::ListValue* args);
65 // Sets the startup page set to the current pages. Called from WebUI.
66 void SetStartupPagesToCurrentPages(const base::ListValue* args);
68 // Writes the current set of startup pages to prefs. Called from WebUI.
69 void DragDropStartupPage(const base::ListValue* args);
71 // Gets autocomplete suggestions asychronously for the given string.
72 // Called from WebUI.
73 void RequestAutocompleteSuggestions(const base::ListValue* args);
75 // Loads the current set of custom startup pages and reports it to the WebUI.
76 void UpdateStartupPages();
78 // Writes the current set of startup pages to prefs.
79 void SaveStartupPagesPref();
81 scoped_ptr<AutocompleteController> autocomplete_controller_;
83 // Used to observe updates to the preference of the list of URLs to load
84 // on startup, which can be updated via sync.
85 PrefChangeRegistrar pref_change_registrar_;
87 // TODO(stuartmorgan): Once there are no other clients of
88 // CustomHomePagesTableModel, consider changing it to something more like
89 // TemplateURLService.
90 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_;
92 DISALLOW_COPY_AND_ASSIGN(StartupPagesHandler);
95 } // namespace options
97 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_STARTUP_PAGES_HANDLER_H_