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

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: Clean up callbacks before end of OnRenderProcessGone 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // The RenderFrameHost will have a new RenderWidgetHost created and 84 // The RenderFrameHost will have a new RenderWidgetHost created and
85 // attached to it. This is used when the RenderFrameHost is in a different 85 // attached to it. This is used when the RenderFrameHost is in a different
86 // process from its parent frame. 86 // process from its parent frame.
87 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 87 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3
88 }; 88 };
89 89
90 class CONTENT_EXPORT RenderFrameHostImpl 90 class CONTENT_EXPORT RenderFrameHostImpl
91 : public RenderFrameHost, 91 : public RenderFrameHost,
92 public BrowserAccessibilityDelegate { 92 public BrowserAccessibilityDelegate {
93 public: 93 public:
94 typedef base::Callback<void(const ui::AXTreeUpdate&)>
95 AXTreeSnapshotCallback;
96
94 // Keeps track of the state of the RenderFrameHostImpl, particularly with 97 // Keeps track of the state of the RenderFrameHostImpl, particularly with
95 // respect to swap out. 98 // respect to swap out.
96 enum RenderFrameHostImplState { 99 enum RenderFrameHostImplState {
97 // The standard state for a RFH handling the communication with an active 100 // The standard state for a RFH handling the communication with an active
98 // RenderFrame. 101 // RenderFrame.
99 STATE_DEFAULT = 0, 102 STATE_DEFAULT = 0,
100 // The RFH has not received the SwapOutACK yet, but the new page has 103 // The RFH has not received the SwapOutACK yet, but the new page has
101 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH 104 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH
102 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are 105 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are
103 // other active frames in its SiteInstance) or it will be deleted. 106 // other active frames in its SiteInstance) or it will be deleted.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 const base::string16& user_input, 362 const base::string16& user_input,
360 bool dialog_was_suppressed); 363 bool dialog_was_suppressed);
361 364
362 // Clears any outstanding transition request. This is called when we hear the 365 // Clears any outstanding transition request. This is called when we hear the
363 // response or commit. 366 // response or commit.
364 void ClearPendingTransitionRequestData(); 367 void ClearPendingTransitionRequestData();
365 368
366 // Send a message to the renderer process to change the accessibility mode. 369 // Send a message to the renderer process to change the accessibility mode.
367 void SetAccessibilityMode(AccessibilityMode AccessibilityMode); 370 void SetAccessibilityMode(AccessibilityMode AccessibilityMode);
368 371
372 // Request a one-time snapshot of the accessibility tree without changing
373 // the accessibility mode.
374 void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback);
375
369 // Turn on accessibility testing. The given callback will be run 376 // Turn on accessibility testing. The given callback will be run
370 // every time an accessibility notification is received from the 377 // every time an accessibility notification is received from the
371 // renderer process, and the accessibility tree it sent can be 378 // renderer process, and the accessibility tree it sent can be
372 // retrieved using GetAXTreeForTesting(). 379 // retrieved using GetAXTreeForTesting().
373 void SetAccessibilityCallbackForTesting( 380 void SetAccessibilityCallbackForTesting(
374 const base::Callback<void(ui::AXEvent, int)>& callback); 381 const base::Callback<void(ui::AXEvent, int)>& callback);
375 382
376 // Send a message to the render process to change text track style settings. 383 // Send a message to the render process to change text track style settings.
377 void SetTextTrackSettings(const FrameMsg_TextTrackSettings_Params& params); 384 void SetTextTrackSettings(const FrameMsg_TextTrackSettings_Params& params);
378 385
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 const BeginNavigationParams& begin_params, 511 const BeginNavigationParams& begin_params,
505 scoped_refptr<ResourceRequestBody> body); 512 scoped_refptr<ResourceRequestBody> body);
506 void OnDispatchLoad(); 513 void OnDispatchLoad();
507 void OnAccessibilityEvents( 514 void OnAccessibilityEvents(
508 const std::vector<AccessibilityHostMsg_EventParams>& params, 515 const std::vector<AccessibilityHostMsg_EventParams>& params,
509 int reset_token); 516 int reset_token);
510 void OnAccessibilityLocationChanges( 517 void OnAccessibilityLocationChanges(
511 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); 518 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
512 void OnAccessibilityFindInPageResult( 519 void OnAccessibilityFindInPageResult(
513 const AccessibilityHostMsg_FindInPageResultParams& params); 520 const AccessibilityHostMsg_FindInPageResultParams& params);
521 void OnAccessibilitySnapshotResponse(int callback_id,
522 const ui::AXTreeUpdate& snapshot);
514 void OnToggleFullscreen(bool enter_fullscreen); 523 void OnToggleFullscreen(bool enter_fullscreen);
515 524
516 #if defined(OS_MACOSX) || defined(OS_ANDROID) 525 #if defined(OS_MACOSX) || defined(OS_ANDROID)
517 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); 526 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
518 void OnHidePopup(); 527 void OnHidePopup();
519 #endif 528 #endif
520 529
521 // Registers Mojo services that this frame host makes available. 530 // Registers Mojo services that this frame host makes available.
522 void RegisterMojoServices(); 531 void RegisterMojoServices();
523 532
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 683
675 // This is nonzero if we sent an accessibility reset to the renderer and 684 // This is nonzero if we sent an accessibility reset to the renderer and
676 // we're waiting for an IPC containing this reset token (sequentially 685 // we're waiting for an IPC containing this reset token (sequentially
677 // assigned) and a complete replacement accessibility tree. 686 // assigned) and a complete replacement accessibility tree.
678 int accessibility_reset_token_; 687 int accessibility_reset_token_;
679 688
680 // A count of the number of times we needed to reset accessibility, so 689 // A count of the number of times we needed to reset accessibility, so
681 // we don't keep trying to reset forever. 690 // we don't keep trying to reset forever.
682 int accessibility_reset_count_; 691 int accessibility_reset_count_;
683 692
693 // The mapping from callback id to corresponding callback for pending
694 // accessibility tree snapshot calls created by RequestAXTreeSnapshot.
695 std::map<int, AXTreeSnapshotCallback> ax_tree_snapshot_callbacks_;
696
684 // Callback when an event is received, for testing. 697 // Callback when an event is received, for testing.
685 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; 698 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_;
686 // The most recently received accessibility tree - for testing only. 699 // The most recently received accessibility tree - for testing only.
687 scoped_ptr<ui::AXTree> ax_tree_for_testing_; 700 scoped_ptr<ui::AXTree> ax_tree_for_testing_;
688 // Flag to not create a BrowserAccessibilityManager, for testing. If one 701 // Flag to not create a BrowserAccessibilityManager, for testing. If one
689 // already exists it will still be used. 702 // already exists it will still be used.
690 bool no_create_browser_accessibility_manager_for_testing_; 703 bool no_create_browser_accessibility_manager_for_testing_;
691 704
692 // PlzNavigate: Owns the stream used in navigations to store the body of the 705 // PlzNavigate: Owns the stream used in navigations to store the body of the
693 // response once it has started. 706 // response once it has started.
694 scoped_ptr<StreamHandle> stream_handle_; 707 scoped_ptr<StreamHandle> stream_handle_;
695 708
696 // Context shared for each PermissionService instance created for this RFH. 709 // Context shared for each PermissionService instance created for this RFH.
697 scoped_ptr<PermissionServiceContext> permission_service_context_; 710 scoped_ptr<PermissionServiceContext> permission_service_context_;
698 711
699 // NOTE: This must be the last member. 712 // NOTE: This must be the last member.
700 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 713 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
701 714
702 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 715 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
703 }; 716 };
704 717
705 } // namespace content 718 } // namespace content
706 719
707 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 720 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/accessibility/snapshot_ax_tree_browsertest.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698