| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 RenderWidgetHost* const widget_host = | 714 RenderWidgetHost* const widget_host = |
| 671 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), | 715 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), |
| 672 GetFullscreenWidgetRoutingID()); | 716 GetFullscreenWidgetRoutingID()); |
| 673 return widget_host ? widget_host->GetView() : NULL; | 717 return widget_host ? widget_host->GetView() : NULL; |
| 674 } | 718 } |
| 675 | 719 |
| 676 WebContentsView* WebContentsImpl::GetView() const { | 720 WebContentsView* WebContentsImpl::GetView() const { |
| 677 return view_.get(); | 721 return view_.get(); |
| 678 } | 722 } |
| 679 | 723 |
| 724 void WebContentsImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| 725 if (mode == accessibility_mode_) |
| 726 return; |
| 727 |
| 728 accessibility_mode_ = mode; |
| 729 frame_tree_.ForEach( |
| 730 base::Bind(&ForEachFrameInternal, |
| 731 base::Bind(&SetAccessibilityModeOnFrame, mode))); |
| 732 frame_tree_.ForEach( |
| 733 base::Bind(&ForEachPendingFrameInternal, |
| 734 base::Bind(&SetAccessibilityModeOnFrame, mode))); |
| 735 } |
| 736 |
| 737 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { |
| 738 SetAccessibilityMode( |
| 739 content::AddAccessibilityModeTo(accessibility_mode_, mode)); |
| 740 } |
| 741 |
| 742 void WebContentsImpl::RemoveAccessibilityMode(AccessibilityMode mode) { |
| 743 SetAccessibilityMode( |
| 744 content::RemoveAccessibilityModeFrom(accessibility_mode_, mode)); |
| 745 } |
| 746 |
| 680 WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { | 747 WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { |
| 681 WebUIImpl* web_ui = new WebUIImpl(this); | 748 WebUIImpl* web_ui = new WebUIImpl(this); |
| 682 WebUIController* controller = WebUIControllerFactoryRegistry::GetInstance()-> | 749 WebUIController* controller = WebUIControllerFactoryRegistry::GetInstance()-> |
| 683 CreateWebUIControllerForURL(web_ui, url); | 750 CreateWebUIControllerForURL(web_ui, url); |
| 684 if (controller) { | 751 if (controller) { |
| 685 web_ui->AddMessageHandler(new GenericHandler()); | 752 web_ui->AddMessageHandler(new GenericHandler()); |
| 686 web_ui->SetController(controller); | 753 web_ui->SetController(controller); |
| 687 return web_ui; | 754 return web_ui; |
| 688 } | 755 } |
| 689 | 756 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 718 controller_.ReloadIgnoringCache(true); | 785 controller_.ReloadIgnoringCache(true); |
| 719 | 786 |
| 720 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 787 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 721 UserAgentOverrideSet(override)); | 788 UserAgentOverrideSet(override)); |
| 722 } | 789 } |
| 723 | 790 |
| 724 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 791 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
| 725 return renderer_preferences_.user_agent_override; | 792 return renderer_preferences_.user_agent_override; |
| 726 } | 793 } |
| 727 | 794 |
| 795 void WebContentsImpl::EnableTreeOnlyAccessibilityMode() { |
| 796 AddAccessibilityMode(AccessibilityModeTreeOnly); |
| 797 } |
| 798 |
| 799 bool WebContentsImpl::IsTreeOnlyAccessibilityModeForTesting() const { |
| 800 return accessibility_mode() == AccessibilityModeTreeOnly; |
| 801 } |
| 802 |
| 803 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { |
| 804 return accessibility_mode() == AccessibilityModeComplete; |
| 805 } |
| 806 |
| 728 #if defined(OS_WIN) | 807 #if defined(OS_WIN) |
| 729 void WebContentsImpl::SetParentNativeViewAccessible( | 808 void WebContentsImpl::SetParentNativeViewAccessible( |
| 730 gfx::NativeViewAccessible accessible_parent) { | 809 gfx::NativeViewAccessible accessible_parent) { |
| 731 accessible_parent_ = accessible_parent; | 810 accessible_parent_ = accessible_parent; |
| 732 if (GetRenderViewHost()) | 811 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); |
| 733 GetRenderViewHostImpl()->SetParentNativeViewAccessible(accessible_parent); | 812 if (rfh) |
| 813 rfh->SetParentNativeViewAccessible(accessible_parent); |
| 734 } | 814 } |
| 735 #endif | 815 #endif |
| 736 | 816 |
| 737 const base::string16& WebContentsImpl::GetTitle() const { | 817 const base::string16& WebContentsImpl::GetTitle() const { |
| 738 // Transient entries take precedence. They are used for interstitial pages | 818 // Transient entries take precedence. They are used for interstitial pages |
| 739 // that are shown on top of existing pages. | 819 // that are shown on top of existing pages. |
| 740 NavigationEntry* entry = controller_.GetTransientEntry(); | 820 NavigationEntry* entry = controller_.GetTransientEntry(); |
| 741 std::string accept_languages = | 821 std::string accept_languages = |
| 742 GetContentClient()->browser()->GetAcceptLangs( | 822 GetContentClient()->browser()->GetAcceptLangs( |
| 743 GetBrowserContext()); | 823 GetBrowserContext()); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 currentPinchZoomStepDelta_--; | 1364 currentPinchZoomStepDelta_--; |
| 1285 if (delegate_) | 1365 if (delegate_) |
| 1286 delegate_->ContentsZoomChange(false); | 1366 delegate_->ContentsZoomChange(false); |
| 1287 } | 1367 } |
| 1288 return true; | 1368 return true; |
| 1289 } | 1369 } |
| 1290 | 1370 |
| 1291 return false; | 1371 return false; |
| 1292 } | 1372 } |
| 1293 | 1373 |
| 1294 #if defined(OS_WIN) | |
| 1295 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { | |
| 1296 return accessible_parent_; | |
| 1297 } | |
| 1298 #endif | |
| 1299 | |
| 1300 void WebContentsImpl::HandleMouseDown() { | 1374 void WebContentsImpl::HandleMouseDown() { |
| 1301 if (delegate_) | 1375 if (delegate_) |
| 1302 delegate_->HandleMouseDown(); | 1376 delegate_->HandleMouseDown(); |
| 1303 } | 1377 } |
| 1304 | 1378 |
| 1305 void WebContentsImpl::HandleMouseUp() { | 1379 void WebContentsImpl::HandleMouseUp() { |
| 1306 if (delegate_) | 1380 if (delegate_) |
| 1307 delegate_->HandleMouseUp(); | 1381 delegate_->HandleMouseUp(); |
| 1308 } | 1382 } |
| 1309 | 1383 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 } | 1759 } |
| 1686 | 1760 |
| 1687 SessionStorageNamespaceMap WebContentsImpl::GetSessionStorageNamespaceMap() { | 1761 SessionStorageNamespaceMap WebContentsImpl::GetSessionStorageNamespaceMap() { |
| 1688 return controller_.GetSessionStorageNamespaceMap(); | 1762 return controller_.GetSessionStorageNamespaceMap(); |
| 1689 } | 1763 } |
| 1690 | 1764 |
| 1691 FrameTree* WebContentsImpl::GetFrameTree() { | 1765 FrameTree* WebContentsImpl::GetFrameTree() { |
| 1692 return &frame_tree_; | 1766 return &frame_tree_; |
| 1693 } | 1767 } |
| 1694 | 1768 |
| 1769 AccessibilityMode WebContentsImpl::GetAccessibilityMode() const { |
| 1770 return accessibility_mode_; |
| 1771 } |
| 1772 |
| 1695 void WebContentsImpl::AccessibilityEventReceived( | 1773 void WebContentsImpl::AccessibilityEventReceived( |
| 1696 const std::vector<AXEventNotificationDetails>& details) { | 1774 const std::vector<AXEventNotificationDetails>& details) { |
| 1697 FOR_EACH_OBSERVER( | 1775 FOR_EACH_OBSERVER( |
| 1698 WebContentsObserver, observers_, AccessibilityEventReceived(details)); | 1776 WebContentsObserver, observers_, AccessibilityEventReceived(details)); |
| 1699 } | 1777 } |
| 1700 | 1778 |
| 1701 void WebContentsImpl::OnShowValidationMessage( | 1779 void WebContentsImpl::OnShowValidationMessage( |
| 1702 const gfx::Rect& anchor_in_root_view, | 1780 const gfx::Rect& anchor_in_root_view, |
| 1703 const base::string16& main_text, | 1781 const base::string16& main_text, |
| 1704 const base::string16& sub_text) { | 1782 const base::string16& sub_text) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1722 if (browser_plugin_embedder_) | 1800 if (browser_plugin_embedder_) |
| 1723 browser_plugin_embedder_->DidSendScreenRects(); | 1801 browser_plugin_embedder_->DidSendScreenRects(); |
| 1724 } | 1802 } |
| 1725 | 1803 |
| 1726 void WebContentsImpl::OnTouchEmulationEnabled(bool enabled) { | 1804 void WebContentsImpl::OnTouchEmulationEnabled(bool enabled) { |
| 1727 touch_emulation_enabled_ = enabled; | 1805 touch_emulation_enabled_ = enabled; |
| 1728 if (view_) | 1806 if (view_) |
| 1729 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 1807 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 1730 } | 1808 } |
| 1731 | 1809 |
| 1810 BrowserAccessibilityManager* |
| 1811 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| 1812 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); |
| 1813 return rfh ? rfh->browser_accessibility_manager() : NULL; |
| 1814 } |
| 1815 |
| 1816 BrowserAccessibilityManager* |
| 1817 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 1818 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); |
| 1819 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : NULL; |
| 1820 } |
| 1821 |
| 1732 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { | 1822 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { |
| 1733 const gfx::Size old_size = GetPreferredSize(); | 1823 const gfx::Size old_size = GetPreferredSize(); |
| 1734 preferred_size_ = pref_size; | 1824 preferred_size_ = pref_size; |
| 1735 OnPreferredSizeChanged(old_size); | 1825 OnPreferredSizeChanged(old_size); |
| 1736 } | 1826 } |
| 1737 | 1827 |
| 1738 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { | 1828 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { |
| 1739 if (delegate_) | 1829 if (delegate_) |
| 1740 delegate_->ResizeDueToAutoResize(this, new_size); | 1830 delegate_->ResizeDueToAutoResize(this, new_size); |
| 1741 } | 1831 } |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3161 const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { | 3251 const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { |
| 3162 return GetLastCommittedURL(); | 3252 return GetLastCommittedURL(); |
| 3163 } | 3253 } |
| 3164 | 3254 |
| 3165 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { | 3255 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { |
| 3166 // Note this is only for subframes, the notification for the main frame | 3256 // Note this is only for subframes, the notification for the main frame |
| 3167 // happens in RenderViewCreated. | 3257 // happens in RenderViewCreated. |
| 3168 FOR_EACH_OBSERVER(WebContentsObserver, | 3258 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3169 observers_, | 3259 observers_, |
| 3170 RenderFrameCreated(render_frame_host)); | 3260 RenderFrameCreated(render_frame_host)); |
| 3261 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); |
| 3171 } | 3262 } |
| 3172 | 3263 |
| 3173 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { | 3264 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { |
| 3174 ClearPowerSaveBlockers(render_frame_host); | 3265 ClearPowerSaveBlockers(render_frame_host); |
| 3175 FOR_EACH_OBSERVER(WebContentsObserver, | 3266 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3176 observers_, | 3267 observers_, |
| 3177 RenderFrameDeleted(render_frame_host)); | 3268 RenderFrameDeleted(render_frame_host)); |
| 3178 } | 3269 } |
| 3179 | 3270 |
| 3180 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { | 3271 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3283 WebContents* WebContentsImpl::GetAsWebContents() { | 3374 WebContents* WebContentsImpl::GetAsWebContents() { |
| 3284 return this; | 3375 return this; |
| 3285 } | 3376 } |
| 3286 | 3377 |
| 3287 bool WebContentsImpl::IsNeverVisible() { | 3378 bool WebContentsImpl::IsNeverVisible() { |
| 3288 if (!delegate_) | 3379 if (!delegate_) |
| 3289 return false; | 3380 return false; |
| 3290 return delegate_->IsNeverVisible(this); | 3381 return delegate_->IsNeverVisible(this); |
| 3291 } | 3382 } |
| 3292 | 3383 |
| 3384 #if defined(OS_WIN) |
| 3385 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { |
| 3386 return accessible_parent_; |
| 3387 } |
| 3388 #endif |
| 3389 |
| 3293 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { | 3390 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { |
| 3294 return render_view_host_delegate_view_; | 3391 return render_view_host_delegate_view_; |
| 3295 } | 3392 } |
| 3296 | 3393 |
| 3297 RendererPreferences WebContentsImpl::GetRendererPrefs( | 3394 RendererPreferences WebContentsImpl::GetRendererPrefs( |
| 3298 BrowserContext* browser_context) const { | 3395 BrowserContext* browser_context) const { |
| 3299 return renderer_preferences_; | 3396 return renderer_preferences_; |
| 3300 } | 3397 } |
| 3301 | 3398 |
| 3302 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { | 3399 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 | 3438 |
| 3342 FOR_EACH_OBSERVER( | 3439 FOR_EACH_OBSERVER( |
| 3343 WebContentsObserver, observers_, RenderViewCreated(render_view_host)); | 3440 WebContentsObserver, observers_, RenderViewCreated(render_view_host)); |
| 3344 | 3441 |
| 3345 // We tell the observers now instead of when the main RenderFrameHostImpl is | 3442 // We tell the observers now instead of when the main RenderFrameHostImpl is |
| 3346 // constructed because otherwise it would be too early (i.e. IPCs sent to the | 3443 // constructed because otherwise it would be too early (i.e. IPCs sent to the |
| 3347 // frame would be dropped because it's not created yet). | 3444 // frame would be dropped because it's not created yet). |
| 3348 RenderFrameHost* main_frame = render_view_host->GetMainFrame(); | 3445 RenderFrameHost* main_frame = render_view_host->GetMainFrame(); |
| 3349 FOR_EACH_OBSERVER( | 3446 FOR_EACH_OBSERVER( |
| 3350 WebContentsObserver, observers_, RenderFrameCreated(main_frame)); | 3447 WebContentsObserver, observers_, RenderFrameCreated(main_frame)); |
| 3448 SetAccessibilityModeOnFrame(accessibility_mode_, main_frame); |
| 3351 } | 3449 } |
| 3352 | 3450 |
| 3353 void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) { | 3451 void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) { |
| 3354 if (rvh != GetRenderViewHost()) { | 3452 if (rvh != GetRenderViewHost()) { |
| 3355 // Don't notify the world, since this came from a renderer in the | 3453 // Don't notify the world, since this came from a renderer in the |
| 3356 // background. | 3454 // background. |
| 3357 return; | 3455 return; |
| 3358 } | 3456 } |
| 3359 | 3457 |
| 3360 notify_disconnection_ = true; | 3458 notify_disconnection_ = true; |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4100 if (new_size != old_size) | 4198 if (new_size != old_size) |
| 4101 delegate_->UpdatePreferredSize(this, new_size); | 4199 delegate_->UpdatePreferredSize(this, new_size); |
| 4102 } | 4200 } |
| 4103 | 4201 |
| 4104 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4202 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
| 4105 FrameTreeNode* node = frame_tree_.root(); | 4203 FrameTreeNode* node = frame_tree_.root(); |
| 4106 node->render_manager()->ResumeResponseDeferredAtStart(); | 4204 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4107 } | 4205 } |
| 4108 | 4206 |
| 4109 } // namespace content | 4207 } // namespace content |
| OLD | NEW |