OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_RENDER_FRAME_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
| 17 #include "content/common/accessibility_mode_enums.h" |
17 #include "content/public/common/javascript_message_type.h" | 18 #include "content/public/common/javascript_message_type.h" |
18 #include "content/public/common/referrer.h" | 19 #include "content/public/common/referrer.h" |
19 #include "content/public/renderer/render_frame.h" | 20 #include "content/public/renderer/render_frame.h" |
20 #include "content/renderer/media/webmediaplayer_delegate.h" | 21 #include "content/renderer/media/webmediaplayer_delegate.h" |
21 #include "content/renderer/renderer_webcookiejar_impl.h" | 22 #include "content/renderer/renderer_webcookiejar_impl.h" |
22 #include "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
| 24 #include "third_party/WebKit/public/web/WebAXObject.h" |
23 #include "third_party/WebKit/public/web/WebDataSource.h" | 25 #include "third_party/WebKit/public/web/WebDataSource.h" |
24 #include "third_party/WebKit/public/web/WebFrameClient.h" | 26 #include "third_party/WebKit/public/web/WebFrameClient.h" |
25 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 27 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
26 #include "ui/gfx/range/range.h" | 28 #include "ui/gfx/range/range.h" |
27 | 29 |
28 class TransportDIB; | 30 class TransportDIB; |
29 struct FrameMsg_BuffersSwapped_Params; | 31 struct FrameMsg_BuffersSwapped_Params; |
30 struct FrameMsg_CompositorFrameSwapped_Params; | 32 struct FrameMsg_CompositorFrameSwapped_Params; |
31 struct FrameMsg_Navigate_Params; | 33 struct FrameMsg_Navigate_Params; |
32 | 34 |
(...skipping 16 matching lines...) Expand all Loading... |
49 class Range; | 51 class Range; |
50 class Rect; | 52 class Rect; |
51 } | 53 } |
52 | 54 |
53 namespace content { | 55 namespace content { |
54 | 56 |
55 class ChildFrameCompositingHelper; | 57 class ChildFrameCompositingHelper; |
56 class MediaStreamClient; | 58 class MediaStreamClient; |
57 class NotificationProvider; | 59 class NotificationProvider; |
58 class PepperPluginInstanceImpl; | 60 class PepperPluginInstanceImpl; |
| 61 class RendererAccessibility; |
59 class RendererPpapiHost; | 62 class RendererPpapiHost; |
60 class RenderFrameObserver; | 63 class RenderFrameObserver; |
61 class RenderViewImpl; | 64 class RenderViewImpl; |
62 class RenderWidget; | 65 class RenderWidget; |
63 class RenderWidgetFullscreenPepper; | 66 class RenderWidgetFullscreenPepper; |
64 struct CustomContextMenuContext; | 67 struct CustomContextMenuContext; |
65 | 68 |
66 class CONTENT_EXPORT RenderFrameImpl | 69 class CONTENT_EXPORT RenderFrameImpl |
67 : public RenderFrame, | 70 : public RenderFrame, |
68 NON_EXPORTED_BASE(public blink::WebFrameClient), | 71 NON_EXPORTED_BASE(public blink::WebFrameClient), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Start/Stop loading notifications. | 119 // Start/Stop loading notifications. |
117 // TODO(nasko): Those are page-level methods at this time and come from | 120 // TODO(nasko): Those are page-level methods at this time and come from |
118 // WebViewClient. We should move them to be WebFrameClient calls and put | 121 // WebViewClient. We should move them to be WebFrameClient calls and put |
119 // logic in the browser side to balance starts/stops. | 122 // logic in the browser side to balance starts/stops. |
120 // |to_different_document| will be true unless the load is a fragment | 123 // |to_different_document| will be true unless the load is a fragment |
121 // navigation, or triggered by history.pushState/replaceState. | 124 // navigation, or triggered by history.pushState/replaceState. |
122 virtual void didStartLoading(bool to_different_document); | 125 virtual void didStartLoading(bool to_different_document); |
123 virtual void didStopLoading(); | 126 virtual void didStopLoading(); |
124 virtual void didChangeLoadProgress(double load_progress); | 127 virtual void didChangeLoadProgress(double load_progress); |
125 | 128 |
| 129 AccessibilityMode accessibility_mode() { |
| 130 return accessibility_mode_; |
| 131 } |
| 132 |
| 133 RendererAccessibility* renderer_accessibility() { |
| 134 return renderer_accessibility_; |
| 135 } |
| 136 |
| 137 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, |
| 138 blink::WebAXEvent event); |
| 139 |
| 140 // TODO(dmazzoni): the only reason this is here is to plumb it through to |
| 141 // RendererAccessibility. It should be part of RenderFrameObserver, once |
| 142 // blink has a separate accessibility tree per frame. |
| 143 void FocusedNodeChanged(const blink::WebNode& node); |
| 144 |
126 #if defined(ENABLE_PLUGINS) | 145 #if defined(ENABLE_PLUGINS) |
127 // Notification that a PPAPI plugin has been created. | 146 // Notification that a PPAPI plugin has been created. |
128 void PepperPluginCreated(RendererPpapiHost* host); | 147 void PepperPluginCreated(RendererPpapiHost* host); |
129 | 148 |
130 // Notifies that |instance| has changed the cursor. | 149 // Notifies that |instance| has changed the cursor. |
131 // This will update the cursor appearance if it is currently over the plugin | 150 // This will update the cursor appearance if it is currently over the plugin |
132 // instance. | 151 // instance. |
133 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, | 152 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, |
134 const blink::WebCursorInfo& cursor); | 153 const blink::WebCursorInfo& cursor); |
135 | 154 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 396 |
378 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move | 397 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move |
379 // this back to private member. | 398 // this back to private member. |
380 void OnNavigate(const FrameMsg_Navigate_Params& params); | 399 void OnNavigate(const FrameMsg_Navigate_Params& params); |
381 | 400 |
382 protected: | 401 protected: |
383 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); | 402 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
384 | 403 |
385 private: | 404 private: |
386 friend class RenderFrameObserver; | 405 friend class RenderFrameObserver; |
| 406 friend class RendererAccessibilityTest; |
| 407 friend class RenderViewImplTest; |
387 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest, | 408 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest, |
388 AccessibilityMessagesQueueWhileSwappedOut); | 409 AccessibilityMessagesQueueWhileSwappedOut); |
389 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, | 410 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, |
390 ShouldUpdateSelectionTextFromContextMenuParams); | 411 ShouldUpdateSelectionTextFromContextMenuParams); |
391 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 412 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
392 OnExtendSelectionAndDelete); | 413 OnExtendSelectionAndDelete); |
393 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut); | 414 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut); |
394 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK); | 415 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK); |
395 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 416 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
396 SetEditableSelectionAndComposition); | 417 SetEditableSelectionAndComposition); |
| 418 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 419 OnSetAccessibilityMode); |
397 | 420 |
398 typedef std::map<GURL, double> HostZoomLevels; | 421 typedef std::map<GURL, double> HostZoomLevels; |
399 | 422 |
400 // Functions to add and remove observers for this object. | 423 // Functions to add and remove observers for this object. |
401 void AddObserver(RenderFrameObserver* observer); | 424 void AddObserver(RenderFrameObserver* observer); |
402 void RemoveObserver(RenderFrameObserver* observer); | 425 void RemoveObserver(RenderFrameObserver* observer); |
403 | 426 |
404 void UpdateURL(blink::WebFrame* frame); | 427 void UpdateURL(blink::WebFrame* frame); |
405 | 428 |
406 // Gets the focused element. If no such element exists then the element will | 429 // Gets the focused element. If no such element exists then the element will |
(...skipping 28 matching lines...) Expand all Loading... |
435 void OnCSSInsertRequest(const std::string& css); | 458 void OnCSSInsertRequest(const std::string& css); |
436 void OnJavaScriptExecuteRequest(const base::string16& javascript, | 459 void OnJavaScriptExecuteRequest(const base::string16& javascript, |
437 int id, | 460 int id, |
438 bool notify_result); | 461 bool notify_result); |
439 void OnSetEditableSelectionOffsets(int start, int end); | 462 void OnSetEditableSelectionOffsets(int start, int end); |
440 void OnSetCompositionFromExistingText( | 463 void OnSetCompositionFromExistingText( |
441 int start, int end, | 464 int start, int end, |
442 const std::vector<blink::WebCompositionUnderline>& underlines); | 465 const std::vector<blink::WebCompositionUnderline>& underlines); |
443 void OnExtendSelectionAndDelete(int before, int after); | 466 void OnExtendSelectionAndDelete(int before, int after); |
444 void OnReload(bool ignore_cache); | 467 void OnReload(bool ignore_cache); |
| 468 void OnSetAccessibilityMode(AccessibilityMode new_mode); |
445 #if defined(OS_MACOSX) | 469 #if defined(OS_MACOSX) |
446 void OnCopyToFindPboard(); | 470 void OnCopyToFindPboard(); |
447 #endif | 471 #endif |
448 | 472 |
449 // Virtual since overridden by WebTestProxy for layout tests. | 473 // Virtual since overridden by WebTestProxy for layout tests. |
450 virtual blink::WebNavigationPolicy DecidePolicyForNavigation( | 474 virtual blink::WebNavigationPolicy DecidePolicyForNavigation( |
451 RenderFrame* render_frame, | 475 RenderFrame* render_frame, |
452 blink::WebFrame* frame, | 476 blink::WebFrame* frame, |
453 blink::WebDataSource::ExtraData* extraData, | 477 blink::WebDataSource::ExtraData* extraData, |
454 const blink::WebURLRequest& request, | 478 const blink::WebURLRequest& request, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // along with the RenderFrame automatically. This is why we just store weak | 596 // along with the RenderFrame automatically. This is why we just store weak |
573 // references. | 597 // references. |
574 | 598 |
575 // Holds a reference to the service which provides desktop notifications. | 599 // Holds a reference to the service which provides desktop notifications. |
576 NotificationProvider* notification_provider_; | 600 NotificationProvider* notification_provider_; |
577 | 601 |
578 // MediaStreamClient attached to this frame; lazily initialized. | 602 // MediaStreamClient attached to this frame; lazily initialized. |
579 MediaStreamClient* media_stream_client_; | 603 MediaStreamClient* media_stream_client_; |
580 blink::WebUserMediaClient* web_user_media_client_; | 604 blink::WebUserMediaClient* web_user_media_client_; |
581 | 605 |
| 606 // The current accessibility mode. |
| 607 AccessibilityMode accessibility_mode_; |
| 608 |
| 609 // Only valid if |accessibility_mode_| is anything other than |
| 610 // AccessibilityModeOff. |
| 611 RendererAccessibility* renderer_accessibility_; |
| 612 |
582 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 613 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
583 | 614 |
584 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 615 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
585 }; | 616 }; |
586 | 617 |
587 } // namespace content | 618 } // namespace content |
588 | 619 |
589 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 620 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |