NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / search_engine_manager_handler.h
blob2057d827aaf69cd95b885513698e3619c458a55c
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_SEARCH_ENGINE_MANAGER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_
8 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h"
9 #include "chrome/browser/ui/webui/options/options_ui.h"
10 #include "ui/base/models/table_model_observer.h"
12 class KeywordEditorController;
14 namespace extensions {
15 class Extension;
18 namespace options {
20 class SearchEngineManagerHandler : public OptionsPageUIHandler,
21 public ui::TableModelObserver,
22 public EditSearchEngineControllerDelegate {
23 public:
24 SearchEngineManagerHandler();
25 virtual ~SearchEngineManagerHandler();
27 // OptionsPageUIHandler implementation.
28 virtual void GetLocalizedValues(
29 base::DictionaryValue* localized_strings) OVERRIDE;
30 virtual void InitializeHandler() OVERRIDE;
31 virtual void InitializePage() OVERRIDE;
33 // ui::TableModelObserver implementation.
34 virtual void OnModelChanged() OVERRIDE;
35 virtual void OnItemsChanged(int start, int length) OVERRIDE;
36 virtual void OnItemsAdded(int start, int length) OVERRIDE;
37 virtual void OnItemsRemoved(int start, int length) OVERRIDE;
39 // EditSearchEngineControllerDelegate implementation.
40 virtual void OnEditedKeyword(TemplateURL* template_url,
41 const base::string16& title,
42 const base::string16& keyword,
43 const std::string& url) OVERRIDE;
45 virtual void RegisterMessages() OVERRIDE;
47 private:
48 scoped_ptr<KeywordEditorController> list_controller_;
49 scoped_ptr<EditSearchEngineController> edit_controller_;
51 // Removes the search engine at the given index. Called from WebUI.
52 void RemoveSearchEngine(const base::ListValue* args);
54 // Sets the search engine at the given index to be default. Called from WebUI.
55 void SetDefaultSearchEngine(const base::ListValue* args);
57 // Starts an edit session for the search engine at the given index. If the
58 // index is -1, starts editing a new search engine instead of an existing one.
59 // Called from WebUI.
60 void EditSearchEngine(const base::ListValue* args);
62 // Validates the given search engine values, and reports the results back
63 // to WebUI. Called from WebUI.
64 void CheckSearchEngineInfoValidity(const base::ListValue* args);
66 // Called when an edit is cancelled.
67 // Called from WebUI.
68 void EditCancelled(const base::ListValue* args);
70 // Called when an edit is finished and should be saved.
71 // Called from WebUI.
72 void EditCompleted(const base::ListValue* args);
74 // Returns a dictionary to pass to WebUI representing the given search engine.
75 base::DictionaryValue* CreateDictionaryForEngine(
76 int index, bool is_default, bool is_extension);
78 // Returns a dictionary to pass to WebUI representing the extension.
79 base::DictionaryValue* CreateDictionaryForExtension(
80 const extensions::Extension& extension);
82 DISALLOW_COPY_AND_ASSIGN(SearchEngineManagerHandler);
85 } // namespace options
87 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_