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