OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| 22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
21 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 23 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
22 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 24 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
23 #include "content/browser/child_process_security_policy_impl.h" | 25 #include "content/browser/child_process_security_policy_impl.h" |
24 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 26 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
25 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 27 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
26 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 28 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
27 #include "content/browser/download/download_stats.h" | 29 #include "content/browser/download/download_stats.h" |
28 #include "content/browser/download/mhtml_generation_manager.h" | 30 #include "content/browser/download/mhtml_generation_manager.h" |
29 #include "content/browser/download/save_package.h" | 31 #include "content/browser/download/save_package.h" |
30 #include "content/browser/frame_host/cross_process_frame_connector.h" | 32 #include "content/browser/frame_host/cross_process_frame_connector.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "content/public/browser/devtools_agent_host.h" | 67 #include "content/public/browser/devtools_agent_host.h" |
66 #include "content/public/browser/download_manager.h" | 68 #include "content/public/browser/download_manager.h" |
67 #include "content/public/browser/download_url_parameters.h" | 69 #include "content/public/browser/download_url_parameters.h" |
68 #include "content/public/browser/invalidate_type.h" | 70 #include "content/public/browser/invalidate_type.h" |
69 #include "content/public/browser/javascript_dialog_manager.h" | 71 #include "content/public/browser/javascript_dialog_manager.h" |
70 #include "content/public/browser/load_from_memory_cache_details.h" | 72 #include "content/public/browser/load_from_memory_cache_details.h" |
71 #include "content/public/browser/load_notification_details.h" | 73 #include "content/public/browser/load_notification_details.h" |
72 #include "content/public/browser/navigation_details.h" | 74 #include "content/public/browser/navigation_details.h" |
73 #include "content/public/browser/notification_details.h" | 75 #include "content/public/browser/notification_details.h" |
74 #include "content/public/browser/notification_service.h" | 76 #include "content/public/browser/notification_service.h" |
| 77 #include "content/public/browser/render_widget_host_iterator.h" |
75 #include "content/public/browser/resource_request_details.h" | 78 #include "content/public/browser/resource_request_details.h" |
76 #include "content/public/browser/storage_partition.h" | 79 #include "content/public/browser/storage_partition.h" |
77 #include "content/public/browser/user_metrics.h" | 80 #include "content/public/browser/user_metrics.h" |
78 #include "content/public/browser/web_contents_delegate.h" | 81 #include "content/public/browser/web_contents_delegate.h" |
79 #include "content/public/browser/web_contents_observer.h" | 82 #include "content/public/browser/web_contents_observer.h" |
80 #include "content/public/common/bindings_policy.h" | 83 #include "content/public/common/bindings_policy.h" |
81 #include "content/public/common/content_constants.h" | 84 #include "content/public/common/content_constants.h" |
82 #include "content/public/common/content_switches.h" | 85 #include "content/public/common/content_switches.h" |
83 #include "content/public/common/page_zoom.h" | 86 #include "content/public/common/page_zoom.h" |
84 #include "content/public/common/result_codes.h" | 87 #include "content/public/common/result_codes.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return true; | 209 return true; |
207 } | 210 } |
208 | 211 |
209 bool ForEachFrameInternal( | 212 bool ForEachFrameInternal( |
210 const base::Callback<void(RenderFrameHost*)>& on_frame, | 213 const base::Callback<void(RenderFrameHost*)>& on_frame, |
211 FrameTreeNode* node) { | 214 FrameTreeNode* node) { |
212 on_frame.Run(node->current_frame_host()); | 215 on_frame.Run(node->current_frame_host()); |
213 return true; | 216 return true; |
214 } | 217 } |
215 | 218 |
| 219 bool ForEachPendingFrameInternal( |
| 220 const base::Callback<void(RenderFrameHost*)>& on_frame, |
| 221 FrameTreeNode* node) { |
| 222 RenderFrameHost* pending_frame_host = |
| 223 node->render_manager()->pending_frame_host(); |
| 224 if (pending_frame_host) |
| 225 on_frame.Run(pending_frame_host); |
| 226 return true; |
| 227 } |
| 228 |
216 void SendToAllFramesInternal(IPC::Message* message, RenderFrameHost* rfh) { | 229 void SendToAllFramesInternal(IPC::Message* message, RenderFrameHost* rfh) { |
217 IPC::Message* message_copy = new IPC::Message(*message); | 230 IPC::Message* message_copy = new IPC::Message(*message); |
218 message_copy->set_routing_id(rfh->GetRoutingID()); | 231 message_copy->set_routing_id(rfh->GetRoutingID()); |
219 rfh->Send(message_copy); | 232 rfh->Send(message_copy); |
220 } | 233 } |
221 | 234 |
222 void AddRenderWidgetHostViewToSet(std::set<RenderWidgetHostView*>* set, | 235 void AddRenderWidgetHostViewToSet(std::set<RenderWidgetHostView*>* set, |
223 RenderFrameHost* rfh) { | 236 RenderFrameHost* rfh) { |
224 RenderWidgetHostView* rwhv = static_cast<RenderFrameHostImpl*>(rfh) | 237 RenderWidgetHostView* rwhv = static_cast<RenderFrameHostImpl*>(rfh) |
225 ->frame_tree_node() | 238 ->frame_tree_node() |
226 ->render_manager() | 239 ->render_manager() |
227 ->GetRenderWidgetHostView(); | 240 ->GetRenderWidgetHostView(); |
228 set->insert(rwhv); | 241 set->insert(rwhv); |
229 } | 242 } |
230 | 243 |
| 244 void SetAccessibilityModeOnFrame(AccessibilityMode mode, |
| 245 RenderFrameHost* frame_host) { |
| 246 static_cast<RenderFrameHostImpl*>(frame_host)->SetAccessibilityMode(mode); |
| 247 } |
| 248 |
231 } // namespace | 249 } // namespace |
232 | 250 |
233 WebContents* WebContents::Create(const WebContents::CreateParams& params) { | 251 WebContents* WebContents::Create(const WebContents::CreateParams& params) { |
234 return WebContentsImpl::CreateWithOpener( | 252 return WebContentsImpl::CreateWithOpener( |
235 params, static_cast<WebContentsImpl*>(params.opener)); | 253 params, static_cast<WebContentsImpl*>(params.opener)); |
236 } | 254 } |
237 | 255 |
238 WebContents* WebContents::CreateWithSessionStorage( | 256 WebContents* WebContents::CreateWithSessionStorage( |
239 const WebContents::CreateParams& params, | 257 const WebContents::CreateParams& params, |
240 const SessionStorageNamespaceMap& session_storage_namespace_map) { | 258 const SessionStorageNamespaceMap& session_storage_namespace_map) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 closed_by_user_gesture_(false), | 367 closed_by_user_gesture_(false), |
350 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 368 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
351 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 369 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
352 totalPinchGestureAmount_(0), | 370 totalPinchGestureAmount_(0), |
353 currentPinchZoomStepDelta_(0), | 371 currentPinchZoomStepDelta_(0), |
354 render_view_message_source_(NULL), | 372 render_view_message_source_(NULL), |
355 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 373 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
356 fullscreen_widget_had_focus_at_shutdown_(false), | 374 fullscreen_widget_had_focus_at_shutdown_(false), |
357 is_subframe_(false), | 375 is_subframe_(false), |
358 touch_emulation_enabled_(false), | 376 touch_emulation_enabled_(false), |
359 last_dialog_suppressed_(false) { | 377 last_dialog_suppressed_(false), |
| 378 accessibility_mode_( |
| 379 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()) { |
360 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 380 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
361 g_created_callbacks.Get().at(i).Run(this); | 381 g_created_callbacks.Get().at(i).Run(this); |
362 frame_tree_.SetFrameRemoveListener( | 382 frame_tree_.SetFrameRemoveListener( |
363 base::Bind(&WebContentsImpl::OnFrameRemoved, | 383 base::Bind(&WebContentsImpl::OnFrameRemoved, |
364 base::Unretained(this))); | 384 base::Unretained(this))); |
365 } | 385 } |
366 | 386 |
367 WebContentsImpl::~WebContentsImpl() { | 387 WebContentsImpl::~WebContentsImpl() { |
368 is_being_destroyed_ = true; | 388 is_being_destroyed_ = true; |
369 | 389 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 new_contents, | 468 new_contents, |
449 params.guest_delegate); | 469 params.guest_delegate); |
450 // We are instantiating a WebContents for browser plugin. Set its subframe | 470 // We are instantiating a WebContents for browser plugin. Set its subframe |
451 // bit to true. | 471 // bit to true. |
452 new_contents->is_subframe_ = true; | 472 new_contents->is_subframe_ = true; |
453 } | 473 } |
454 new_contents->Init(params); | 474 new_contents->Init(params); |
455 return new_contents; | 475 return new_contents; |
456 } | 476 } |
457 | 477 |
| 478 // static |
| 479 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { |
| 480 std::vector<WebContentsImpl*> result; |
| 481 scoped_ptr<RenderWidgetHostIterator> widgets( |
| 482 RenderWidgetHostImpl::GetRenderWidgetHosts()); |
| 483 std::set<WebContentsImpl*> web_contents_set; |
| 484 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { |
| 485 if (!rwh->IsRenderView()) |
| 486 continue; |
| 487 RenderViewHost* rvh = RenderViewHost::From(rwh); |
| 488 if (!rvh) |
| 489 continue; |
| 490 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
| 491 if (!web_contents) |
| 492 continue; |
| 493 WebContentsImpl* wci = static_cast<WebContentsImpl*>(web_contents); |
| 494 if (web_contents_set.find(wci) == web_contents_set.end()) { |
| 495 web_contents_set.insert(wci); |
| 496 result.push_back(wci); |
| 497 } |
| 498 } |
| 499 return result; |
| 500 } |
| 501 |
458 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { | 502 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { |
459 return GetRenderManager(); | 503 return GetRenderManager(); |
460 } | 504 } |
461 | 505 |
462 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 506 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
463 const IPC::Message& message) { | 507 const IPC::Message& message) { |
464 return OnMessageReceived(render_view_host, NULL, message); | 508 return OnMessageReceived(render_view_host, NULL, message); |
465 } | 509 } |
466 | 510 |
467 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 511 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 RenderWidgetHost* const widget_host = | 717 RenderWidgetHost* const widget_host = |
674 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), | 718 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), |
675 GetFullscreenWidgetRoutingID()); | 719 GetFullscreenWidgetRoutingID()); |
676 return widget_host ? widget_host->GetView() : NULL; | 720 return widget_host ? widget_host->GetView() : NULL; |
677 } | 721 } |
678 | 722 |
679 WebContentsView* WebContentsImpl::GetView() const { | 723 WebContentsView* WebContentsImpl::GetView() const { |
680 return view_.get(); | 724 return view_.get(); |
681 } | 725 } |
682 | 726 |
| 727 void WebContentsImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| 728 if (mode == accessibility_mode_) |
| 729 return; |
| 730 |
| 731 accessibility_mode_ = mode; |
| 732 frame_tree_.ForEach( |
| 733 base::Bind(&ForEachFrameInternal, |
| 734 base::Bind(&SetAccessibilityModeOnFrame, mode))); |
| 735 frame_tree_.ForEach( |
| 736 base::Bind(&ForEachPendingFrameInternal, |
| 737 base::Bind(&SetAccessibilityModeOnFrame, mode))); |
| 738 } |
| 739 |
| 740 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { |
| 741 SetAccessibilityMode( |
| 742 content::AddAccessibilityModeTo(accessibility_mode_, mode)); |
| 743 } |
| 744 |
| 745 void WebContentsImpl::RemoveAccessibilityMode(AccessibilityMode mode) { |
| 746 SetAccessibilityMode( |
| 747 content::RemoveAccessibilityModeFrom(accessibility_mode_, mode)); |
| 748 } |
| 749 |
683 WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { | 750 WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { |
684 WebUIImpl* web_ui = new WebUIImpl(this); | 751 WebUIImpl* web_ui = new WebUIImpl(this); |
685 WebUIController* controller = WebUIControllerFactoryRegistry::GetInstance()-> | 752 WebUIController* controller = WebUIControllerFactoryRegistry::GetInstance()-> |
686 CreateWebUIControllerForURL(web_ui, url); | 753 CreateWebUIControllerForURL(web_ui, url); |
687 if (controller) { | 754 if (controller) { |
688 web_ui->AddMessageHandler(new GenericHandler()); | 755 web_ui->AddMessageHandler(new GenericHandler()); |
689 web_ui->SetController(controller); | 756 web_ui->SetController(controller); |
690 return web_ui; | 757 return web_ui; |
691 } | 758 } |
692 | 759 |
(...skipping 28 matching lines...) Expand all Loading... |
721 controller_.ReloadIgnoringCache(true); | 788 controller_.ReloadIgnoringCache(true); |
722 | 789 |
723 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 790 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
724 UserAgentOverrideSet(override)); | 791 UserAgentOverrideSet(override)); |
725 } | 792 } |
726 | 793 |
727 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 794 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
728 return renderer_preferences_.user_agent_override; | 795 return renderer_preferences_.user_agent_override; |
729 } | 796 } |
730 | 797 |
| 798 void WebContentsImpl::EnableTreeOnlyAccessibilityMode() { |
| 799 AddAccessibilityMode(AccessibilityModeTreeOnly); |
| 800 } |
| 801 |
| 802 bool WebContentsImpl::IsTreeOnlyAccessibilityModeForTesting() const { |
| 803 return accessibility_mode_ == AccessibilityModeTreeOnly; |
| 804 } |
| 805 |
| 806 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { |
| 807 return accessibility_mode_ == AccessibilityModeComplete; |
| 808 } |
| 809 |
731 #if defined(OS_WIN) | 810 #if defined(OS_WIN) |
732 void WebContentsImpl::SetParentNativeViewAccessible( | 811 void WebContentsImpl::SetParentNativeViewAccessible( |
733 gfx::NativeViewAccessible accessible_parent) { | 812 gfx::NativeViewAccessible accessible_parent) { |
734 accessible_parent_ = accessible_parent; | 813 accessible_parent_ = accessible_parent; |
735 if (GetRenderViewHost()) | 814 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); |
736 GetRenderViewHostImpl()->SetParentNativeViewAccessible(accessible_parent); | 815 if (rfh) |
| 816 rfh->SetParentNativeViewAccessible(accessible_parent); |
737 } | 817 } |
738 #endif | 818 #endif |
739 | 819 |
740 const base::string16& WebContentsImpl::GetTitle() const { | 820 const base::string16& WebContentsImpl::GetTitle() const { |
741 // Transient entries take precedence. They are used for interstitial pages | 821 // Transient entries take precedence. They are used for interstitial pages |
742 // that are shown on top of existing pages. | 822 // that are shown on top of existing pages. |
743 NavigationEntry* entry = controller_.GetTransientEntry(); | 823 NavigationEntry* entry = controller_.GetTransientEntry(); |
744 std::string accept_languages = | 824 std::string accept_languages = |
745 GetContentClient()->browser()->GetAcceptLangs( | 825 GetContentClient()->browser()->GetAcceptLangs( |
746 GetBrowserContext()); | 826 GetBrowserContext()); |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 currentPinchZoomStepDelta_--; | 1367 currentPinchZoomStepDelta_--; |
1288 if (delegate_) | 1368 if (delegate_) |
1289 delegate_->ContentsZoomChange(false); | 1369 delegate_->ContentsZoomChange(false); |
1290 } | 1370 } |
1291 return true; | 1371 return true; |
1292 } | 1372 } |
1293 | 1373 |
1294 return false; | 1374 return false; |
1295 } | 1375 } |
1296 | 1376 |
1297 #if defined(OS_WIN) | |
1298 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { | |
1299 return accessible_parent_; | |
1300 } | |
1301 #endif | |
1302 | |
1303 void WebContentsImpl::HandleMouseDown() { | 1377 void WebContentsImpl::HandleMouseDown() { |
1304 if (delegate_) | 1378 if (delegate_) |
1305 delegate_->HandleMouseDown(); | 1379 delegate_->HandleMouseDown(); |
1306 } | 1380 } |
1307 | 1381 |
1308 void WebContentsImpl::HandleMouseUp() { | 1382 void WebContentsImpl::HandleMouseUp() { |
1309 if (delegate_) | 1383 if (delegate_) |
1310 delegate_->HandleMouseUp(); | 1384 delegate_->HandleMouseUp(); |
1311 } | 1385 } |
1312 | 1386 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 } | 1762 } |
1689 | 1763 |
1690 SessionStorageNamespaceMap WebContentsImpl::GetSessionStorageNamespaceMap() { | 1764 SessionStorageNamespaceMap WebContentsImpl::GetSessionStorageNamespaceMap() { |
1691 return controller_.GetSessionStorageNamespaceMap(); | 1765 return controller_.GetSessionStorageNamespaceMap(); |
1692 } | 1766 } |
1693 | 1767 |
1694 FrameTree* WebContentsImpl::GetFrameTree() { | 1768 FrameTree* WebContentsImpl::GetFrameTree() { |
1695 return &frame_tree_; | 1769 return &frame_tree_; |
1696 } | 1770 } |
1697 | 1771 |
| 1772 AccessibilityMode WebContentsImpl::GetAccessibilityMode() const { |
| 1773 return accessibility_mode_; |
| 1774 } |
| 1775 |
1698 void WebContentsImpl::AccessibilityEventReceived( | 1776 void WebContentsImpl::AccessibilityEventReceived( |
1699 const std::vector<AXEventNotificationDetails>& details) { | 1777 const std::vector<AXEventNotificationDetails>& details) { |
1700 FOR_EACH_OBSERVER( | 1778 FOR_EACH_OBSERVER( |
1701 WebContentsObserver, observers_, AccessibilityEventReceived(details)); | 1779 WebContentsObserver, observers_, AccessibilityEventReceived(details)); |
1702 } | 1780 } |
1703 | 1781 |
1704 void WebContentsImpl::OnShowValidationMessage( | 1782 void WebContentsImpl::OnShowValidationMessage( |
1705 const gfx::Rect& anchor_in_root_view, | 1783 const gfx::Rect& anchor_in_root_view, |
1706 const base::string16& main_text, | 1784 const base::string16& main_text, |
1707 const base::string16& sub_text) { | 1785 const base::string16& sub_text) { |
(...skipping 17 matching lines...) Expand all Loading... |
1725 if (browser_plugin_embedder_) | 1803 if (browser_plugin_embedder_) |
1726 browser_plugin_embedder_->DidSendScreenRects(); | 1804 browser_plugin_embedder_->DidSendScreenRects(); |
1727 } | 1805 } |
1728 | 1806 |
1729 void WebContentsImpl::OnTouchEmulationEnabled(bool enabled) { | 1807 void WebContentsImpl::OnTouchEmulationEnabled(bool enabled) { |
1730 touch_emulation_enabled_ = enabled; | 1808 touch_emulation_enabled_ = enabled; |
1731 if (view_) | 1809 if (view_) |
1732 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 1810 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
1733 } | 1811 } |
1734 | 1812 |
| 1813 BrowserAccessibilityManager* |
| 1814 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| 1815 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); |
| 1816 return rfh ? rfh->browser_accessibility_manager() : NULL; |
| 1817 } |
| 1818 |
| 1819 BrowserAccessibilityManager* |
| 1820 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 1821 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); |
| 1822 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : NULL; |
| 1823 } |
| 1824 |
1735 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { | 1825 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { |
1736 const gfx::Size old_size = GetPreferredSize(); | 1826 const gfx::Size old_size = GetPreferredSize(); |
1737 preferred_size_ = pref_size; | 1827 preferred_size_ = pref_size; |
1738 OnPreferredSizeChanged(old_size); | 1828 OnPreferredSizeChanged(old_size); |
1739 } | 1829 } |
1740 | 1830 |
1741 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { | 1831 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { |
1742 if (delegate_) | 1832 if (delegate_) |
1743 delegate_->ResizeDueToAutoResize(this, new_size); | 1833 delegate_->ResizeDueToAutoResize(this, new_size); |
1744 } | 1834 } |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { | 3288 const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { |
3199 return GetLastCommittedURL(); | 3289 return GetLastCommittedURL(); |
3200 } | 3290 } |
3201 | 3291 |
3202 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { | 3292 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { |
3203 // Note this is only for subframes, the notification for the main frame | 3293 // Note this is only for subframes, the notification for the main frame |
3204 // happens in RenderViewCreated. | 3294 // happens in RenderViewCreated. |
3205 FOR_EACH_OBSERVER(WebContentsObserver, | 3295 FOR_EACH_OBSERVER(WebContentsObserver, |
3206 observers_, | 3296 observers_, |
3207 RenderFrameCreated(render_frame_host)); | 3297 RenderFrameCreated(render_frame_host)); |
| 3298 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); |
3208 } | 3299 } |
3209 | 3300 |
3210 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { | 3301 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { |
3211 ClearPowerSaveBlockers(render_frame_host); | 3302 ClearPowerSaveBlockers(render_frame_host); |
3212 FOR_EACH_OBSERVER(WebContentsObserver, | 3303 FOR_EACH_OBSERVER(WebContentsObserver, |
3213 observers_, | 3304 observers_, |
3214 RenderFrameDeleted(render_frame_host)); | 3305 RenderFrameDeleted(render_frame_host)); |
3215 } | 3306 } |
3216 | 3307 |
3217 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { | 3308 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 WebContents* WebContentsImpl::GetAsWebContents() { | 3411 WebContents* WebContentsImpl::GetAsWebContents() { |
3321 return this; | 3412 return this; |
3322 } | 3413 } |
3323 | 3414 |
3324 bool WebContentsImpl::IsNeverVisible() { | 3415 bool WebContentsImpl::IsNeverVisible() { |
3325 if (!delegate_) | 3416 if (!delegate_) |
3326 return false; | 3417 return false; |
3327 return delegate_->IsNeverVisible(this); | 3418 return delegate_->IsNeverVisible(this); |
3328 } | 3419 } |
3329 | 3420 |
| 3421 #if defined(OS_WIN) |
| 3422 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { |
| 3423 return accessible_parent_; |
| 3424 } |
| 3425 #endif |
| 3426 |
3330 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { | 3427 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { |
3331 return render_view_host_delegate_view_; | 3428 return render_view_host_delegate_view_; |
3332 } | 3429 } |
3333 | 3430 |
3334 RendererPreferences WebContentsImpl::GetRendererPrefs( | 3431 RendererPreferences WebContentsImpl::GetRendererPrefs( |
3335 BrowserContext* browser_context) const { | 3432 BrowserContext* browser_context) const { |
3336 return renderer_preferences_; | 3433 return renderer_preferences_; |
3337 } | 3434 } |
3338 | 3435 |
3339 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { | 3436 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3378 | 3475 |
3379 FOR_EACH_OBSERVER( | 3476 FOR_EACH_OBSERVER( |
3380 WebContentsObserver, observers_, RenderViewCreated(render_view_host)); | 3477 WebContentsObserver, observers_, RenderViewCreated(render_view_host)); |
3381 | 3478 |
3382 // We tell the observers now instead of when the main RenderFrameHostImpl is | 3479 // We tell the observers now instead of when the main RenderFrameHostImpl is |
3383 // constructed because otherwise it would be too early (i.e. IPCs sent to the | 3480 // constructed because otherwise it would be too early (i.e. IPCs sent to the |
3384 // frame would be dropped because it's not created yet). | 3481 // frame would be dropped because it's not created yet). |
3385 RenderFrameHost* main_frame = render_view_host->GetMainFrame(); | 3482 RenderFrameHost* main_frame = render_view_host->GetMainFrame(); |
3386 FOR_EACH_OBSERVER( | 3483 FOR_EACH_OBSERVER( |
3387 WebContentsObserver, observers_, RenderFrameCreated(main_frame)); | 3484 WebContentsObserver, observers_, RenderFrameCreated(main_frame)); |
| 3485 SetAccessibilityModeOnFrame(accessibility_mode_, main_frame); |
3388 } | 3486 } |
3389 | 3487 |
3390 void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) { | 3488 void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) { |
3391 if (rvh != GetRenderViewHost()) { | 3489 if (rvh != GetRenderViewHost()) { |
3392 // Don't notify the world, since this came from a renderer in the | 3490 // Don't notify the world, since this came from a renderer in the |
3393 // background. | 3491 // background. |
3394 return; | 3492 return; |
3395 } | 3493 } |
3396 | 3494 |
3397 notify_disconnection_ = true; | 3495 notify_disconnection_ = true; |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4138 if (new_size != old_size) | 4236 if (new_size != old_size) |
4139 delegate_->UpdatePreferredSize(this, new_size); | 4237 delegate_->UpdatePreferredSize(this, new_size); |
4140 } | 4238 } |
4141 | 4239 |
4142 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4240 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
4143 FrameTreeNode* node = frame_tree_.root(); | 4241 FrameTreeNode* node = frame_tree_.root(); |
4144 node->render_manager()->ResumeResponseDeferredAtStart(); | 4242 node->render_manager()->ResumeResponseDeferredAtStart(); |
4145 } | 4243 } |
4146 | 4244 |
4147 } // namespace content | 4245 } // namespace content |
OLD | NEW |