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_SEARCH_ENGINE_MANAGER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_ |
7 | 7 |
8 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" | 8 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" |
9 #include "chrome/browser/ui/webui/options/options_ui.h" | 9 #include "chrome/browser/ui/webui/options/options_ui.h" |
10 #include "ui/base/models/table_model_observer.h" | 10 #include "ui/base/models/table_model_observer.h" |
11 | 11 |
12 class KeywordEditorController; | 12 class KeywordEditorController; |
13 | 13 |
14 class SearchEngineManagerHandler : public OptionsPageUIHandler, | 14 class SearchEngineManagerHandler : public OptionsPageUIHandler, |
15 public ui::TableModelObserver, | 15 public ui::TableModelObserver, |
16 public EditSearchEngineControllerDelegate { | 16 public EditSearchEngineControllerDelegate { |
17 public: | 17 public: |
18 SearchEngineManagerHandler(); | 18 SearchEngineManagerHandler(); |
19 virtual ~SearchEngineManagerHandler(); | 19 virtual ~SearchEngineManagerHandler(); |
20 | 20 |
21 virtual void Initialize(); | 21 virtual void Initialize(); |
22 | 22 |
23 // OptionsPageUIHandler implementation. | 23 // OptionsPageUIHandler implementation. |
24 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 24 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings); |
25 | 25 |
26 // ui::TableModelObserver implementation. | 26 // ui::TableModelObserver implementation. |
27 virtual void OnModelChanged(); | 27 virtual void OnModelChanged(); |
28 virtual void OnItemsChanged(int start, int length); | 28 virtual void OnItemsChanged(int start, int length); |
29 virtual void OnItemsAdded(int start, int length); | 29 virtual void OnItemsAdded(int start, int length); |
30 virtual void OnItemsRemoved(int start, int length); | 30 virtual void OnItemsRemoved(int start, int length); |
31 | 31 |
32 // EditSearchEngineControllerDelegate implementation. | 32 // EditSearchEngineControllerDelegate implementation. |
33 virtual void OnEditedKeyword(const TemplateURL* template_url, | 33 virtual void OnEditedKeyword(const TemplateURL* template_url, |
34 const string16& title, | 34 const string16& title, |
35 const string16& keyword, | 35 const string16& keyword, |
36 const std::string& url); | 36 const std::string& url); |
37 | 37 |
38 virtual void RegisterMessages(); | 38 virtual void RegisterMessages(); |
39 | 39 |
40 private: | 40 private: |
41 scoped_ptr<KeywordEditorController> list_controller_; | 41 scoped_ptr<KeywordEditorController> list_controller_; |
42 scoped_ptr<EditSearchEngineController> edit_controller_; | 42 scoped_ptr<EditSearchEngineController> edit_controller_; |
43 | 43 |
44 // Removes the search engine at the given index. Called from WebUI. | 44 // Removes the search engine at the given index. Called from WebUI. |
45 void RemoveSearchEngine(const ListValue* args); | 45 void RemoveSearchEngine(const base::ListValue* args); |
46 | 46 |
47 // Sets the search engine at the given index to be default. Called from WebUI. | 47 // Sets the search engine at the given index to be default. Called from WebUI. |
48 void SetDefaultSearchEngine(const ListValue* args); | 48 void SetDefaultSearchEngine(const base::ListValue* args); |
49 | 49 |
50 // Starts an edit session for the search engine at the given index. If the | 50 // Starts an edit session for the search engine at the given index. If the |
51 // index is -1, starts editing a new search engine instead of an existing one. | 51 // index is -1, starts editing a new search engine instead of an existing one. |
52 // Called from WebUI. | 52 // Called from WebUI. |
53 void EditSearchEngine(const ListValue* args); | 53 void EditSearchEngine(const base::ListValue* args); |
54 | 54 |
55 // Validates the given search engine values, and reports the results back | 55 // Validates the given search engine values, and reports the results back |
56 // to WebUI. Called from WebUI. | 56 // to WebUI. Called from WebUI. |
57 void CheckSearchEngineInfoValidity(const ListValue* args); | 57 void CheckSearchEngineInfoValidity(const base::ListValue* args); |
58 | 58 |
59 // Called when an edit is cancelled. | 59 // Called when an edit is cancelled. |
60 // Called from WebUI. | 60 // Called from WebUI. |
61 void EditCancelled(const ListValue* args); | 61 void EditCancelled(const base::ListValue* args); |
62 | 62 |
63 // Called when an edit is finished and should be saved. | 63 // Called when an edit is finished and should be saved. |
64 // Called from WebUI. | 64 // Called from WebUI. |
65 void EditCompleted(const ListValue* args); | 65 void EditCompleted(const base::ListValue* args); |
66 | 66 |
67 // Returns a dictionary to pass to WebUI representing the given search engine. | 67 // Returns a dictionary to pass to WebUI representing the given search engine. |
68 DictionaryValue* CreateDictionaryForEngine(int index, bool is_default); | 68 base::DictionaryValue* CreateDictionaryForEngine(int index, bool is_default); |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(SearchEngineManagerHandler); | 70 DISALLOW_COPY_AND_ASSIGN(SearchEngineManagerHandler); |
71 }; | 71 }; |
72 | 72 |
73 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_ | 73 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SEARCH_ENGINE_MANAGER_HANDLER_H_ |
OLD | NEW |