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

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

Issue 9150021: Rename WebUI to WebUIImpl. (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
« no previous file with comments | « content/browser/webui/generic_handler.cc ('k') | content/browser/webui/web_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_H_
6 #define CONTENT_BROWSER_WEBUI_WEB_UI_H_
7 #pragma once
8
9 #include <map>
10
11 #include "base/compiler_specific.h"
12 #include "content/public/browser/web_ui.h"
13 #include "ipc/ipc_channel.h"
14
15 class RenderViewHost;
16
17 class CONTENT_EXPORT WebUI : public content::WebUI,
18 public IPC::Channel::Listener {
19 public:
20 explicit WebUI(content::WebContents* contents);
21 virtual ~WebUI();
22
23 // Called by TabContents when the RenderView is first created. This is *not*
24 // called for every page load because in some cases RenderViewHostManager will
25 // reuse RenderView instances.
26 void RenderViewCreated(RenderViewHost* render_view_host);
27
28 // WebUI implementation:
29 virtual content::WebContents* GetWebContents() const OVERRIDE;
30 virtual content::WebUIController* GetController() const OVERRIDE;
31 virtual void SetController(content::WebUIController* controller) OVERRIDE;
32 virtual bool ShouldHideFavicon() const OVERRIDE;
33 virtual void HideFavicon() OVERRIDE;
34 virtual bool ShouldFocusLocationBarByDefault() const OVERRIDE;
35 virtual void FocusLocationBarByDefault() OVERRIDE;
36 virtual bool ShouldHideURL() const OVERRIDE;
37 virtual void HideURL() OVERRIDE;
38 virtual const string16& GetOverriddenTitle() const OVERRIDE;
39 virtual void OverrideTitle(const string16& title) OVERRIDE;
40 virtual content::PageTransition GetLinkTransitionType() const OVERRIDE;
41 virtual void SetLinkTransitionType(content::PageTransition type) OVERRIDE;
42 virtual int GetBindings() const OVERRIDE;
43 virtual void SetBindings(int bindings) OVERRIDE;
44 virtual void SetFrameXPath(const std::string& xpath) OVERRIDE;
45 virtual void AddMessageHandler(
46 content::WebUIMessageHandler* handler) OVERRIDE;
47 typedef base::Callback<void(const base::ListValue*)> MessageCallback;
48 virtual void RegisterMessageCallback(
49 const std::string& message,
50 const MessageCallback& callback) OVERRIDE;
51 virtual void ProcessWebUIMessage(const GURL& source_url,
52 const std::string& message,
53 const base::ListValue& args) OVERRIDE;
54 virtual void CallJavascriptFunction(
55 const std::string& function_name) OVERRIDE;
56 virtual void CallJavascriptFunction(const std::string& function_name,
57 const base::Value& arg) OVERRIDE;
58 virtual void CallJavascriptFunction(const std::string& function_name,
59 const base::Value& arg1,
60 const base::Value& arg2) OVERRIDE;
61 virtual void CallJavascriptFunction(const std::string& function_name,
62 const base::Value& arg1,
63 const base::Value& arg2,
64 const base::Value& arg3) OVERRIDE;
65 virtual void CallJavascriptFunction(const std::string& function_name,
66 const base::Value& arg1,
67 const base::Value& arg2,
68 const base::Value& arg3,
69 const base::Value& arg4) OVERRIDE;
70 virtual void CallJavascriptFunction(
71 const std::string& function_name,
72 const std::vector<const base::Value*>& args) OVERRIDE;
73
74 // IPC::Channel::Listener implementation:
75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
76
77 private:
78 // IPC message handling.
79 void OnWebUISend(const GURL& source_url,
80 const std::string& message,
81 const base::ListValue& args);
82
83 // Execute a string of raw Javascript on the page.
84 void ExecuteJavascript(const string16& javascript);
85
86 // A map of message name -> message handling callback.
87 typedef std::map<std::string, MessageCallback> MessageCallbackMap;
88 MessageCallbackMap message_callbacks_;
89
90 // Options that may be overridden by individual Web UI implementations. The
91 // bool options default to false. See the public getters for more information.
92 bool hide_favicon_;
93 bool focus_location_bar_by_default_;
94 bool should_hide_url_;
95 string16 overridden_title_; // Defaults to empty string.
96 content::PageTransition link_transition_type_; // Defaults to LINK.
97 int bindings_; // The bindings from BindingsPolicy that should be enabled for
98 // this page.
99
100 // The WebUIMessageHandlers we own.
101 std::vector<content::WebUIMessageHandler*> handlers_;
102
103 // Non-owning pointer to the WebContents this WebUI is associated with.
104 content::WebContents* web_contents_;
105
106 // The path for the iframe this WebUI is embedded in (empty if not in an
107 // iframe).
108 std::string frame_xpath_;
109
110 scoped_ptr<content::WebUIController> controller_;
111
112 DISALLOW_COPY_AND_ASSIGN(WebUI);
113 };
114
115 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_H_
OLDNEW
« no previous file with comments | « content/browser/webui/generic_handler.cc ('k') | content/browser/webui/web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698