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_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 class RenderViewHostDelegateView; | 68 class RenderViewHostDelegateView; |
69 class RenderWidgetHostImpl; | 69 class RenderWidgetHostImpl; |
70 class RenderWidgetHostInputEventRouter; | 70 class RenderWidgetHostInputEventRouter; |
71 class SavePackage; | 71 class SavePackage; |
72 class ScreenOrientationDispatcherHost; | 72 class ScreenOrientationDispatcherHost; |
73 class SiteInstance; | 73 class SiteInstance; |
74 class TestWebContents; | 74 class TestWebContents; |
75 class TextInputManager; | 75 class TextInputManager; |
76 class WakeLockServiceContext; | 76 class WakeLockServiceContext; |
77 class WebContentsAudioMuter; | 77 class WebContentsAudioMuter; |
| 78 class WebContentsBindingSet; |
78 class WebContentsDelegate; | 79 class WebContentsDelegate; |
79 class WebContentsImpl; | 80 class WebContentsImpl; |
80 class WebContentsView; | 81 class WebContentsView; |
81 class WebContentsViewDelegate; | 82 class WebContentsViewDelegate; |
82 struct AXEventNotificationDetails; | 83 struct AXEventNotificationDetails; |
83 struct ColorSuggestion; | 84 struct ColorSuggestion; |
84 struct FaviconURL; | 85 struct FaviconURL; |
85 struct LoadNotificationDetails; | 86 struct LoadNotificationDetails; |
86 struct MHTMLGenerationParams; | 87 struct MHTMLGenerationParams; |
87 struct ResourceRedirectDetails; | 88 struct ResourceRedirectDetails; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // Sets the zoom level for frames associated with this WebContents. | 240 // Sets the zoom level for frames associated with this WebContents. |
240 void UpdateZoom(double level); | 241 void UpdateZoom(double level); |
241 | 242 |
242 // Sets the zoom level for frames associated with this WebContents if it | 243 // Sets the zoom level for frames associated with this WebContents if it |
243 // matches |host| and (if non-empty) |scheme|. Matching is done on the | 244 // matches |host| and (if non-empty) |scheme|. Matching is done on the |
244 // last committed entry. | 245 // last committed entry. |
245 void UpdateZoomIfNecessary(const std::string& scheme, | 246 void UpdateZoomIfNecessary(const std::string& scheme, |
246 const std::string& host, | 247 const std::string& host, |
247 double level); | 248 double level); |
248 | 249 |
| 250 // Adds a new binding set to the WebContents. Returns a closure which may be |
| 251 // used to remove the binding set at any time. The closure is safe to call |
| 252 // even after WebContents destruction. |
| 253 // |
| 254 // |binding_set| is not owned and must either outlive this WebContents or be |
| 255 // explicitly removed before being destroyed. |
| 256 base::Closure AddBindingSet(const std::string& interface_name, |
| 257 WebContentsBindingSet* binding_set); |
| 258 |
249 // WebContents ------------------------------------------------------ | 259 // WebContents ------------------------------------------------------ |
250 WebContentsDelegate* GetDelegate() override; | 260 WebContentsDelegate* GetDelegate() override; |
251 void SetDelegate(WebContentsDelegate* delegate) override; | 261 void SetDelegate(WebContentsDelegate* delegate) override; |
252 NavigationControllerImpl& GetController() override; | 262 NavigationControllerImpl& GetController() override; |
253 const NavigationControllerImpl& GetController() const override; | 263 const NavigationControllerImpl& GetController() const override; |
254 BrowserContext* GetBrowserContext() const override; | 264 BrowserContext* GetBrowserContext() const override; |
255 const GURL& GetURL() const override; | 265 const GURL& GetURL() const override; |
256 const GURL& GetVisibleURL() const override; | 266 const GURL& GetVisibleURL() const override; |
257 const GURL& GetLastCommittedURL() const override; | 267 const GURL& GetLastCommittedURL() const override; |
258 RenderProcessHost* GetRenderProcessHost() const override; | 268 RenderProcessHost* GetRenderProcessHost() const override; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 430 |
421 // Implementation of PageNavigator. | 431 // Implementation of PageNavigator. |
422 WebContents* OpenURL(const OpenURLParams& params) override; | 432 WebContents* OpenURL(const OpenURLParams& params) override; |
423 | 433 |
424 // Implementation of IPC::Sender. | 434 // Implementation of IPC::Sender. |
425 bool Send(IPC::Message* message) override; | 435 bool Send(IPC::Message* message) override; |
426 | 436 |
427 // RenderFrameHostDelegate --------------------------------------------------- | 437 // RenderFrameHostDelegate --------------------------------------------------- |
428 bool OnMessageReceived(RenderFrameHost* render_frame_host, | 438 bool OnMessageReceived(RenderFrameHost* render_frame_host, |
429 const IPC::Message& message) override; | 439 const IPC::Message& message) override; |
| 440 void OnAssociatedInterfaceRequest( |
| 441 RenderFrameHost* render_frame_host, |
| 442 const std::string& interface_name, |
| 443 mojo::ScopedInterfaceEndpointHandle handle) override; |
430 const GURL& GetMainFrameLastCommittedURL() const override; | 444 const GURL& GetMainFrameLastCommittedURL() const override; |
431 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; | 445 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; |
432 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; | 446 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
433 void ShowContextMenu(RenderFrameHost* render_frame_host, | 447 void ShowContextMenu(RenderFrameHost* render_frame_host, |
434 const ContextMenuParams& params) override; | 448 const ContextMenuParams& params) override; |
435 void RunJavaScriptMessage(RenderFrameHost* render_frame_host, | 449 void RunJavaScriptMessage(RenderFrameHost* render_frame_host, |
436 const base::string16& message, | 450 const base::string16& message, |
437 const base::string16& default_prompt, | 451 const base::string16& default_prompt, |
438 const GURL& frame_url, | 452 const GURL& frame_url, |
439 JavaScriptMessageType type, | 453 JavaScriptMessageType type, |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 // corresponds to the name of a frame that the WebUI should be created for (or | 1112 // corresponds to the name of a frame that the WebUI should be created for (or |
1099 // the main frame if empty). | 1113 // the main frame if empty). |
1100 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); | 1114 WebUI* CreateWebUI(const GURL& url, const std::string& frame_name); |
1101 | 1115 |
1102 void SetJavaScriptDialogManagerForTesting( | 1116 void SetJavaScriptDialogManagerForTesting( |
1103 JavaScriptDialogManager* dialog_manager); | 1117 JavaScriptDialogManager* dialog_manager); |
1104 | 1118 |
1105 // Returns the FindRequestManager, or creates one if it doesn't already exist. | 1119 // Returns the FindRequestManager, or creates one if it doesn't already exist. |
1106 FindRequestManager* GetOrCreateFindRequestManager(); | 1120 FindRequestManager* GetOrCreateFindRequestManager(); |
1107 | 1121 |
| 1122 // Removes a registered WebContentsBindingSet by interface name. |
| 1123 void RemoveBindingSet(const std::string& interface_name); |
| 1124 |
1108 // Data for core operation --------------------------------------------------- | 1125 // Data for core operation --------------------------------------------------- |
1109 | 1126 |
1110 // Delegate for notifying our owner about stuff. Not owned by us. | 1127 // Delegate for notifying our owner about stuff. Not owned by us. |
1111 WebContentsDelegate* delegate_; | 1128 WebContentsDelegate* delegate_; |
1112 | 1129 |
1113 // Handles the back/forward list and loading. | 1130 // Handles the back/forward list and loading. |
1114 NavigationControllerImpl controller_; | 1131 NavigationControllerImpl controller_; |
1115 | 1132 |
1116 // The corresponding view. | 1133 // The corresponding view. |
1117 std::unique_ptr<WebContentsView> view_; | 1134 std::unique_ptr<WebContentsView> view_; |
(...skipping 14 matching lines...) Expand all Loading... |
1132 | 1149 |
1133 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>> | 1150 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>> |
1134 destruction_observers_; | 1151 destruction_observers_; |
1135 | 1152 |
1136 // A list of observers notified when page state changes. Weak references. | 1153 // A list of observers notified when page state changes. Weak references. |
1137 // This MUST be listed above frame_tree_ since at destruction time the | 1154 // This MUST be listed above frame_tree_ since at destruction time the |
1138 // latter might cause RenderViewHost's destructor to call us and we might use | 1155 // latter might cause RenderViewHost's destructor to call us and we might use |
1139 // the observer list then. | 1156 // the observer list then. |
1140 base::ObserverList<WebContentsObserver> observers_; | 1157 base::ObserverList<WebContentsObserver> observers_; |
1141 | 1158 |
| 1159 // Associated interface binding sets attached to this WebContents. |
| 1160 std::map<std::string, WebContentsBindingSet*> binding_sets_; |
| 1161 |
1142 // True if this tab was opened by another tab. This is not unset if the opener | 1162 // True if this tab was opened by another tab. This is not unset if the opener |
1143 // is closed. | 1163 // is closed. |
1144 bool created_with_opener_; | 1164 bool created_with_opener_; |
1145 | 1165 |
1146 // Helper classes ------------------------------------------------------------ | 1166 // Helper classes ------------------------------------------------------------ |
1147 | 1167 |
1148 // Manages the frame tree of the page and process swaps in each node. | 1168 // Manages the frame tree of the page and process swaps in each node. |
1149 FrameTree frame_tree_; | 1169 FrameTree frame_tree_; |
1150 | 1170 |
1151 // If this WebContents is part of a "tree of WebContents", then this contains | 1171 // If this WebContents is part of a "tree of WebContents", then this contains |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 // Adds/removes a callback called on creation of each new WebContents. | 1467 // Adds/removes a callback called on creation of each new WebContents. |
1448 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); | 1468 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
1449 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); | 1469 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
1450 | 1470 |
1451 DISALLOW_COPY_AND_ASSIGN(FriendZone); | 1471 DISALLOW_COPY_AND_ASSIGN(FriendZone); |
1452 }; | 1472 }; |
1453 | 1473 |
1454 } // namespace content | 1474 } // namespace content |
1455 | 1475 |
1456 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1476 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |