OLD | NEW |
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_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // can happen if you share the object. | 120 // can happen if you share the object. |
121 CONTENT_EXPORT static WebContents* CreateWithSessionStorage( | 121 CONTENT_EXPORT static WebContents* CreateWithSessionStorage( |
122 const CreateParams& params, | 122 const CreateParams& params, |
123 const SessionStorageNamespaceMap& session_storage_namespace_map); | 123 const SessionStorageNamespaceMap& session_storage_namespace_map); |
124 | 124 |
125 // Returns a WebContents that wraps the RenderViewHost, or NULL if the | 125 // Returns a WebContents that wraps the RenderViewHost, or NULL if the |
126 // render view host's delegate isn't a WebContents. | 126 // render view host's delegate isn't a WebContents. |
127 CONTENT_EXPORT static WebContents* FromRenderViewHost( | 127 CONTENT_EXPORT static WebContents* FromRenderViewHost( |
128 const RenderViewHost* rvh); | 128 const RenderViewHost* rvh); |
129 | 129 |
| 130 CONTENT_EXPORT static WebContents* FromRenderFrameHost(RenderFrameHost* rfh); |
| 131 |
130 virtual ~WebContents() {} | 132 virtual ~WebContents() {} |
131 | 133 |
132 // Intrinsic tab state ------------------------------------------------------- | 134 // Intrinsic tab state ------------------------------------------------------- |
133 | 135 |
134 // Gets/Sets the delegate. | 136 // Gets/Sets the delegate. |
135 virtual WebContentsDelegate* GetDelegate() = 0; | 137 virtual WebContentsDelegate* GetDelegate() = 0; |
136 virtual void SetDelegate(WebContentsDelegate* delegate) = 0; | 138 virtual void SetDelegate(WebContentsDelegate* delegate) = 0; |
137 | 139 |
138 // Gets the controller for this WebContents. | 140 // Gets the controller for this WebContents. |
139 virtual NavigationController& GetController() = 0; | 141 virtual NavigationController& GetController() = 0; |
(...skipping 20 matching lines...) Expand all Loading... |
160 // context. | 162 // context. |
161 virtual const GURL& GetLastCommittedURL() const = 0; | 163 virtual const GURL& GetLastCommittedURL() const = 0; |
162 | 164 |
163 // Return the currently active RenderProcessHost and RenderViewHost. Each of | 165 // Return the currently active RenderProcessHost and RenderViewHost. Each of |
164 // these may change over time. | 166 // these may change over time. |
165 virtual RenderProcessHost* GetRenderProcessHost() const = 0; | 167 virtual RenderProcessHost* GetRenderProcessHost() const = 0; |
166 | 168 |
167 // Returns the main frame for the currently active view. | 169 // Returns the main frame for the currently active view. |
168 virtual RenderFrameHost* GetMainFrame() = 0; | 170 virtual RenderFrameHost* GetMainFrame() = 0; |
169 | 171 |
| 172 // Calls |on_frame| for each frame in the currently active view. |
| 173 virtual void ForEachFrame( |
| 174 const base::Callback<void(RenderFrameHost*)>& on_frame) = 0; |
| 175 |
| 176 // Sends the given IPC to all frames in the currently active view. This is a |
| 177 // convenience method instead of calling ForEach. |
| 178 virtual void SendToAllFrames(IPC::Message* message) = 0; |
| 179 |
170 // Gets the current RenderViewHost for this tab. | 180 // Gets the current RenderViewHost for this tab. |
171 virtual RenderViewHost* GetRenderViewHost() const = 0; | 181 virtual RenderViewHost* GetRenderViewHost() const = 0; |
172 | 182 |
173 typedef base::Callback<void(RenderViewHost* /* render_view_host */, | 183 typedef base::Callback<void(RenderViewHost* /* render_view_host */, |
174 int /* x */, | 184 int /* x */, |
175 int /* y */)> GetRenderViewHostCallback; | 185 int /* y */)> GetRenderViewHostCallback; |
176 // Gets the RenderViewHost at coordinates (|x|, |y|) for this WebContents via | 186 // Gets the RenderViewHost at coordinates (|x|, |y|) for this WebContents via |
177 // |callback|. | 187 // |callback|. |
178 // This can be different than the current RenderViewHost if there is a | 188 // This can be different than the current RenderViewHost if there is a |
179 // BrowserPlugin at the specified position. | 189 // BrowserPlugin at the specified position. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 484 |
475 private: | 485 private: |
476 // This interface should only be implemented inside content. | 486 // This interface should only be implemented inside content. |
477 friend class WebContentsImpl; | 487 friend class WebContentsImpl; |
478 WebContents() {} | 488 WebContents() {} |
479 }; | 489 }; |
480 | 490 |
481 } // namespace content | 491 } // namespace content |
482 | 492 |
483 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 493 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
OLD | NEW |