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

Side by Side Diff: content/browser/webui/web_ui.h

Issue 7800015: prune down content_dll change to just the CONTENT_EXPORTS (Closed)
Patch Set: update copyright headers, merge Created 9 years, 3 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
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 CONTENT_BROWSER_WEBUI_WEB_UI_H_ 5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_H_
6 #define CONTENT_BROWSER_WEBUI_WEB_UI_H_ 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_old.h" 13 #include "base/callback_old.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "content/common/content_export.h"
16 #include "content/common/page_transition_types.h" 17 #include "content/common/page_transition_types.h"
17 #include "ipc/ipc_channel.h" 18 #include "ipc/ipc_channel.h"
18 19
19 class WebUIMessageHandler; 20 class WebUIMessageHandler;
20 class GURL; 21 class GURL;
21 class RenderViewHost; 22 class RenderViewHost;
22 class TabContents; 23 class TabContents;
23 24
24 namespace base { 25 namespace base {
25 class DictionaryValue; 26 class DictionaryValue;
26 class ListValue; 27 class ListValue;
27 class Value; 28 class Value;
28 } 29 }
29 30
30 // A WebUI sets up the datasources and message handlers for a given HTML-based 31 // A WebUI sets up the datasources and message handlers for a given HTML-based
31 // UI. 32 // UI.
32 // 33 //
33 // NOTE: If you're creating a new WebUI for Chrome code, make sure you extend 34 // NOTE: If you're creating a new WebUI for Chrome code, make sure you extend
34 // ChromeWebUI. 35 // ChromeWebUI.
35 class WebUI : public IPC::Channel::Listener { 36 class CONTENT_EXPORT WebUI : public IPC::Channel::Listener {
36 public: 37 public:
37 explicit WebUI(TabContents* contents); 38 explicit WebUI(TabContents* contents);
38 virtual ~WebUI(); 39 virtual ~WebUI();
39 40
40 // IPC message handling. 41 // IPC message handling.
41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
42 virtual void OnWebUISend(const GURL& source_url, 43 virtual void OnWebUISend(const GURL& source_url,
43 const std::string& message, 44 const std::string& message,
44 const base::ListValue& args); 45 const base::ListValue& args);
45 46
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // A map of message name -> message handling callback. 192 // A map of message name -> message handling callback.
192 typedef std::map<std::string, MessageCallback*> MessageCallbackMap; 193 typedef std::map<std::string, MessageCallback*> MessageCallbackMap;
193 MessageCallbackMap message_callbacks_; 194 MessageCallbackMap message_callbacks_;
194 195
195 DISALLOW_COPY_AND_ASSIGN(WebUI); 196 DISALLOW_COPY_AND_ASSIGN(WebUI);
196 }; 197 };
197 198
198 // Messages sent from the DOM are forwarded via the WebUI to handler 199 // Messages sent from the DOM are forwarded via the WebUI to handler
199 // classes. These objects are owned by WebUI and destroyed when the 200 // classes. These objects are owned by WebUI and destroyed when the
200 // host is destroyed. 201 // host is destroyed.
201 class WebUIMessageHandler { 202 class CONTENT_EXPORT WebUIMessageHandler {
202 public: 203 public:
203 WebUIMessageHandler(); 204 WebUIMessageHandler();
204 virtual ~WebUIMessageHandler(); 205 virtual ~WebUIMessageHandler();
205 206
206 // Attaches |this| to |web_ui| in order to handle messages from it. Declared 207 // Attaches |this| to |web_ui| in order to handle messages from it. Declared
207 // virtual so that subclasses can do special init work as soon as the web_ui 208 // virtual so that subclasses can do special init work as soon as the web_ui
208 // is provided. Returns |this| for convenience. 209 // is provided. Returns |this| for convenience.
209 virtual WebUIMessageHandler* Attach(WebUI* web_ui); 210 virtual WebUIMessageHandler* Attach(WebUI* web_ui);
210 211
211 // Returns true to indicate that a long running operation is in progress and 212 // Returns true to indicate that a long running operation is in progress and
(...skipping 19 matching lines...) Expand all
231 // Returns the attached WebUI for this handler. 232 // Returns the attached WebUI for this handler.
232 WebUI* web_ui() const { return web_ui_; } 233 WebUI* web_ui() const { return web_ui_; }
233 234
234 WebUI* web_ui_; // TODO(wyck): Make private after merge conflicts go away. 235 WebUI* web_ui_; // TODO(wyck): Make private after merge conflicts go away.
235 236
236 private: 237 private:
237 DISALLOW_COPY_AND_ASSIGN(WebUIMessageHandler); 238 DISALLOW_COPY_AND_ASSIGN(WebUIMessageHandler);
238 }; 239 };
239 240
240 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_H_ 241 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698