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