Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1876)

Side by Side Diff: chrome/browser/ui/webui/options2/options_ui2.h

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move anything that indirectly calls JS to InitializePage Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 content::NotificationRegistrar registrar_; 84 content::NotificationRegistrar registrar_;
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 InitializePages() = 0;
95 95
96 protected: 96 protected:
97 virtual ~OptionsPageUIHandlerHost() {} 97 virtual ~OptionsPageUIHandlerHost() {}
98 }; 98 };
99 99
100 // The WebUI for chrome:settings-frame. 100 // The WebUI for chrome:settings-frame.
101 class OptionsUI : public content::WebUIController, 101 class OptionsUI : public content::WebUIController,
102 public OptionsPageUIHandlerHost { 102 public OptionsPageUIHandlerHost {
103 public: 103 public:
104 explicit OptionsUI(content::WebUI* web_ui); 104 explicit OptionsUI(content::WebUI* web_ui);
105 virtual ~OptionsUI(); 105 virtual ~OptionsUI();
106 106
107 // Takes the suggestions from |autocompleteResult| and adds them to 107 // Takes the suggestions from |autocompleteResult| and adds them to
108 // |suggestions| so that they can be passed to a JavaScript function. 108 // |suggestions| so that they can be passed to a JavaScript function.
109 static void ProcessAutocompleteSuggestions( 109 static void ProcessAutocompleteSuggestions(
110 const AutocompleteResult& autocompleteResult, 110 const AutocompleteResult& autocompleteResult,
111 base::ListValue * const suggestions); 111 base::ListValue * const suggestions);
112 112
113 static RefCountedMemory* GetFaviconResourceBytes(); 113 static RefCountedMemory* GetFaviconResourceBytes();
114 114
115 // WebUIController implementation. 115 // WebUIController implementation.
116 virtual void RenderViewCreated( 116 virtual void RenderViewCreated(
117 content::RenderViewHost* render_view_host) OVERRIDE; 117 content::RenderViewHost* render_view_host) OVERRIDE;
118 virtual void RenderViewReused( 118 virtual void RenderViewReused(
119 content::RenderViewHost* render_view_host) OVERRIDE; 119 content::RenderViewHost* render_view_host) OVERRIDE;
120 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE;
121 120
122 // Overridden from OptionsPageUIHandlerHost: 121 // Overridden from OptionsPageUIHandlerHost:
123 virtual void InitializeHandlers() OVERRIDE; 122 virtual void InitializePages() OVERRIDE;
124 123
125 private: 124 private:
126 // Adds OptionsPageUiHandler to the handlers list if handler is enabled. 125 // Adds OptionsPageUiHandler to the handlers list if handler is enabled.
127 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings, 126 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings,
128 OptionsPageUIHandler* handler); 127 OptionsPageUIHandler* handler);
129 128
130 // Sets the WebUI CommandLineString property with arguments passed while 129 // Sets the WebUI CommandLineString property with arguments passed while
131 // launching chrome. 130 // launching chrome.
132 void SetCommandLineString(content::RenderViewHost* render_view_host); 131 void SetCommandLineString(content::RenderViewHost* render_view_host);
133 132
134 bool initialized_handlers_;
135
136 std::vector<OptionsPageUIHandler*> handlers_; 133 std::vector<OptionsPageUIHandler*> handlers_;
137 134
138 #if defined(OS_CHROMEOS) 135 #if defined(OS_CHROMEOS)
139 scoped_ptr<chromeos::system::PointerDeviceObserver> 136 scoped_ptr<chromeos::system::PointerDeviceObserver>
140 pointer_device_observer_; 137 pointer_device_observer_;
141 #endif 138 #endif
142 139
143 DISALLOW_COPY_AND_ASSIGN(OptionsUI); 140 DISALLOW_COPY_AND_ASSIGN(OptionsUI);
144 }; 141 };
145 142
146 } // namespace options2 143 } // namespace options2
147 144
148 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ 145 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698