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

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

Issue 625443002: Reset accessibility if it gets out of sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try to address win x64 failure Created 6 years, 2 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Access the BrowserAccessibilityManager if it already exists. 332 // Access the BrowserAccessibilityManager if it already exists.
333 BrowserAccessibilityManager* browser_accessibility_manager() const { 333 BrowserAccessibilityManager* browser_accessibility_manager() const {
334 return browser_accessibility_manager_.get(); 334 return browser_accessibility_manager_.get();
335 } 335 }
336 336
337 // If accessibility is enabled, get the BrowserAccessibilityManager for 337 // If accessibility is enabled, get the BrowserAccessibilityManager for
338 // this frame, or create one if it doesn't exist yet, otherwise return 338 // this frame, or create one if it doesn't exist yet, otherwise return
339 // NULL. 339 // NULL.
340 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager(); 340 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager();
341 341
342 void set_disallow_browser_accessibility_manager_for_testing(bool flag) {
343 disallow_browser_accessibility_manager_for_testing_ = flag;
344 }
345
342 #if defined(OS_WIN) 346 #if defined(OS_WIN)
343 void SetParentNativeViewAccessible( 347 void SetParentNativeViewAccessible(
344 gfx::NativeViewAccessible accessible_parent); 348 gfx::NativeViewAccessible accessible_parent);
345 gfx::NativeViewAccessible GetParentNativeViewAccessible() const; 349 gfx::NativeViewAccessible GetParentNativeViewAccessible() const;
346 #elif defined(OS_MACOSX) 350 #elif defined(OS_MACOSX)
347 // Select popup menu related methods (for external popup menus). 351 // Select popup menu related methods (for external popup menus).
348 void DidSelectPopupMenuItem(int selected_index); 352 void DidSelectPopupMenuItem(int selected_index);
349 void DidCancelPopupMenu(); 353 void DidCancelPopupMenu();
350 #elif defined(OS_ANDROID) 354 #elif defined(OS_ANDROID)
351 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices); 355 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices);
352 void DidCancelPopupMenu(); 356 void DidCancelPopupMenu();
353 #endif 357 #endif
354 358
355 // PlzNavigate: Indicates that a navigation is ready to commit and can be 359 // PlzNavigate: Indicates that a navigation is ready to commit and can be
356 // handled by this RenderFrame. 360 // handled by this RenderFrame.
357 void CommitNavigation(const GURL& stream_url, 361 void CommitNavigation(const GURL& stream_url,
358 const CommonNavigationParams& common_params, 362 const CommonNavigationParams& common_params,
359 const CommitNavigationParams& commit_params); 363 const CommitNavigationParams& commit_params);
360 364
365 // An accessibility reset is only allowed to prevent very rare corner cases
366 // or race conditions where the browser and renderer get out of sync. If
367 // this happens more than this many times, kill the renderer.
368 static const int kMaxAccessibilityResets = 5;
nasko 2014/10/06 16:39:03 Please move this up next to the enum at the beginn
dmazzoni 2014/10/06 16:44:02 Done.
369
361 protected: 370 protected:
362 friend class RenderFrameHostFactory; 371 friend class RenderFrameHostFactory;
363 372
364 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 373 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
365 // should be the abstraction needed here, but we need RenderViewHost to pass 374 // should be the abstraction needed here, but we need RenderViewHost to pass
366 // into WebContentsObserver::FrameDetached for now. 375 // into WebContentsObserver::FrameDetached for now.
367 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 376 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
368 RenderFrameHostDelegate* delegate, 377 RenderFrameHostDelegate* delegate,
369 FrameTree* frame_tree, 378 FrameTree* frame_tree,
370 FrameTreeNode* frame_tree_node, 379 FrameTreeNode* frame_tree_node,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 void OnDidAccessInitialDocument(); 432 void OnDidAccessInitialDocument();
424 void OnDidDisownOpener(); 433 void OnDidDisownOpener();
425 void OnDidAssignPageId(int32 page_id); 434 void OnDidAssignPageId(int32 page_id);
426 void OnUpdateTitle(int32 page_id, 435 void OnUpdateTitle(int32 page_id,
427 const base::string16& title, 436 const base::string16& title,
428 blink::WebTextDirection title_direction); 437 blink::WebTextDirection title_direction);
429 void OnUpdateEncoding(const std::string& encoding); 438 void OnUpdateEncoding(const std::string& encoding);
430 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, 439 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params,
431 const CommonNavigationParams& common_params); 440 const CommonNavigationParams& common_params);
432 void OnAccessibilityEvents( 441 void OnAccessibilityEvents(
433 const std::vector<AccessibilityHostMsg_EventParams>& params); 442 const std::vector<AccessibilityHostMsg_EventParams>& params,
443 int reset_token);
434 void OnAccessibilityLocationChanges( 444 void OnAccessibilityLocationChanges(
435 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); 445 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
436 446
437 #if defined(OS_MACOSX) || defined(OS_ANDROID) 447 #if defined(OS_MACOSX) || defined(OS_ANDROID)
438 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); 448 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
439 void OnHidePopup(); 449 void OnHidePopup();
440 #endif 450 #endif
441 451
442 // Updates the state of this RenderFrameHost and clears any waiting state 452 // Updates the state of this RenderFrameHost and clears any waiting state
443 // that is no longer relevant. 453 // that is no longer relevant.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 // long to execute, depending on the number of active frames in the 561 // long to execute, depending on the number of active frames in the
552 // SiteInstance. 562 // SiteInstance.
553 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; 563 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
554 564
555 // Called after receiving the SwapOutACK when the RFH is in the pending 565 // Called after receiving the SwapOutACK when the RFH is in the pending
556 // shutdown state. Also called if the unload timer times out. 566 // shutdown state. Also called if the unload timer times out.
557 base::Closure pending_shutdown_on_swap_out_; 567 base::Closure pending_shutdown_on_swap_out_;
558 568
559 ServiceRegistryImpl service_registry_; 569 ServiceRegistryImpl service_registry_;
560 570
571 // The object managing the accessibility tree for this frame.
561 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; 572 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
562 573
574 // This is nonzero if we sent an accessibility reset to the renderer and
575 // we're waiting for an IPC containing this reset token (sequentially
576 // assigned) and a complete replacement accessibility tree.
577 int accessibility_reset_token_;
578
579 // A count of the number of times we needed to reset accessibility, so
580 // we don't keep trying to reset forever.
581 int accessibility_reset_count_;
582
563 // Callback when an event is received, for testing. 583 // Callback when an event is received, for testing.
564 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; 584 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_;
565 // The most recently received accessibility tree - for testing only. 585 // The most recently received accessibility tree - for testing only.
566 scoped_ptr<ui::AXTree> ax_tree_for_testing_; 586 scoped_ptr<ui::AXTree> ax_tree_for_testing_;
587 // Flag to not create a BrowserAccessibilityManager, for testing.
588 bool disallow_browser_accessibility_manager_for_testing_;
567 589
568 // NOTE: This must be the last member. 590 // NOTE: This must be the last member.
569 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 591 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
570 592
571 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 593 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
572 }; 594 };
573 595
574 } // namespace content 596 } // namespace content
575 597
576 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 598 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698