| 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_OPTIONS2_OPTIONS_UI2_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 DISALLOW_COPY_AND_ASSIGN(OptionsPageUIHandler); | 87 DISALLOW_COPY_AND_ASSIGN(OptionsPageUIHandler); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // An interface for common operations that a host of OptionsPageUIHandlers | 90 // An interface for common operations that a host of OptionsPageUIHandlers |
| 91 // should provide. | 91 // should provide. |
| 92 class OptionsPageUIHandlerHost { | 92 class OptionsPageUIHandlerHost { |
| 93 public: | 93 public: |
| 94 virtual void InitializeHandlers() = 0; | 94 virtual void InitializeHandlers() = 0; |
| 95 virtual void InitializePages() = 0; |
| 95 | 96 |
| 96 protected: | 97 protected: |
| 97 virtual ~OptionsPageUIHandlerHost() {} | 98 virtual ~OptionsPageUIHandlerHost() {} |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 // The WebUI for chrome:settings-frame. | 101 // The WebUI for chrome:settings-frame. |
| 101 class OptionsUI : public content::WebUIController, | 102 class OptionsUI : public content::WebUIController, |
| 102 public OptionsPageUIHandlerHost { | 103 public OptionsPageUIHandlerHost { |
| 103 public: | 104 public: |
| 104 explicit OptionsUI(content::WebUI* web_ui); | 105 explicit OptionsUI(content::WebUI* web_ui); |
| 105 virtual ~OptionsUI(); | 106 virtual ~OptionsUI(); |
| 106 | 107 |
| 107 // Takes the suggestions from |autocompleteResult| and adds them to | 108 // Takes the suggestions from |autocompleteResult| and adds them to |
| 108 // |suggestions| so that they can be passed to a JavaScript function. | 109 // |suggestions| so that they can be passed to a JavaScript function. |
| 109 static void ProcessAutocompleteSuggestions( | 110 static void ProcessAutocompleteSuggestions( |
| 110 const AutocompleteResult& autocompleteResult, | 111 const AutocompleteResult& autocompleteResult, |
| 111 base::ListValue * const suggestions); | 112 base::ListValue * const suggestions); |
| 112 | 113 |
| 113 static RefCountedMemory* GetFaviconResourceBytes(); | 114 static RefCountedMemory* GetFaviconResourceBytes(); |
| 114 | 115 |
| 115 // WebUIController implementation. | 116 // WebUIController implementation. |
| 116 virtual void RenderViewCreated( | 117 virtual void RenderViewCreated( |
| 117 content::RenderViewHost* render_view_host) OVERRIDE; | 118 content::RenderViewHost* render_view_host) OVERRIDE; |
| 118 virtual void RenderViewReused( | 119 virtual void RenderViewReused( |
| 119 content::RenderViewHost* render_view_host) OVERRIDE; | 120 content::RenderViewHost* render_view_host) OVERRIDE; |
| 120 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; | 121 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; |
| 121 | 122 |
| 122 // Overridden from OptionsPageUIHandlerHost: | 123 // Overridden from OptionsPageUIHandlerHost: |
| 123 virtual void InitializeHandlers() OVERRIDE; | 124 virtual void InitializeHandlers() OVERRIDE; |
| 125 virtual void InitializePages() OVERRIDE; |
| 124 | 126 |
| 125 private: | 127 private: |
| 126 // Adds OptionsPageUiHandler to the handlers list if handler is enabled. | 128 // Adds OptionsPageUiHandler to the handlers list if handler is enabled. |
| 127 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings, | 129 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings, |
| 128 OptionsPageUIHandler* handler); | 130 OptionsPageUIHandler* handler); |
| 129 | 131 |
| 130 // Sets the WebUI CommandLineString property with arguments passed while | 132 // Sets the WebUI CommandLineString property with arguments passed while |
| 131 // launching chrome. | 133 // launching chrome. |
| 132 void SetCommandLineString(content::RenderViewHost* render_view_host); | 134 void SetCommandLineString(content::RenderViewHost* render_view_host); |
| 133 | 135 |
| 134 bool initialized_handlers_; | 136 bool initialized_handlers_; |
| 135 | 137 |
| 136 std::vector<OptionsPageUIHandler*> handlers_; | 138 std::vector<OptionsPageUIHandler*> handlers_; |
| 137 | 139 |
| 138 #if defined(OS_CHROMEOS) | 140 #if defined(OS_CHROMEOS) |
| 139 scoped_ptr<chromeos::system::PointerDeviceObserver> | 141 scoped_ptr<chromeos::system::PointerDeviceObserver> |
| 140 pointer_device_observer_; | 142 pointer_device_observer_; |
| 141 #endif | 143 #endif |
| 142 | 144 |
| 143 DISALLOW_COPY_AND_ASSIGN(OptionsUI); | 145 DISALLOW_COPY_AND_ASSIGN(OptionsUI); |
| 144 }; | 146 }; |
| 145 | 147 |
| 146 } // namespace options2 | 148 } // namespace options2 |
| 147 | 149 |
| 148 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ | 150 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ |
| OLD | NEW |