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

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

Issue 10154004: re-use WebUIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WeakPtr solution 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/webui/web_ui_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_
6 #define CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set>
11 10
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/public/browser/web_ui.h" 13 #include "content/public/browser/web_ui.h"
14 #include "ipc/ipc_channel.h" 14 #include "ipc/ipc_channel.h"
15 15
16 namespace content { 16 namespace content {
17 class RenderViewHost; 17 class RenderViewHost;
18 } 18 }
19 19
20 class CONTENT_EXPORT WebUIImpl : public content::WebUI, 20 class CONTENT_EXPORT WebUIImpl : public content::WebUI,
21 public IPC::Channel::Listener { 21 public IPC::Channel::Listener,
22 public base::SupportsWeakPtr<WebUIImpl> {
22 public: 23 public:
23 explicit WebUIImpl(content::WebContents* contents); 24 explicit WebUIImpl(content::WebContents* contents);
24 virtual ~WebUIImpl(); 25 virtual ~WebUIImpl();
25 26
26 // Called by WebContentsImpl when the RenderView is first created. This is 27 // Called by WebContentsImpl when the RenderView is first created. This is
27 // *not* called for every page load because in some cases 28 // *not* called for every page load because in some cases
28 // RenderViewHostManager will reuse RenderView instances. 29 // RenderViewHostManager will reuse RenderView instances.
29 void RenderViewCreated(content::RenderViewHost* render_view_host); 30 void RenderViewCreated(content::RenderViewHost* render_view_host);
30 31
31 // Called when the document element is available for the page. |main_frame|
32 // is true if the main frame's document is the one that's ready; otherwise
33 // the frame is an iframe and |source_url| gives its URL. The WebUI ignores
34 // messages until the document is available, because otherwise when we reuse
35 // a RenderView, we can receive and attempt to handle WebUISend messages from
36 // the prior navigation, which were in-flight when the RenderView got
37 // repurposed.
38 void DocumentAvailableInFrame(const GURL& source_url);
39
40 // WebUI implementation: 32 // WebUI implementation:
41 virtual content::WebContents* GetWebContents() const OVERRIDE; 33 virtual content::WebContents* GetWebContents() const OVERRIDE;
42 virtual content::WebUIController* GetController() const OVERRIDE; 34 virtual content::WebUIController* GetController() const OVERRIDE;
43 virtual void SetController(content::WebUIController* controller) OVERRIDE; 35 virtual void SetController(content::WebUIController* controller) OVERRIDE;
44 virtual bool ShouldHideFavicon() const OVERRIDE; 36 virtual bool ShouldHideFavicon() const OVERRIDE;
45 virtual void HideFavicon() OVERRIDE; 37 virtual void HideFavicon() OVERRIDE;
46 virtual bool ShouldFocusLocationBarByDefault() const OVERRIDE; 38 virtual bool ShouldFocusLocationBarByDefault() const OVERRIDE;
47 virtual void FocusLocationBarByDefault() OVERRIDE; 39 virtual void FocusLocationBarByDefault() OVERRIDE;
48 virtual bool ShouldHideURL() const OVERRIDE; 40 virtual bool ShouldHideURL() const OVERRIDE;
49 virtual void HideURL() OVERRIDE; 41 virtual void HideURL() OVERRIDE;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // The WebUIMessageHandlers we own. 104 // The WebUIMessageHandlers we own.
113 std::vector<content::WebUIMessageHandler*> handlers_; 105 std::vector<content::WebUIMessageHandler*> handlers_;
114 106
115 // Non-owning pointer to the WebContents this WebUI is associated with. 107 // Non-owning pointer to the WebContents this WebUI is associated with.
116 content::WebContents* web_contents_; 108 content::WebContents* web_contents_;
117 109
118 // The path for the iframe this WebUI is embedded in (empty if not in an 110 // The path for the iframe this WebUI is embedded in (empty if not in an
119 // iframe). 111 // iframe).
120 std::string frame_xpath_; 112 std::string frame_xpath_;
121 113
122 // List of URL origins in the renderer for which the document is ready. Each
123 // origin identifies a frame; two frames with the same origin may cause this
124 // to break.
125 std::set<GURL> document_available_origins_;
126
127 scoped_ptr<content::WebUIController> controller_; 114 scoped_ptr<content::WebUIController> controller_;
128 115
129 DISALLOW_COPY_AND_ASSIGN(WebUIImpl); 116 DISALLOW_COPY_AND_ASSIGN(WebUIImpl);
130 }; 117 };
131 118
132 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ 119 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/webui/web_ui_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698