OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_BROWSER_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_BROWSER_OPTIONS_HANDLER_H_ |
6 #define CHROME_BROWSER_DOM_UI_BROWSER_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_BROWSER_OPTIONS_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
arv (Not doing code reviews)
2010/07/27 19:02:31
Can you do this in a separate patch?
stuartmorgan
2010/07/27 20:07:23
I'm not doing that; you're looking at the diff bet
| |
8 | 8 |
9 #include "app/table_model_observer.h" | |
9 #include "chrome/browser/dom_ui/options_ui.h" | 10 #include "chrome/browser/dom_ui/options_ui.h" |
10 #include "chrome/browser/search_engines/template_url_model.h" | 11 #include "chrome/browser/search_engines/template_url_model.h" |
11 #include "chrome/browser/shell_integration.h" | 12 #include "chrome/browser/shell_integration.h" |
12 | 13 |
14 class CustomHomePagesTableModel; | |
15 | |
13 // Chrome browser options page UI handler. | 16 // Chrome browser options page UI handler. |
14 class BrowserOptionsHandler : public OptionsPageUIHandler, | 17 class BrowserOptionsHandler : public OptionsPageUIHandler, |
15 public ShellIntegration::DefaultBrowserObserver, | 18 public ShellIntegration::DefaultBrowserObserver, |
16 public TemplateURLModelObserver { | 19 public TemplateURLModelObserver, |
20 public TableModelObserver { | |
17 public: | 21 public: |
18 BrowserOptionsHandler(); | 22 BrowserOptionsHandler(); |
19 virtual ~BrowserOptionsHandler(); | 23 virtual ~BrowserOptionsHandler(); |
20 | 24 |
21 virtual void Initialize(); | 25 virtual void Initialize(); |
22 | 26 |
23 // OptionsUIHandler implementation. | 27 // OptionsUIHandler implementation. |
24 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 28 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
25 virtual void RegisterMessages(); | 29 virtual void RegisterMessages(); |
26 | 30 |
27 // ShellIntegration::DefaultBrowserObserver implementation. | 31 // ShellIntegration::DefaultBrowserObserver implementation. |
28 virtual void SetDefaultBrowserUIState( | 32 virtual void SetDefaultBrowserUIState( |
29 ShellIntegration::DefaultBrowserUIState state); | 33 ShellIntegration::DefaultBrowserUIState state); |
30 | 34 |
31 // TemplateURLModelObserver implementation. | 35 // TemplateURLModelObserver implementation. |
32 virtual void OnTemplateURLModelChanged(); | 36 virtual void OnTemplateURLModelChanged(); |
33 | 37 |
38 // TableModelObserver implementation. | |
39 virtual void OnModelChanged(); | |
40 virtual void OnItemsChanged(int start, int length); | |
41 virtual void OnItemsAdded(int start, int length); | |
42 virtual void OnItemsRemoved(int start, int length); | |
43 | |
34 private: | 44 private: |
35 // Makes this the default browser. Called from DOMUI. | 45 // Makes this the default browser. Called from DOMUI. |
36 void BecomeDefaultBrowser(const Value* value); | 46 void BecomeDefaultBrowser(const Value* value); |
37 | 47 |
38 // Sets the search engine at the given index to be default. Called from DOMUI. | 48 // Sets the search engine at the given index to be default. Called from DOMUI. |
39 void SetDefaultSearchEngine(const Value* value); | 49 void SetDefaultSearchEngine(const Value* value); |
40 | 50 |
51 // Removes the startup page at the given indexes. Called from DOMUI. | |
52 void RemoveStartupPages(const Value* value); | |
53 | |
54 // Sets the startup page set to the current pages. Called from DOMUI. | |
55 void SetStartupPagesToCurrentPages(const Value* value); | |
56 | |
41 // Returns the string ID for the given default browser state. | 57 // Returns the string ID for the given default browser state. |
42 int StatusStringIdForState(ShellIntegration::DefaultBrowserState state); | 58 int StatusStringIdForState(ShellIntegration::DefaultBrowserState state); |
43 | 59 |
44 // Gets the current default browser state, and asynchronously reports it to | 60 // Gets the current default browser state, and asynchronously reports it to |
45 // the DOMUI page. | 61 // the DOMUI page. |
46 void UpdateDefaultBrowserState(); | 62 void UpdateDefaultBrowserState(); |
47 | 63 |
48 // Updates the UI with the given state for the default browser. | 64 // Updates the UI with the given state for the default browser. |
49 void SetDefaultBrowserUIString(int status_string_id); | 65 void SetDefaultBrowserUIString(int status_string_id); |
50 | 66 |
67 // Loads the current set of custom startup pages and reports it to the DOMUI. | |
68 void UpdateStartupPages(); | |
69 | |
70 // Loads the possible default search engine list and reports it to the DOMUI. | |
71 void UpdateSearchEngines(); | |
72 | |
73 // Writes the current set of startup pages to prefs. | |
74 void SaveStartupPagesPref(); | |
75 | |
51 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; | 76 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; |
52 | 77 |
53 TemplateURLModel* template_url_model_; // Weak. | 78 TemplateURLModel* template_url_model_; // Weak. |
54 | 79 |
80 // TODO(stuartmorgan): Once there are no other clients of | |
81 // CustomHomePagesTableModel, consider changing it to something more like | |
82 // TemplateURLModel. | |
83 scoped_ptr<CustomHomePagesTableModel> startup_custom_pages_table_model_; | |
84 | |
55 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); | 85 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); |
56 }; | 86 }; |
57 | 87 |
58 #endif // CHROME_BROWSER_DOM_UI_BROWSER_OPTIONS_HANDLER_H_ | 88 #endif // CHROME_BROWSER_DOM_UI_BROWSER_OPTIONS_HANDLER_H_ |
OLD | NEW |