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

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: fix reload DCHECKs 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 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"
13 #include "content/public/browser/web_ui.h" 12 #include "content/public/browser/web_ui.h"
14 #include "ipc/ipc_channel.h" 13 #include "ipc/ipc_channel.h"
15 14
16 namespace content { 15 namespace content {
17 class RenderViewHost; 16 class RenderViewHost;
18 } 17 }
19 18
20 class CONTENT_EXPORT WebUIImpl : public content::WebUI, 19 class CONTENT_EXPORT WebUIImpl : public content::WebUI,
21 public IPC::Channel::Listener { 20 public IPC::Channel::Listener {
22 public: 21 public:
23 explicit WebUIImpl(content::WebContents* contents); 22 explicit WebUIImpl(content::WebContents* contents);
24 virtual ~WebUIImpl(); 23 virtual ~WebUIImpl();
25 24
26 // Called by WebContentsImpl when the RenderView is first created. This is 25 // Called by WebContentsImpl when the RenderView is first created. This is
27 // *not* called for every page load because in some cases 26 // *not* called for every page load because in some cases
28 // RenderViewHostManager will reuse RenderView instances. 27 // RenderViewHostManager will reuse RenderView instances.
29 void RenderViewCreated(content::RenderViewHost* render_view_host); 28 void RenderViewCreated(content::RenderViewHost* render_view_host);
30 29
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: 30 // WebUI implementation:
41 virtual content::WebContents* GetWebContents() const OVERRIDE; 31 virtual content::WebContents* GetWebContents() const OVERRIDE;
42 virtual content::WebUIController* GetController() const OVERRIDE; 32 virtual content::WebUIController* GetController() const OVERRIDE;
43 virtual void SetController(content::WebUIController* controller) OVERRIDE; 33 virtual void SetController(content::WebUIController* controller) OVERRIDE;
44 virtual bool ShouldHideFavicon() const OVERRIDE; 34 virtual bool ShouldHideFavicon() const OVERRIDE;
45 virtual void HideFavicon() OVERRIDE; 35 virtual void HideFavicon() OVERRIDE;
46 virtual bool ShouldFocusLocationBarByDefault() const OVERRIDE; 36 virtual bool ShouldFocusLocationBarByDefault() const OVERRIDE;
47 virtual void FocusLocationBarByDefault() OVERRIDE; 37 virtual void FocusLocationBarByDefault() OVERRIDE;
48 virtual bool ShouldHideURL() const OVERRIDE; 38 virtual bool ShouldHideURL() const OVERRIDE;
49 virtual void HideURL() OVERRIDE; 39 virtual void HideURL() OVERRIDE;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // The WebUIMessageHandlers we own. 102 // The WebUIMessageHandlers we own.
113 std::vector<content::WebUIMessageHandler*> handlers_; 103 std::vector<content::WebUIMessageHandler*> handlers_;
114 104
115 // Non-owning pointer to the WebContents this WebUI is associated with. 105 // Non-owning pointer to the WebContents this WebUI is associated with.
116 content::WebContents* web_contents_; 106 content::WebContents* web_contents_;
117 107
118 // The path for the iframe this WebUI is embedded in (empty if not in an 108 // The path for the iframe this WebUI is embedded in (empty if not in an
119 // iframe). 109 // iframe).
120 std::string frame_xpath_; 110 std::string frame_xpath_;
121 111
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_; 112 scoped_ptr<content::WebUIController> controller_;
128 113
129 DISALLOW_COPY_AND_ASSIGN(WebUIImpl); 114 DISALLOW_COPY_AND_ASSIGN(WebUIImpl);
130 }; 115 };
131 116
132 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_ 117 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698