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/color_chooser.h" | 28 #include "content/public/browser/color_chooser.h" |
28 #include "content/public/browser/notification_observer.h" | 29 #include "content/public/browser/notification_observer.h" |
29 #include "content/public/browser/notification_registrar.h" | 30 #include "content/public/browser/notification_registrar.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
31 #include "content/public/common/page_transition_types.h" | 32 #include "content/public/common/page_transition_types.h" |
32 #include "content/public/common/renderer_preferences.h" | 33 #include "content/public/common/renderer_preferences.h" |
33 #include "content/public/common/resource_type.h" | 34 #include "content/public/common/resource_type.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 public NotificationObserver, | 90 public NotificationObserver, |
90 public NON_EXPORTED_BASE(NavigationControllerDelegate), | 91 public NON_EXPORTED_BASE(NavigationControllerDelegate), |
91 public NON_EXPORTED_BASE(NavigatorDelegate) { | 92 public NON_EXPORTED_BASE(NavigatorDelegate) { |
92 public: | 93 public: |
93 virtual ~WebContentsImpl(); | 94 virtual ~WebContentsImpl(); |
94 | 95 |
95 static WebContentsImpl* CreateWithOpener( | 96 static WebContentsImpl* CreateWithOpener( |
96 const WebContents::CreateParams& params, | 97 const WebContents::CreateParams& params, |
97 WebContentsImpl* opener); | 98 WebContentsImpl* opener); |
98 | 99 |
| 100 static std::vector<WebContentsImpl*> GetAllWebContents(); |
| 101 |
99 // Returns the opener WebContentsImpl, if any. This can be set to null if the | 102 // Returns the opener WebContentsImpl, if any. This can be set to null if the |
100 // opener is closed or the page clears its window.opener. | 103 // opener is closed or the page clears its window.opener. |
101 WebContentsImpl* opener() const { return opener_; } | 104 WebContentsImpl* opener() const { return opener_; } |
102 | 105 |
103 // Creates a swapped out RenderView. This is used by the browser plugin to | 106 // Creates a swapped out RenderView. This is used by the browser plugin to |
104 // create a swapped out RenderView in the embedder render process for the | 107 // create a swapped out RenderView in the embedder render process for the |
105 // guest, to expose the guest's window object to the embedder. | 108 // guest, to expose the guest's window object to the embedder. |
106 // This returns the routing ID of the newly created swapped out RenderView. | 109 // This returns the routing ID of the newly created swapped out RenderView. |
107 int CreateSwappedOutRenderView(SiteInstance* instance); | 110 int CreateSwappedOutRenderView(SiteInstance* instance); |
108 | 111 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 GeolocationDispatcherHost* geolocation_dispatcher_host() { | 168 GeolocationDispatcherHost* geolocation_dispatcher_host() { |
166 return geolocation_dispatcher_host_.get(); | 169 return geolocation_dispatcher_host_.get(); |
167 } | 170 } |
168 | 171 |
169 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host() { | 172 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host() { |
170 return screen_orientation_dispatcher_host_.get(); | 173 return screen_orientation_dispatcher_host_.get(); |
171 } | 174 } |
172 | 175 |
173 bool should_normally_be_visible() { return should_normally_be_visible_; } | 176 bool should_normally_be_visible() { return should_normally_be_visible_; } |
174 | 177 |
| 178 // Broadcasts the mode change to all frames. |
| 179 void SetAccessibilityMode(AccessibilityMode mode); |
| 180 |
| 181 // Adds the given accessibility mode to the current accessibility mode |
| 182 // bitmap. |
| 183 void AddAccessibilityMode(AccessibilityMode mode); |
| 184 |
| 185 // Removes the given accessibility mode from the current accessibility |
| 186 // mode bitmap, managing the bits that are shared with other modes such |
| 187 // that a bit will only be turned off when all modes that depend on it |
| 188 // have been removed. |
| 189 void RemoveAccessibilityMode(AccessibilityMode mode); |
| 190 |
175 // WebContents ------------------------------------------------------ | 191 // WebContents ------------------------------------------------------ |
176 virtual WebContentsDelegate* GetDelegate() OVERRIDE; | 192 virtual WebContentsDelegate* GetDelegate() OVERRIDE; |
177 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; | 193 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; |
178 virtual NavigationControllerImpl& GetController() OVERRIDE; | 194 virtual NavigationControllerImpl& GetController() OVERRIDE; |
179 virtual const NavigationControllerImpl& GetController() const OVERRIDE; | 195 virtual const NavigationControllerImpl& GetController() const OVERRIDE; |
180 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 196 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
181 virtual const GURL& GetURL() const OVERRIDE; | 197 virtual const GURL& GetURL() const OVERRIDE; |
182 virtual const GURL& GetVisibleURL() const OVERRIDE; | 198 virtual const GURL& GetVisibleURL() const OVERRIDE; |
183 virtual const GURL& GetLastCommittedURL() const OVERRIDE; | 199 virtual const GURL& GetLastCommittedURL() const OVERRIDE; |
184 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; | 200 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; |
185 virtual RenderFrameHost* GetMainFrame() OVERRIDE; | 201 virtual RenderFrameHost* GetMainFrame() OVERRIDE; |
186 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; | 202 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; |
187 virtual void ForEachFrame( | 203 virtual void ForEachFrame( |
188 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; | 204 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; |
189 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; | 205 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; |
190 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; | 206 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; |
191 virtual int GetRoutingID() const OVERRIDE; | 207 virtual int GetRoutingID() const OVERRIDE; |
192 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; | 208 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; |
193 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const | 209 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const |
194 OVERRIDE; | 210 OVERRIDE; |
195 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; | 211 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; |
196 virtual WebUI* GetWebUI() const OVERRIDE; | 212 virtual WebUI* GetWebUI() const OVERRIDE; |
197 virtual WebUI* GetCommittedWebUI() const OVERRIDE; | 213 virtual WebUI* GetCommittedWebUI() const OVERRIDE; |
198 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; | 214 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; |
199 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; |
200 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
201 virtual void SetParentNativeViewAccessible( | 220 virtual void SetParentNativeViewAccessible( |
202 gfx::NativeViewAccessible accessible_parent) OVERRIDE; | 221 gfx::NativeViewAccessible accessible_parent) OVERRIDE; |
203 #endif | 222 #endif |
204 virtual const base::string16& GetTitle() const OVERRIDE; | 223 virtual const base::string16& GetTitle() const OVERRIDE; |
205 virtual int32 GetMaxPageID() OVERRIDE; | 224 virtual int32 GetMaxPageID() OVERRIDE; |
206 virtual int32 GetMaxPageIDForSiteInstance( | 225 virtual int32 GetMaxPageIDForSiteInstance( |
207 SiteInstance* site_instance) OVERRIDE; | 226 SiteInstance* site_instance) OVERRIDE; |
208 virtual SiteInstance* GetSiteInstance() const OVERRIDE; | 227 virtual SiteInstance* GetSiteInstance() const OVERRIDE; |
209 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; | 228 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 virtual void DocumentOnLoadCompleted( | 370 virtual void DocumentOnLoadCompleted( |
352 RenderFrameHost* render_frame_host) OVERRIDE; | 371 RenderFrameHost* render_frame_host) OVERRIDE; |
353 virtual void UpdateTitle(RenderFrameHost* render_frame_host, | 372 virtual void UpdateTitle(RenderFrameHost* render_frame_host, |
354 int32 page_id, | 373 int32 page_id, |
355 const base::string16& title, | 374 const base::string16& title, |
356 base::i18n::TextDirection title_direction) OVERRIDE; | 375 base::i18n::TextDirection title_direction) OVERRIDE; |
357 virtual void UpdateEncoding(RenderFrameHost* render_frame_host, | 376 virtual void UpdateEncoding(RenderFrameHost* render_frame_host, |
358 const std::string& encoding) OVERRIDE; | 377 const std::string& encoding) OVERRIDE; |
359 virtual WebContents* GetAsWebContents() OVERRIDE; | 378 virtual WebContents* GetAsWebContents() OVERRIDE; |
360 virtual bool IsNeverVisible() OVERRIDE; | 379 virtual bool IsNeverVisible() OVERRIDE; |
| 380 virtual AccessibilityMode GetAccessibilityMode() const OVERRIDE; |
| 381 virtual void AccessibilityEventReceived( |
| 382 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; |
| 383 #if defined(OS_WIN) |
| 384 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; |
| 385 #endif |
361 | 386 |
362 // RenderViewHostDelegate ---------------------------------------------------- | 387 // RenderViewHostDelegate ---------------------------------------------------- |
363 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; | 388 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; |
364 virtual bool OnMessageReceived(RenderViewHost* render_view_host, | 389 virtual bool OnMessageReceived(RenderViewHost* render_view_host, |
365 const IPC::Message& message) OVERRIDE; | 390 const IPC::Message& message) OVERRIDE; |
366 // RenderFrameHostDelegate has the same method, so list it there because this | 391 // RenderFrameHostDelegate has the same method, so list it there because this |
367 // interface is going away. | 392 // interface is going away. |
368 // virtual WebContents* GetAsWebContents() OVERRIDE; | 393 // virtual WebContents* GetAsWebContents() OVERRIDE; |
369 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | 394 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
370 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 395 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 virtual void ShowCreatedWidget(int route_id, | 464 virtual void ShowCreatedWidget(int route_id, |
440 const gfx::Rect& initial_pos) OVERRIDE; | 465 const gfx::Rect& initial_pos) OVERRIDE; |
441 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; | 466 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
442 virtual void RequestMediaAccessPermission( | 467 virtual void RequestMediaAccessPermission( |
443 const MediaStreamRequest& request, | 468 const MediaStreamRequest& request, |
444 const MediaResponseCallback& callback) OVERRIDE; | 469 const MediaResponseCallback& callback) OVERRIDE; |
445 virtual SessionStorageNamespace* GetSessionStorageNamespace( | 470 virtual SessionStorageNamespace* GetSessionStorageNamespace( |
446 SiteInstance* instance) OVERRIDE; | 471 SiteInstance* instance) OVERRIDE; |
447 virtual SessionStorageNamespaceMap GetSessionStorageNamespaceMap() OVERRIDE; | 472 virtual SessionStorageNamespaceMap GetSessionStorageNamespaceMap() OVERRIDE; |
448 virtual FrameTree* GetFrameTree() OVERRIDE; | 473 virtual FrameTree* GetFrameTree() OVERRIDE; |
449 virtual void AccessibilityEventReceived( | |
450 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; | |
451 | 474 |
452 // NavigatorDelegate --------------------------------------------------------- | 475 // NavigatorDelegate --------------------------------------------------------- |
453 | 476 |
454 virtual void DidStartProvisionalLoad( | 477 virtual void DidStartProvisionalLoad( |
455 RenderFrameHostImpl* render_frame_host, | 478 RenderFrameHostImpl* render_frame_host, |
456 const GURL& validated_url, | 479 const GURL& validated_url, |
457 bool is_error_page, | 480 bool is_error_page, |
458 bool is_iframe_srcdoc) OVERRIDE; | 481 bool is_iframe_srcdoc) OVERRIDE; |
459 virtual void DidFailProvisionalLoadWithError( | 482 virtual void DidFailProvisionalLoadWithError( |
460 RenderFrameHostImpl* render_frame_host, | 483 RenderFrameHostImpl* render_frame_host, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 virtual void HandleKeyboardEvent( | 528 virtual void HandleKeyboardEvent( |
506 const NativeWebKeyboardEvent& event) OVERRIDE; | 529 const NativeWebKeyboardEvent& event) OVERRIDE; |
507 virtual bool HandleWheelEvent( | 530 virtual bool HandleWheelEvent( |
508 const blink::WebMouseWheelEvent& event) OVERRIDE; | 531 const blink::WebMouseWheelEvent& event) OVERRIDE; |
509 virtual bool PreHandleGestureEvent( | 532 virtual bool PreHandleGestureEvent( |
510 const blink::WebGestureEvent& event) OVERRIDE; | 533 const blink::WebGestureEvent& event) OVERRIDE; |
511 virtual bool HandleGestureEvent( | 534 virtual bool HandleGestureEvent( |
512 const blink::WebGestureEvent& event) OVERRIDE; | 535 const blink::WebGestureEvent& event) OVERRIDE; |
513 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; | 536 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; |
514 virtual void OnTouchEmulationEnabled(bool enabled) OVERRIDE; | 537 virtual void OnTouchEmulationEnabled(bool enabled) OVERRIDE; |
515 #if defined(OS_WIN) | 538 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() |
516 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; | 539 OVERRIDE; |
517 #endif | 540 virtual BrowserAccessibilityManager* |
| 541 GetOrCreateRootBrowserAccessibilityManager() OVERRIDE; |
518 | 542 |
519 // RenderFrameHostManager::Delegate ------------------------------------------ | 543 // RenderFrameHostManager::Delegate ------------------------------------------ |
520 | 544 |
521 virtual bool CreateRenderViewForRenderManager( | 545 virtual bool CreateRenderViewForRenderManager( |
522 RenderViewHost* render_view_host, | 546 RenderViewHost* render_view_host, |
523 int opener_route_id, | 547 int opener_route_id, |
524 int proxy_routing_id, | 548 int proxy_routing_id, |
525 bool for_main_frame) OVERRIDE; | 549 bool for_main_frame) OVERRIDE; |
526 virtual void BeforeUnloadFiredFromRenderManager( | 550 virtual void BeforeUnloadFiredFromRenderManager( |
527 bool proceed, const base::TimeTicks& proceed_time, | 551 bool proceed, const base::TimeTicks& proceed_time, |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 // Whether the last JavaScript dialog shown was suppressed. Used for testing. | 1174 // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
1151 bool last_dialog_suppressed_; | 1175 bool last_dialog_suppressed_; |
1152 | 1176 |
1153 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_; | 1177 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_; |
1154 | 1178 |
1155 scoped_ptr<MidiDispatcherHost> midi_dispatcher_host_; | 1179 scoped_ptr<MidiDispatcherHost> midi_dispatcher_host_; |
1156 | 1180 |
1157 scoped_ptr<ScreenOrientationDispatcherHost> | 1181 scoped_ptr<ScreenOrientationDispatcherHost> |
1158 screen_orientation_dispatcher_host_; | 1182 screen_orientation_dispatcher_host_; |
1159 | 1183 |
| 1184 // The accessibility mode for all frames. This is queried when each frame |
| 1185 // is created, and broadcast to all frames when it changes. |
| 1186 AccessibilityMode accessibility_mode_; |
| 1187 |
1160 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 1188 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
1161 }; | 1189 }; |
1162 | 1190 |
1163 } // namespace content | 1191 } // namespace content |
1164 | 1192 |
1165 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1193 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |