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