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

Side by Side Diff: chrome/browser/ui/webui/options/options_ui.h

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 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_OPTIONS_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
14 #include "content/browser/webui/web_ui.h" 14 #include "content/browser/webui/web_ui.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/notification_types.h" 17 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/web_ui_controller.h"
18 #include "content/public/browser/web_ui_message_handler.h" 19 #include "content/public/browser/web_ui_message_handler.h"
19 20
20 // The base class handler of Javascript messages of options pages. 21 // The base class handler of Javascript messages of options pages.
21 class OptionsPageUIHandler : public content::WebUIMessageHandler, 22 class OptionsPageUIHandler : public content::WebUIMessageHandler,
22 public content::NotificationObserver { 23 public content::NotificationObserver {
23 public: 24 public:
24 OptionsPageUIHandler(); 25 OptionsPageUIHandler();
25 virtual ~OptionsPageUIHandler(); 26 virtual ~OptionsPageUIHandler();
26 27
27 // Is this handler enabled? 28 // Is this handler enabled?
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // should provide. 73 // should provide.
73 class OptionsPageUIHandlerHost { 74 class OptionsPageUIHandlerHost {
74 public: 75 public:
75 virtual void InitializeHandlers() = 0; 76 virtual void InitializeHandlers() = 0;
76 77
77 protected: 78 protected:
78 virtual ~OptionsPageUIHandlerHost() {} 79 virtual ~OptionsPageUIHandlerHost() {}
79 }; 80 };
80 81
81 // The WebUI for chrome:settings. 82 // The WebUI for chrome:settings.
82 class OptionsUI : public WebUI, 83 class OptionsUI : public WebUI, public content::WebUIController,
83 public OptionsPageUIHandlerHost { 84 public OptionsPageUIHandlerHost {
84 public: 85 public:
85 explicit OptionsUI(content::WebContents* contents); 86 explicit OptionsUI(content::WebContents* contents);
86 virtual ~OptionsUI(); 87 virtual ~OptionsUI();
87 88
88 static RefCountedMemory* GetFaviconResourceBytes(); 89 static RefCountedMemory* GetFaviconResourceBytes();
89 90
90 // WebUI implementation. 91 // WebUIController implementation.
91 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; 92 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
92 virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE; 93 virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE;
93 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; 94 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE;
94 95
95 // Overridden from OptionsPageUIHandlerHost: 96 // Overridden from OptionsPageUIHandlerHost:
96 virtual void InitializeHandlers() OVERRIDE; 97 virtual void InitializeHandlers() OVERRIDE;
97 98
98 private: 99 private:
99 // Adds OptionsPageUiHandler to the handlers list if handler is enabled. 100 // Adds OptionsPageUiHandler to the handlers list if handler is enabled.
100 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings, 101 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings,
101 OptionsPageUIHandler* handler); 102 OptionsPageUIHandler* handler);
102 103
103 // Sets the WebUI CommandLineString property with arguments passed while 104 // Sets the WebUI CommandLineString property with arguments passed while
104 // launching chrome. 105 // launching chrome.
105 void SetCommandLineString(RenderViewHost* render_view_host); 106 void SetCommandLineString(RenderViewHost* render_view_host);
106 107
107 bool initialized_handlers_; 108 bool initialized_handlers_;
108 109
109 DISALLOW_COPY_AND_ASSIGN(OptionsUI); 110 DISALLOW_COPY_AND_ASSIGN(OptionsUI);
110 }; 111 };
111 112
112 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_ 113 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.cc ('k') | chrome/browser/ui/webui/options/options_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698