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/render_frame_proxy.h" | 22 #include "content/renderer/render_frame_proxy.h" |
22 #include "content/renderer/renderer_webcookiejar_impl.h" | 23 #include "content/renderer/renderer_webcookiejar_impl.h" |
23 #include "ipc/ipc_message.h" | 24 #include "ipc/ipc_message.h" |
| 25 #include "third_party/WebKit/public/web/WebAXObject.h" |
24 #include "third_party/WebKit/public/web/WebDataSource.h" | 26 #include "third_party/WebKit/public/web/WebDataSource.h" |
25 #include "third_party/WebKit/public/web/WebFrameClient.h" | 27 #include "third_party/WebKit/public/web/WebFrameClient.h" |
26 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 28 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
27 #include "ui/gfx/range/range.h" | 29 #include "ui/gfx/range/range.h" |
28 | 30 |
29 class TransportDIB; | 31 class TransportDIB; |
30 struct FrameMsg_BuffersSwapped_Params; | 32 struct FrameMsg_BuffersSwapped_Params; |
31 struct FrameMsg_CompositorFrameSwapped_Params; | 33 struct FrameMsg_CompositorFrameSwapped_Params; |
32 struct FrameMsg_Navigate_Params; | 34 struct FrameMsg_Navigate_Params; |
33 | 35 |
(...skipping 16 matching lines...) Expand all Loading... |
50 class Range; | 52 class Range; |
51 class Rect; | 53 class Rect; |
52 } | 54 } |
53 | 55 |
54 namespace content { | 56 namespace content { |
55 | 57 |
56 class ChildFrameCompositingHelper; | 58 class ChildFrameCompositingHelper; |
57 class MediaStreamClient; | 59 class MediaStreamClient; |
58 class NotificationProvider; | 60 class NotificationProvider; |
59 class PepperPluginInstanceImpl; | 61 class PepperPluginInstanceImpl; |
| 62 class RendererAccessibility; |
60 class RendererPpapiHost; | 63 class RendererPpapiHost; |
61 class RenderFrameObserver; | 64 class RenderFrameObserver; |
62 class RenderViewImpl; | 65 class RenderViewImpl; |
63 class RenderWidget; | 66 class RenderWidget; |
64 class RenderWidgetFullscreenPepper; | 67 class RenderWidgetFullscreenPepper; |
65 struct CustomContextMenuContext; | 68 struct CustomContextMenuContext; |
66 | 69 |
67 class CONTENT_EXPORT RenderFrameImpl | 70 class CONTENT_EXPORT RenderFrameImpl |
68 : public RenderFrame, | 71 : public RenderFrame, |
69 NON_EXPORTED_BASE(public blink::WebFrameClient), | 72 NON_EXPORTED_BASE(public blink::WebFrameClient), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // Start/Stop loading notifications. | 129 // Start/Stop loading notifications. |
127 // TODO(nasko): Those are page-level methods at this time and come from | 130 // TODO(nasko): Those are page-level methods at this time and come from |
128 // WebViewClient. We should move them to be WebFrameClient calls and put | 131 // WebViewClient. We should move them to be WebFrameClient calls and put |
129 // logic in the browser side to balance starts/stops. | 132 // logic in the browser side to balance starts/stops. |
130 // |to_different_document| will be true unless the load is a fragment | 133 // |to_different_document| will be true unless the load is a fragment |
131 // navigation, or triggered by history.pushState/replaceState. | 134 // navigation, or triggered by history.pushState/replaceState. |
132 virtual void didStartLoading(bool to_different_document); | 135 virtual void didStartLoading(bool to_different_document); |
133 virtual void didStopLoading(); | 136 virtual void didStopLoading(); |
134 virtual void didChangeLoadProgress(double load_progress); | 137 virtual void didChangeLoadProgress(double load_progress); |
135 | 138 |
| 139 AccessibilityMode accessibility_mode() { |
| 140 return accessibility_mode_; |
| 141 } |
| 142 |
| 143 RendererAccessibility* renderer_accessibility() { |
| 144 return renderer_accessibility_; |
| 145 } |
| 146 |
| 147 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, |
| 148 blink::WebAXEvent event); |
| 149 |
| 150 // TODO(dmazzoni): the only reason this is here is to plumb it through to |
| 151 // RendererAccessibility. It should be part of RenderFrameObserver, once |
| 152 // blink has a separate accessibility tree per frame. |
| 153 void FocusedNodeChanged(const blink::WebNode& node); |
| 154 |
136 #if defined(ENABLE_PLUGINS) | 155 #if defined(ENABLE_PLUGINS) |
137 // Notification that a PPAPI plugin has been created. | 156 // Notification that a PPAPI plugin has been created. |
138 void PepperPluginCreated(RendererPpapiHost* host); | 157 void PepperPluginCreated(RendererPpapiHost* host); |
139 | 158 |
140 // Notifies that |instance| has changed the cursor. | 159 // Notifies that |instance| has changed the cursor. |
141 // This will update the cursor appearance if it is currently over the plugin | 160 // This will update the cursor appearance if it is currently over the plugin |
142 // instance. | 161 // instance. |
143 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, | 162 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, |
144 const blink::WebCursorInfo& cursor); | 163 const blink::WebCursorInfo& cursor); |
145 | 164 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 406 |
388 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move | 407 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move |
389 // this back to private member. | 408 // this back to private member. |
390 void OnNavigate(const FrameMsg_Navigate_Params& params); | 409 void OnNavigate(const FrameMsg_Navigate_Params& params); |
391 | 410 |
392 protected: | 411 protected: |
393 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); | 412 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
394 | 413 |
395 private: | 414 private: |
396 friend class RenderFrameObserver; | 415 friend class RenderFrameObserver; |
| 416 friend class RendererAccessibilityTest; |
397 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest, | 417 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest, |
398 AccessibilityMessagesQueueWhileSwappedOut); | 418 AccessibilityMessagesQueueWhileSwappedOut); |
399 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, | 419 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, |
400 ShouldUpdateSelectionTextFromContextMenuParams); | 420 ShouldUpdateSelectionTextFromContextMenuParams); |
401 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 421 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
402 OnExtendSelectionAndDelete); | 422 OnExtendSelectionAndDelete); |
403 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut); | 423 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut); |
404 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK); | 424 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK); |
405 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 425 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
406 SetEditableSelectionAndComposition); | 426 SetEditableSelectionAndComposition); |
| 427 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 428 OnSetAccessibilityMode); |
407 | 429 |
408 typedef std::map<GURL, double> HostZoomLevels; | 430 typedef std::map<GURL, double> HostZoomLevels; |
409 | 431 |
410 // Functions to add and remove observers for this object. | 432 // Functions to add and remove observers for this object. |
411 void AddObserver(RenderFrameObserver* observer); | 433 void AddObserver(RenderFrameObserver* observer); |
412 void RemoveObserver(RenderFrameObserver* observer); | 434 void RemoveObserver(RenderFrameObserver* observer); |
413 | 435 |
414 void UpdateURL(blink::WebFrame* frame); | 436 void UpdateURL(blink::WebFrame* frame); |
415 | 437 |
416 // Gets the focused element. If no such element exists then the element will | 438 // Gets the focused element. If no such element exists then the element will |
(...skipping 28 matching lines...) Expand all Loading... |
445 void OnCSSInsertRequest(const std::string& css); | 467 void OnCSSInsertRequest(const std::string& css); |
446 void OnJavaScriptExecuteRequest(const base::string16& javascript, | 468 void OnJavaScriptExecuteRequest(const base::string16& javascript, |
447 int id, | 469 int id, |
448 bool notify_result); | 470 bool notify_result); |
449 void OnSetEditableSelectionOffsets(int start, int end); | 471 void OnSetEditableSelectionOffsets(int start, int end); |
450 void OnSetCompositionFromExistingText( | 472 void OnSetCompositionFromExistingText( |
451 int start, int end, | 473 int start, int end, |
452 const std::vector<blink::WebCompositionUnderline>& underlines); | 474 const std::vector<blink::WebCompositionUnderline>& underlines); |
453 void OnExtendSelectionAndDelete(int before, int after); | 475 void OnExtendSelectionAndDelete(int before, int after); |
454 void OnReload(bool ignore_cache); | 476 void OnReload(bool ignore_cache); |
| 477 void OnSetAccessibilityMode(AccessibilityMode new_mode); |
455 #if defined(OS_MACOSX) | 478 #if defined(OS_MACOSX) |
456 void OnCopyToFindPboard(); | 479 void OnCopyToFindPboard(); |
457 #endif | 480 #endif |
458 | 481 |
459 // Virtual since overridden by WebTestProxy for layout tests. | 482 // Virtual since overridden by WebTestProxy for layout tests. |
460 virtual blink::WebNavigationPolicy DecidePolicyForNavigation( | 483 virtual blink::WebNavigationPolicy DecidePolicyForNavigation( |
461 RenderFrame* render_frame, | 484 RenderFrame* render_frame, |
462 blink::WebFrame* frame, | 485 blink::WebFrame* frame, |
463 blink::WebDataSource::ExtraData* extraData, | 486 blink::WebDataSource::ExtraData* extraData, |
464 const blink::WebURLRequest& request, | 487 const blink::WebURLRequest& request, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // along with the RenderFrame automatically. This is why we just store weak | 609 // along with the RenderFrame automatically. This is why we just store weak |
587 // references. | 610 // references. |
588 | 611 |
589 // Holds a reference to the service which provides desktop notifications. | 612 // Holds a reference to the service which provides desktop notifications. |
590 NotificationProvider* notification_provider_; | 613 NotificationProvider* notification_provider_; |
591 | 614 |
592 // MediaStreamClient attached to this frame; lazily initialized. | 615 // MediaStreamClient attached to this frame; lazily initialized. |
593 MediaStreamClient* media_stream_client_; | 616 MediaStreamClient* media_stream_client_; |
594 blink::WebUserMediaClient* web_user_media_client_; | 617 blink::WebUserMediaClient* web_user_media_client_; |
595 | 618 |
| 619 // The current accessibility mode. |
| 620 AccessibilityMode accessibility_mode_; |
| 621 |
| 622 // Only valid if |accessibility_mode_| is anything other than |
| 623 // AccessibilityModeOff. |
| 624 RendererAccessibility* renderer_accessibility_; |
| 625 |
596 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; | 626 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
597 | 627 |
598 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 628 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
599 }; | 629 }; |
600 | 630 |
601 } // namespace content | 631 } // namespace content |
602 | 632 |
603 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 633 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |