| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "content/browser/frame_host/frame_tree.h" | 18 #include "content/browser/frame_host/frame_tree.h" |
| 19 #include "content/browser/frame_host/navigation_controller_delegate.h" | 19 #include "content/browser/frame_host/navigation_controller_delegate.h" |
| 20 #include "content/browser/frame_host/navigation_controller_impl.h" | 20 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 21 #include "content/browser/frame_host/navigator_delegate.h" | 21 #include "content/browser/frame_host/navigator_delegate.h" |
| 22 #include "content/browser/frame_host/render_frame_host_delegate.h" | 22 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 23 #include "content/browser/frame_host/render_frame_host_manager.h" | 23 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 24 #include "content/browser/renderer_host/render_view_host_delegate.h" | 24 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 25 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 25 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 26 #include "content/common/accessibility_mode_enums.h" |
| 26 #include "content/common/content_export.h" | 27 #include "content/common/content_export.h" |
| 27 #include "content/public/browser/ax_event_notification_details.h" | 28 #include "content/public/browser/ax_event_notification_details.h" |
| 28 #include "content/public/browser/color_chooser.h" | 29 #include "content/public/browser/color_chooser.h" |
| 29 #include "content/public/browser/notification_observer.h" | 30 #include "content/public/browser/notification_observer.h" |
| 30 #include "content/public/browser/notification_registrar.h" | 31 #include "content/public/browser/notification_registrar.h" |
| 31 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/common/page_transition_types.h" | 33 #include "content/public/common/page_transition_types.h" |
| 33 #include "content/public/common/renderer_preferences.h" | 34 #include "content/public/common/renderer_preferences.h" |
| 34 #include "content/public/common/three_d_api_types.h" | 35 #include "content/public/common/three_d_api_types.h" |
| 35 #include "net/base/load_states.h" | 36 #include "net/base/load_states.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 public NotificationObserver, | 88 public NotificationObserver, |
| 88 public NON_EXPORTED_BASE(NavigationControllerDelegate), | 89 public NON_EXPORTED_BASE(NavigationControllerDelegate), |
| 89 public NON_EXPORTED_BASE(NavigatorDelegate) { | 90 public NON_EXPORTED_BASE(NavigatorDelegate) { |
| 90 public: | 91 public: |
| 91 virtual ~WebContentsImpl(); | 92 virtual ~WebContentsImpl(); |
| 92 | 93 |
| 93 static WebContentsImpl* CreateWithOpener( | 94 static WebContentsImpl* CreateWithOpener( |
| 94 const WebContents::CreateParams& params, | 95 const WebContents::CreateParams& params, |
| 95 WebContentsImpl* opener); | 96 WebContentsImpl* opener); |
| 96 | 97 |
| 98 static void GetAllWebContents( |
| 99 std::vector<WebContentsImpl*>* web_contents_vector); |
| 100 |
| 97 // Returns the opener WebContentsImpl, if any. This can be set to null if the | 101 // Returns the opener WebContentsImpl, if any. This can be set to null if the |
| 98 // opener is closed or the page clears its window.opener. | 102 // opener is closed or the page clears its window.opener. |
| 99 WebContentsImpl* opener() const { return opener_; } | 103 WebContentsImpl* opener() const { return opener_; } |
| 100 | 104 |
| 101 // Creates a WebContents to be used as a browser plugin guest. | 105 // Creates a WebContents to be used as a browser plugin guest. |
| 102 static BrowserPluginGuest* CreateGuest( | 106 static BrowserPluginGuest* CreateGuest( |
| 103 BrowserContext* browser_context, | 107 BrowserContext* browser_context, |
| 104 content::SiteInstance* site_instance, | 108 content::SiteInstance* site_instance, |
| 105 int guest_instance_id, | 109 int guest_instance_id, |
| 106 scoped_ptr<base::DictionaryValue> extra_params); | 110 scoped_ptr<base::DictionaryValue> extra_params); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void DidGetResourceResponseStart( | 164 void DidGetResourceResponseStart( |
| 161 const ResourceRequestDetails& details); | 165 const ResourceRequestDetails& details); |
| 162 | 166 |
| 163 // A redirect was received while requesting a resource. | 167 // A redirect was received while requesting a resource. |
| 164 void DidGetRedirectForResourceRequest( | 168 void DidGetRedirectForResourceRequest( |
| 165 RenderViewHost* render_view_host, | 169 RenderViewHost* render_view_host, |
| 166 const ResourceRedirectDetails& details); | 170 const ResourceRedirectDetails& details); |
| 167 | 171 |
| 168 WebContentsView* GetView() const; | 172 WebContentsView* GetView() const; |
| 169 | 173 |
| 174 // Broadcasts the mode change to all frames. |
| 175 void SetAccessibilityMode(AccessibilityMode mode); |
| 176 |
| 177 // Adds the given accessibility mode to the current accessibility mode |
| 178 // bitmap. |
| 179 void AddAccessibilityMode(AccessibilityMode mode); |
| 180 |
| 181 // Removes the given accessibility mode from the current accessibility |
| 182 // mode bitmap, managing the bits that are shared with other modes such |
| 183 // that a bit will only be turned off when all modes that depend on it |
| 184 // have been removed. |
| 185 void RemoveAccessibilityMode(AccessibilityMode mode); |
| 186 |
| 187 AccessibilityMode accessibility_mode() const { return accessibility_mode_; } |
| 188 |
| 170 // WebContents ------------------------------------------------------ | 189 // WebContents ------------------------------------------------------ |
| 171 virtual WebContentsDelegate* GetDelegate() OVERRIDE; | 190 virtual WebContentsDelegate* GetDelegate() OVERRIDE; |
| 172 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; | 191 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; |
| 173 virtual NavigationControllerImpl& GetController() OVERRIDE; | 192 virtual NavigationControllerImpl& GetController() OVERRIDE; |
| 174 virtual const NavigationControllerImpl& GetController() const OVERRIDE; | 193 virtual const NavigationControllerImpl& GetController() const OVERRIDE; |
| 175 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 194 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
| 176 virtual const GURL& GetURL() const OVERRIDE; | 195 virtual const GURL& GetURL() const OVERRIDE; |
| 177 virtual const GURL& GetVisibleURL() const OVERRIDE; | 196 virtual const GURL& GetVisibleURL() const OVERRIDE; |
| 178 virtual const GURL& GetLastCommittedURL() const OVERRIDE; | 197 virtual const GURL& GetLastCommittedURL() const OVERRIDE; |
| 179 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; | 198 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; |
| 180 virtual RenderFrameHost* GetMainFrame() OVERRIDE; | 199 virtual RenderFrameHost* GetMainFrame() OVERRIDE; |
| 181 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; | 200 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; |
| 182 virtual void ForEachFrame( | 201 virtual void ForEachFrame( |
| 183 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; | 202 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; |
| 184 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; | 203 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; |
| 185 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; | 204 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; |
| 186 virtual WebContents* GetEmbedderWebContents() const OVERRIDE; | 205 virtual WebContents* GetEmbedderWebContents() const OVERRIDE; |
| 187 virtual int GetEmbeddedInstanceID() const OVERRIDE; | 206 virtual int GetEmbeddedInstanceID() const OVERRIDE; |
| 188 virtual int GetRoutingID() const OVERRIDE; | 207 virtual int GetRoutingID() const OVERRIDE; |
| 189 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; | 208 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; |
| 190 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const | 209 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const |
| 191 OVERRIDE; | 210 OVERRIDE; |
| 192 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; | 211 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; |
| 193 virtual WebUI* GetWebUI() const OVERRIDE; | 212 virtual WebUI* GetWebUI() const OVERRIDE; |
| 194 virtual WebUI* GetCommittedWebUI() const OVERRIDE; | 213 virtual WebUI* GetCommittedWebUI() const OVERRIDE; |
| 195 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; | 214 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; |
| 196 virtual const std::string& GetUserAgentOverride() const OVERRIDE; | 215 virtual const std::string& GetUserAgentOverride() const OVERRIDE; |
| 216 virtual void EnableTreeOnlyAccessibilityMode() OVERRIDE; |
| 217 virtual bool IsTreeOnlyAccessibilityModeForTesting() const OVERRIDE; |
| 218 virtual bool IsFullAccessibilityModeForTesting() const OVERRIDE; |
| 197 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
| 198 virtual void SetParentNativeViewAccessible( | 220 virtual void SetParentNativeViewAccessible( |
| 199 gfx::NativeViewAccessible accessible_parent) OVERRIDE; | 221 gfx::NativeViewAccessible accessible_parent) OVERRIDE; |
| 200 #endif | 222 #endif |
| 201 virtual const base::string16& GetTitle() const OVERRIDE; | 223 virtual const base::string16& GetTitle() const OVERRIDE; |
| 202 virtual int32 GetMaxPageID() OVERRIDE; | 224 virtual int32 GetMaxPageID() OVERRIDE; |
| 203 virtual int32 GetMaxPageIDForSiteInstance( | 225 virtual int32 GetMaxPageIDForSiteInstance( |
| 204 SiteInstance* site_instance) OVERRIDE; | 226 SiteInstance* site_instance) OVERRIDE; |
| 205 virtual SiteInstance* GetSiteInstance() const OVERRIDE; | 227 virtual SiteInstance* GetSiteInstance() const OVERRIDE; |
| 206 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; | 228 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 virtual void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host, | 367 virtual void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host, |
| 346 const base::string16& message, | 368 const base::string16& message, |
| 347 bool is_reload, | 369 bool is_reload, |
| 348 IPC::Message* reply_msg) OVERRIDE; | 370 IPC::Message* reply_msg) OVERRIDE; |
| 349 virtual void DidAccessInitialDocument() OVERRIDE; | 371 virtual void DidAccessInitialDocument() OVERRIDE; |
| 350 virtual void DidDisownOpener(RenderFrameHost* render_frame_host) OVERRIDE; | 372 virtual void DidDisownOpener(RenderFrameHost* render_frame_host) OVERRIDE; |
| 351 virtual void DocumentOnLoadCompleted( | 373 virtual void DocumentOnLoadCompleted( |
| 352 RenderFrameHost* render_frame_host) OVERRIDE; | 374 RenderFrameHost* render_frame_host) OVERRIDE; |
| 353 virtual WebContents* GetAsWebContents() OVERRIDE; | 375 virtual WebContents* GetAsWebContents() OVERRIDE; |
| 354 virtual bool IsNeverVisible() OVERRIDE; | 376 virtual bool IsNeverVisible() OVERRIDE; |
| 377 virtual AccessibilityMode GetAccessibilityMode() const OVERRIDE; |
| 378 virtual void AccessibilityEventReceived( |
| 379 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; |
| 380 #if defined(OS_WIN) |
| 381 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; |
| 382 #endif |
| 355 | 383 |
| 356 // RenderViewHostDelegate ---------------------------------------------------- | 384 // RenderViewHostDelegate ---------------------------------------------------- |
| 357 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; | 385 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; |
| 358 virtual bool OnMessageReceived(RenderViewHost* render_view_host, | 386 virtual bool OnMessageReceived(RenderViewHost* render_view_host, |
| 359 const IPC::Message& message) OVERRIDE; | 387 const IPC::Message& message) OVERRIDE; |
| 360 // RenderFrameHostDelegate has the same method, so list it there because this | 388 // RenderFrameHostDelegate has the same method, so list it there because this |
| 361 // interface is going away. | 389 // interface is going away. |
| 362 // virtual WebContents* GetAsWebContents() OVERRIDE; | 390 // virtual WebContents* GetAsWebContents() OVERRIDE; |
| 363 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | 391 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
| 364 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 392 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 bool user_gesture) OVERRIDE; | 467 bool user_gesture) OVERRIDE; |
| 440 virtual void ShowCreatedWidget(int route_id, | 468 virtual void ShowCreatedWidget(int route_id, |
| 441 const gfx::Rect& initial_pos) OVERRIDE; | 469 const gfx::Rect& initial_pos) OVERRIDE; |
| 442 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; | 470 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
| 443 virtual void RequestMediaAccessPermission( | 471 virtual void RequestMediaAccessPermission( |
| 444 const MediaStreamRequest& request, | 472 const MediaStreamRequest& request, |
| 445 const MediaResponseCallback& callback) OVERRIDE; | 473 const MediaResponseCallback& callback) OVERRIDE; |
| 446 virtual SessionStorageNamespace* GetSessionStorageNamespace( | 474 virtual SessionStorageNamespace* GetSessionStorageNamespace( |
| 447 SiteInstance* instance) OVERRIDE; | 475 SiteInstance* instance) OVERRIDE; |
| 448 virtual FrameTree* GetFrameTree() OVERRIDE; | 476 virtual FrameTree* GetFrameTree() OVERRIDE; |
| 449 virtual void AccessibilityEventReceived( | |
| 450 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; | |
| 451 | 477 |
| 452 // NavigatorDelegate --------------------------------------------------------- | 478 // NavigatorDelegate --------------------------------------------------------- |
| 453 | 479 |
| 454 virtual void DidStartProvisionalLoad( | 480 virtual void DidStartProvisionalLoad( |
| 455 RenderFrameHostImpl* render_frame_host, | 481 RenderFrameHostImpl* render_frame_host, |
| 456 int parent_routing_id, | 482 int parent_routing_id, |
| 457 const GURL& validated_url, | 483 const GURL& validated_url, |
| 458 bool is_error_page, | 484 bool is_error_page, |
| 459 bool is_iframe_srcdoc) OVERRIDE; | 485 bool is_iframe_srcdoc) OVERRIDE; |
| 460 virtual void DidFailProvisionalLoadWithError( | 486 virtual void DidFailProvisionalLoadWithError( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 bool* is_keyboard_shortcut) OVERRIDE; | 533 bool* is_keyboard_shortcut) OVERRIDE; |
| 508 virtual void HandleKeyboardEvent( | 534 virtual void HandleKeyboardEvent( |
| 509 const NativeWebKeyboardEvent& event) OVERRIDE; | 535 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 510 virtual bool HandleWheelEvent( | 536 virtual bool HandleWheelEvent( |
| 511 const blink::WebMouseWheelEvent& event) OVERRIDE; | 537 const blink::WebMouseWheelEvent& event) OVERRIDE; |
| 512 virtual bool PreHandleGestureEvent( | 538 virtual bool PreHandleGestureEvent( |
| 513 const blink::WebGestureEvent& event) OVERRIDE; | 539 const blink::WebGestureEvent& event) OVERRIDE; |
| 514 virtual bool HandleGestureEvent( | 540 virtual bool HandleGestureEvent( |
| 515 const blink::WebGestureEvent& event) OVERRIDE; | 541 const blink::WebGestureEvent& event) OVERRIDE; |
| 516 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; | 542 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; |
| 517 #if defined(OS_WIN) | |
| 518 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; | |
| 519 #endif | |
| 520 | 543 |
| 521 // RenderFrameHostManager::Delegate ------------------------------------------ | 544 // RenderFrameHostManager::Delegate ------------------------------------------ |
| 522 | 545 |
| 523 virtual bool CreateRenderViewForRenderManager( | 546 virtual bool CreateRenderViewForRenderManager( |
| 524 RenderViewHost* render_view_host, | 547 RenderViewHost* render_view_host, |
| 525 int opener_route_id, | 548 int opener_route_id, |
| 526 CrossProcessFrameConnector* frame_connector) OVERRIDE; | 549 CrossProcessFrameConnector* frame_connector) OVERRIDE; |
| 527 virtual void BeforeUnloadFiredFromRenderManager( | 550 virtual void BeforeUnloadFiredFromRenderManager( |
| 528 bool proceed, const base::TimeTicks& proceed_time, | 551 bool proceed, const base::TimeTicks& proceed_time, |
| 529 bool* proceed_to_fire_unload) OVERRIDE; | 552 bool* proceed_to_fire_unload) OVERRIDE; |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; | 1112 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; |
| 1090 ImageDownloadMap image_download_map_; | 1113 ImageDownloadMap image_download_map_; |
| 1091 | 1114 |
| 1092 // Whether this WebContents is responsible for displaying a subframe in a | 1115 // Whether this WebContents is responsible for displaying a subframe in a |
| 1093 // different process from its parent page. | 1116 // different process from its parent page. |
| 1094 bool is_subframe_; | 1117 bool is_subframe_; |
| 1095 | 1118 |
| 1096 // Whether the last JavaScript dialog shown was suppressed. Used for testing. | 1119 // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
| 1097 bool last_dialog_suppressed_; | 1120 bool last_dialog_suppressed_; |
| 1098 | 1121 |
| 1122 // The accssibility mode for all frames. This is queried when each frame |
| 1123 // is created, and broadcast to all frames when it changes. |
| 1124 AccessibilityMode accessibility_mode_; |
| 1125 |
| 1099 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 1126 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
| 1100 }; | 1127 }; |
| 1101 | 1128 |
| 1102 } // namespace content | 1129 } // namespace content |
| 1103 | 1130 |
| 1104 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1131 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |