| 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_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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 STATE_PENDING_SWAP_OUT, | 86 STATE_PENDING_SWAP_OUT, |
| 87 // The RFH is swapped out and stored inside a RenderFrameProxyHost, being | 87 // The RFH is swapped out and stored inside a RenderFrameProxyHost, being |
| 88 // used as a placeholder to allow cross-process communication. Only main | 88 // used as a placeholder to allow cross-process communication. Only main |
| 89 // frames can enter this state. | 89 // frames can enter this state. |
| 90 STATE_SWAPPED_OUT, | 90 STATE_SWAPPED_OUT, |
| 91 }; | 91 }; |
| 92 // Helper function to determine whether the RFH state should contribute to the | 92 // Helper function to determine whether the RFH state should contribute to the |
| 93 // number of active frames of a SiteInstance or not. | 93 // number of active frames of a SiteInstance or not. |
| 94 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); | 94 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); |
| 95 | 95 |
| 96 // An accessibility reset is only allowed to prevent very rare corner cases |
| 97 // or race conditions where the browser and renderer get out of sync. If |
| 98 // this happens more than this many times, kill the renderer. |
| 99 static const int kMaxAccessibilityResets = 5; |
| 100 |
| 96 static RenderFrameHostImpl* FromID(int process_id, int routing_id); | 101 static RenderFrameHostImpl* FromID(int process_id, int routing_id); |
| 97 | 102 |
| 98 ~RenderFrameHostImpl() override; | 103 ~RenderFrameHostImpl() override; |
| 99 | 104 |
| 100 // RenderFrameHost | 105 // RenderFrameHost |
| 101 int GetRoutingID() override; | 106 int GetRoutingID() override; |
| 102 SiteInstanceImpl* GetSiteInstance() override; | 107 SiteInstanceImpl* GetSiteInstance() override; |
| 103 RenderProcessHost* GetProcess() override; | 108 RenderProcessHost* GetProcess() override; |
| 104 RenderFrameHost* GetParent() override; | 109 RenderFrameHost* GetParent() override; |
| 105 const std::string& GetFrameName() override; | 110 const std::string& GetFrameName() override; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // Access the BrowserAccessibilityManager if it already exists. | 332 // Access the BrowserAccessibilityManager if it already exists. |
| 328 BrowserAccessibilityManager* browser_accessibility_manager() const { | 333 BrowserAccessibilityManager* browser_accessibility_manager() const { |
| 329 return browser_accessibility_manager_.get(); | 334 return browser_accessibility_manager_.get(); |
| 330 } | 335 } |
| 331 | 336 |
| 332 // If accessibility is enabled, get the BrowserAccessibilityManager for | 337 // If accessibility is enabled, get the BrowserAccessibilityManager for |
| 333 // 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 |
| 334 // NULL. | 339 // NULL. |
| 335 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager(); | 340 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager(); |
| 336 | 341 |
| 342 void set_no_create_browser_accessibility_manager_for_testing(bool flag) { |
| 343 no_create_browser_accessibility_manager_for_testing_ = flag; |
| 344 } |
| 345 |
| 337 #if defined(OS_WIN) | 346 #if defined(OS_WIN) |
| 338 void SetParentNativeViewAccessible( | 347 void SetParentNativeViewAccessible( |
| 339 gfx::NativeViewAccessible accessible_parent); | 348 gfx::NativeViewAccessible accessible_parent); |
| 340 gfx::NativeViewAccessible GetParentNativeViewAccessible() const; | 349 gfx::NativeViewAccessible GetParentNativeViewAccessible() const; |
| 341 #elif defined(OS_MACOSX) | 350 #elif defined(OS_MACOSX) |
| 342 // Select popup menu related methods (for external popup menus). | 351 // Select popup menu related methods (for external popup menus). |
| 343 void DidSelectPopupMenuItem(int selected_index); | 352 void DidSelectPopupMenuItem(int selected_index); |
| 344 void DidCancelPopupMenu(); | 353 void DidCancelPopupMenu(); |
| 345 #elif defined(OS_ANDROID) | 354 #elif defined(OS_ANDROID) |
| 346 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices); | 355 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 void OnDidAccessInitialDocument(); | 428 void OnDidAccessInitialDocument(); |
| 420 void OnDidDisownOpener(); | 429 void OnDidDisownOpener(); |
| 421 void OnDidAssignPageId(int32 page_id); | 430 void OnDidAssignPageId(int32 page_id); |
| 422 void OnUpdateTitle(int32 page_id, | 431 void OnUpdateTitle(int32 page_id, |
| 423 const base::string16& title, | 432 const base::string16& title, |
| 424 blink::WebTextDirection title_direction); | 433 blink::WebTextDirection title_direction); |
| 425 void OnUpdateEncoding(const std::string& encoding); | 434 void OnUpdateEncoding(const std::string& encoding); |
| 426 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, | 435 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, |
| 427 const CommonNavigationParams& common_params); | 436 const CommonNavigationParams& common_params); |
| 428 void OnAccessibilityEvents( | 437 void OnAccessibilityEvents( |
| 429 const std::vector<AccessibilityHostMsg_EventParams>& params); | 438 const std::vector<AccessibilityHostMsg_EventParams>& params, |
| 439 int reset_token); |
| 430 void OnAccessibilityLocationChanges( | 440 void OnAccessibilityLocationChanges( |
| 431 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); | 441 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); |
| 432 | 442 |
| 433 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 443 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 434 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); | 444 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); |
| 435 void OnHidePopup(); | 445 void OnHidePopup(); |
| 436 #endif | 446 #endif |
| 437 | 447 |
| 438 // Updates the state of this RenderFrameHost and clears any waiting state | 448 // Updates the state of this RenderFrameHost and clears any waiting state |
| 439 // that is no longer relevant. | 449 // that is no longer relevant. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 // long to execute, depending on the number of active frames in the | 557 // long to execute, depending on the number of active frames in the |
| 548 // SiteInstance. | 558 // SiteInstance. |
| 549 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; | 559 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; |
| 550 | 560 |
| 551 ServiceRegistryImpl service_registry_; | 561 ServiceRegistryImpl service_registry_; |
| 552 | 562 |
| 553 #if defined(OS_ANDROID) | 563 #if defined(OS_ANDROID) |
| 554 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; | 564 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; |
| 555 #endif | 565 #endif |
| 556 | 566 |
| 567 // The object managing the accessibility tree for this frame. |
| 557 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; | 568 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; |
| 558 | 569 |
| 570 // This is nonzero if we sent an accessibility reset to the renderer and |
| 571 // we're waiting for an IPC containing this reset token (sequentially |
| 572 // assigned) and a complete replacement accessibility tree. |
| 573 int accessibility_reset_token_; |
| 574 |
| 575 // A count of the number of times we needed to reset accessibility, so |
| 576 // we don't keep trying to reset forever. |
| 577 int accessibility_reset_count_; |
| 578 |
| 559 // Callback when an event is received, for testing. | 579 // Callback when an event is received, for testing. |
| 560 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; | 580 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; |
| 561 // The most recently received accessibility tree - for testing only. | 581 // The most recently received accessibility tree - for testing only. |
| 562 scoped_ptr<ui::AXTree> ax_tree_for_testing_; | 582 scoped_ptr<ui::AXTree> ax_tree_for_testing_; |
| 583 // Flag to not create a BrowserAccessibilityManager, for testing. If one |
| 584 // already exists it will still be used. |
| 585 bool no_create_browser_accessibility_manager_for_testing_; |
| 563 | 586 |
| 564 // PlzNavigate: Owns the stream used in navigations to store the body of the | 587 // PlzNavigate: Owns the stream used in navigations to store the body of the |
| 565 // response once it has started. | 588 // response once it has started. |
| 566 scoped_ptr<StreamHandle> stream_handle_; | 589 scoped_ptr<StreamHandle> stream_handle_; |
| 567 | 590 |
| 568 // NOTE: This must be the last member. | 591 // NOTE: This must be the last member. |
| 569 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 592 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 570 | 593 |
| 571 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 594 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 572 }; | 595 }; |
| 573 | 596 |
| 574 } // namespace content | 597 } // namespace content |
| 575 | 598 |
| 576 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 599 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |