Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 1051923003: Add a WebContentsImpl API to snapshot the accessibility tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed some of the feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // The RenderFrameHost will have a new RenderWidgetHost created and 83 // The RenderFrameHost will have a new RenderWidgetHost created and
84 // attached to it. This is used when the RenderFrameHost is in a different 84 // attached to it. This is used when the RenderFrameHost is in a different
85 // process from its parent frame. 85 // process from its parent frame.
86 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 86 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3
87 }; 87 };
88 88
89 class CONTENT_EXPORT RenderFrameHostImpl 89 class CONTENT_EXPORT RenderFrameHostImpl
90 : public RenderFrameHost, 90 : public RenderFrameHost,
91 public BrowserAccessibilityDelegate { 91 public BrowserAccessibilityDelegate {
92 public: 92 public:
93 typedef base::Callback<void(const ui::AXTreeUpdate&)>
94 AXTreeSnapshotCallback;
95
93 // Keeps track of the state of the RenderFrameHostImpl, particularly with 96 // Keeps track of the state of the RenderFrameHostImpl, particularly with
94 // respect to swap out. 97 // respect to swap out.
95 enum RenderFrameHostImplState { 98 enum RenderFrameHostImplState {
96 // The standard state for a RFH handling the communication with an active 99 // The standard state for a RFH handling the communication with an active
97 // RenderFrame. 100 // RenderFrame.
98 STATE_DEFAULT = 0, 101 STATE_DEFAULT = 0,
99 // The RFH has not received the SwapOutACK yet, but the new page has 102 // The RFH has not received the SwapOutACK yet, but the new page has
100 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH 103 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH
101 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are 104 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are
102 // other active frames in its SiteInstance) or it will be deleted. 105 // other active frames in its SiteInstance) or it will be deleted.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 const base::string16& user_input, 361 const base::string16& user_input,
359 bool dialog_was_suppressed); 362 bool dialog_was_suppressed);
360 363
361 // Clears any outstanding transition request. This is called when we hear the 364 // Clears any outstanding transition request. This is called when we hear the
362 // response or commit. 365 // response or commit.
363 void ClearPendingTransitionRequestData(); 366 void ClearPendingTransitionRequestData();
364 367
365 // Send a message to the renderer process to change the accessibility mode. 368 // Send a message to the renderer process to change the accessibility mode.
366 void SetAccessibilityMode(AccessibilityMode AccessibilityMode); 369 void SetAccessibilityMode(AccessibilityMode AccessibilityMode);
367 370
371 // Request a one-time snapshot of the accessibility tree without changing
372 // the accessibility mode.
373 void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback);
374
368 // Turn on accessibility testing. The given callback will be run 375 // Turn on accessibility testing. The given callback will be run
369 // every time an accessibility notification is received from the 376 // every time an accessibility notification is received from the
370 // renderer process, and the accessibility tree it sent can be 377 // renderer process, and the accessibility tree it sent can be
371 // retrieved using GetAXTreeForTesting(). 378 // retrieved using GetAXTreeForTesting().
372 void SetAccessibilityCallbackForTesting( 379 void SetAccessibilityCallbackForTesting(
373 const base::Callback<void(ui::AXEvent, int)>& callback); 380 const base::Callback<void(ui::AXEvent, int)>& callback);
374 381
375 // Returns a snapshot of the accessibility tree received from the 382 // Returns a snapshot of the accessibility tree received from the
376 // renderer as of the last time an accessibility notification was 383 // renderer as of the last time an accessibility notification was
377 // received. 384 // received.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 const BeginNavigationParams& begin_params, 507 const BeginNavigationParams& begin_params,
501 scoped_refptr<ResourceRequestBody> body); 508 scoped_refptr<ResourceRequestBody> body);
502 void OnDispatchLoad(); 509 void OnDispatchLoad();
503 void OnAccessibilityEvents( 510 void OnAccessibilityEvents(
504 const std::vector<AccessibilityHostMsg_EventParams>& params, 511 const std::vector<AccessibilityHostMsg_EventParams>& params,
505 int reset_token); 512 int reset_token);
506 void OnAccessibilityLocationChanges( 513 void OnAccessibilityLocationChanges(
507 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); 514 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
508 void OnAccessibilityFindInPageResult( 515 void OnAccessibilityFindInPageResult(
509 const AccessibilityHostMsg_FindInPageResultParams& params); 516 const AccessibilityHostMsg_FindInPageResultParams& params);
517 void OnAccessibilitySnapshotResponse(int token,
518 const ui::AXTreeUpdate& snapshot);
510 void OnToggleFullscreen(bool enter_fullscreen); 519 void OnToggleFullscreen(bool enter_fullscreen);
511 520
512 #if defined(OS_MACOSX) || defined(OS_ANDROID) 521 #if defined(OS_MACOSX) || defined(OS_ANDROID)
513 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); 522 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
514 void OnHidePopup(); 523 void OnHidePopup();
515 #endif 524 #endif
516 525
517 // Registers Mojo services that this frame host makes available. 526 // Registers Mojo services that this frame host makes available.
518 void RegisterMojoServices(); 527 void RegisterMojoServices();
519 528
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 679
671 // This is nonzero if we sent an accessibility reset to the renderer and 680 // This is nonzero if we sent an accessibility reset to the renderer and
672 // we're waiting for an IPC containing this reset token (sequentially 681 // we're waiting for an IPC containing this reset token (sequentially
673 // assigned) and a complete replacement accessibility tree. 682 // assigned) and a complete replacement accessibility tree.
674 int accessibility_reset_token_; 683 int accessibility_reset_token_;
675 684
676 // A count of the number of times we needed to reset accessibility, so 685 // A count of the number of times we needed to reset accessibility, so
677 // we don't keep trying to reset forever. 686 // we don't keep trying to reset forever.
678 int accessibility_reset_count_; 687 int accessibility_reset_count_;
679 688
689 // The mapping from request id to corresponding callback for pending
690 // accessibility tree snapshot calls created by RequestAXTreeSnapshot.
691 std::map<int, AXTreeSnapshotCallback> ax_tree_snapshot_callbacks_;
692
680 // Callback when an event is received, for testing. 693 // Callback when an event is received, for testing.
681 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; 694 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_;
682 // The most recently received accessibility tree - for testing only. 695 // The most recently received accessibility tree - for testing only.
683 scoped_ptr<ui::AXTree> ax_tree_for_testing_; 696 scoped_ptr<ui::AXTree> ax_tree_for_testing_;
684 // Flag to not create a BrowserAccessibilityManager, for testing. If one 697 // Flag to not create a BrowserAccessibilityManager, for testing. If one
685 // already exists it will still be used. 698 // already exists it will still be used.
686 bool no_create_browser_accessibility_manager_for_testing_; 699 bool no_create_browser_accessibility_manager_for_testing_;
687 700
688 // PlzNavigate: Owns the stream used in navigations to store the body of the 701 // PlzNavigate: Owns the stream used in navigations to store the body of the
689 // response once it has started. 702 // response once it has started.
690 scoped_ptr<StreamHandle> stream_handle_; 703 scoped_ptr<StreamHandle> stream_handle_;
691 704
692 // Context shared for each PermissionService instance created for this RFH. 705 // Context shared for each PermissionService instance created for this RFH.
693 scoped_ptr<PermissionServiceContext> permission_service_context_; 706 scoped_ptr<PermissionServiceContext> permission_service_context_;
694 707
695 // NOTE: This must be the last member. 708 // NOTE: This must be the last member.
696 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 709 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
697 710
698 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 711 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
699 }; 712 };
700 713
701 } // namespace content 714 } // namespace content
702 715
703 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 716 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698