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" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 } | 261 } |
262 | 262 |
263 void NotifyCacheOnIO( | 263 void NotifyCacheOnIO( |
264 scoped_refptr<net::URLRequestContextGetter> request_context, | 264 scoped_refptr<net::URLRequestContextGetter> request_context, |
265 const GURL& url, | 265 const GURL& url, |
266 const std::string& http_method) { | 266 const std::string& http_method) { |
267 request_context->GetURLRequestContext()->http_transaction_factory()-> | 267 request_context->GetURLRequestContext()->http_transaction_factory()-> |
268 GetCache()->OnExternalCacheHit(url, http_method); | 268 GetCache()->OnExternalCacheHit(url, http_method); |
269 } | 269 } |
270 | 270 |
271 // Helper function for retrieving all the sites in a frame tree. | |
272 bool CollectSites(BrowserContext* context, | |
273 std::set<GURL>* sites, | |
274 FrameTreeNode* node) { | |
275 sites->insert(SiteInstance::GetSiteForURL(context, node->current_url())); | |
276 return true; | |
277 } | |
278 | |
271 } // namespace | 279 } // namespace |
272 | 280 |
273 WebContents* WebContents::Create(const WebContents::CreateParams& params) { | 281 WebContents* WebContents::Create(const WebContents::CreateParams& params) { |
274 return WebContentsImpl::CreateWithOpener( | 282 return WebContentsImpl::CreateWithOpener( |
275 params, static_cast<WebContentsImpl*>(params.opener)); | 283 params, static_cast<WebContentsImpl*>(params.opener)); |
276 } | 284 } |
277 | 285 |
278 WebContents* WebContents::CreateWithSessionStorage( | 286 WebContents* WebContents::CreateWithSessionStorage( |
279 const WebContents::CreateParams& params, | 287 const WebContents::CreateParams& params, |
280 const SessionStorageNamespaceMap& session_storage_namespace_map) { | 288 const SessionStorageNamespaceMap& session_storage_namespace_map) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 is_showing_before_unload_dialog_(false), | 367 is_showing_before_unload_dialog_(false), |
360 closed_by_user_gesture_(false), | 368 closed_by_user_gesture_(false), |
361 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 369 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
362 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 370 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
363 temporary_zoom_settings_(false), | 371 temporary_zoom_settings_(false), |
364 color_chooser_identifier_(0), | 372 color_chooser_identifier_(0), |
365 message_source_(NULL), | 373 message_source_(NULL), |
366 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { | 374 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
367 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 375 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
368 g_created_callbacks.Get().at(i).Run(this); | 376 g_created_callbacks.Get().at(i).Run(this); |
377 frame_tree_.SetFrameRemoveListener( | |
378 base::Bind(&WebContentsImpl::OnFrameRemoved, | |
379 base::Unretained(this))); | |
380 | |
Charlie Reis
2013/09/27 19:19:21
nit: Remove blank line.
awong
2013/09/27 20:50:09
Done.
| |
369 } | 381 } |
370 | 382 |
371 WebContentsImpl::~WebContentsImpl() { | 383 WebContentsImpl::~WebContentsImpl() { |
372 is_being_destroyed_ = true; | 384 is_being_destroyed_ = true; |
373 | 385 |
374 ClearAllPowerSaveBlockers(); | 386 ClearAllPowerSaveBlockers(); |
375 | 387 |
376 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 388 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
377 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 389 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
378 (*iter)->DetachDelegate(); | 390 (*iter)->DetachDelegate(); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
705 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, | 717 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, |
706 OnBrowserPluginMessage(message)) | 718 OnBrowserPluginMessage(message)) |
707 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) | 719 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) |
708 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 720 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
709 #if defined(OS_ANDROID) | 721 #if defined(OS_ANDROID) |
710 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, | 722 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, |
711 OnFindMatchRectsReply) | 723 OnFindMatchRectsReply) |
712 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 724 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
713 OnOpenDateTimeDialog) | 725 OnOpenDateTimeDialog) |
714 #endif | 726 #endif |
715 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameAttached, OnFrameAttached) | |
716 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameDetached, OnFrameDetached) | |
717 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification) | 727 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification) |
718 IPC_MESSAGE_UNHANDLED(handled = false) | 728 IPC_MESSAGE_UNHANDLED(handled = false) |
719 IPC_END_MESSAGE_MAP_EX() | 729 IPC_END_MESSAGE_MAP_EX() |
720 message_source_ = NULL; | 730 message_source_ = NULL; |
721 | 731 |
722 if (!message_is_ok) { | 732 if (!message_is_ok) { |
723 RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 733 RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
724 GetRenderProcessHost()->ReceivedBadMessage(); | 734 GetRenderProcessHost()->ReceivedBadMessage(); |
725 } | 735 } |
726 | 736 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 | 1018 |
1009 uint64 WebContentsImpl::GetUploadSize() const { | 1019 uint64 WebContentsImpl::GetUploadSize() const { |
1010 return upload_size_; | 1020 return upload_size_; |
1011 } | 1021 } |
1012 | 1022 |
1013 uint64 WebContentsImpl::GetUploadPosition() const { | 1023 uint64 WebContentsImpl::GetUploadPosition() const { |
1014 return upload_position_; | 1024 return upload_position_; |
1015 } | 1025 } |
1016 | 1026 |
1017 std::set<GURL> WebContentsImpl::GetSitesInTab() const { | 1027 std::set<GURL> WebContentsImpl::GetSitesInTab() const { |
1018 BrowserContext* browser_context = GetBrowserContext(); | |
1019 std::set<GURL> sites; | 1028 std::set<GURL> sites; |
1020 if (!frame_tree_root_.get()) | 1029 frame_tree_.ForEach(Bind(&CollectSites, |
1021 return sites; | 1030 base::Unretained(GetBrowserContext()), |
1022 | 1031 base::Unretained(&sites))); |
1023 // Iterates over the FrameTreeNodes to find each unique site URL that is | |
1024 // currently committed. | |
1025 FrameTreeNode* node = NULL; | |
1026 std::queue<FrameTreeNode*> queue; | |
1027 queue.push(frame_tree_root_.get()); | |
1028 | |
1029 while (!queue.empty()) { | |
1030 node = queue.front(); | |
1031 queue.pop(); | |
1032 sites.insert(SiteInstance::GetSiteForURL(browser_context, | |
1033 node->current_url())); | |
1034 | |
1035 for (size_t i = 0; i < node->child_count(); ++i) | |
1036 queue.push(node->child_at(i)); | |
1037 } | |
1038 | |
1039 return sites; | 1032 return sites; |
1040 } | 1033 } |
1041 | 1034 |
1042 const std::string& WebContentsImpl::GetEncoding() const { | 1035 const std::string& WebContentsImpl::GetEncoding() const { |
1043 return encoding_; | 1036 return encoding_; |
1044 } | 1037 } |
1045 | 1038 |
1046 bool WebContentsImpl::DisplayedInsecureContent() const { | 1039 bool WebContentsImpl::DisplayedInsecureContent() const { |
1047 return displayed_insecure_content_; | 1040 return displayed_insecure_content_; |
1048 } | 1041 } |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1722 delegate_->RequestMediaAccessPermission(this, request, callback); | 1715 delegate_->RequestMediaAccessPermission(this, request, callback); |
1723 else | 1716 else |
1724 callback.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); | 1717 callback.Run(MediaStreamDevices(), scoped_ptr<MediaStreamUI>()); |
1725 } | 1718 } |
1726 | 1719 |
1727 SessionStorageNamespace* WebContentsImpl::GetSessionStorageNamespace( | 1720 SessionStorageNamespace* WebContentsImpl::GetSessionStorageNamespace( |
1728 SiteInstance* instance) { | 1721 SiteInstance* instance) { |
1729 return controller_.GetSessionStorageNamespace(instance); | 1722 return controller_.GetSessionStorageNamespace(instance); |
1730 } | 1723 } |
1731 | 1724 |
1725 FrameTree* WebContentsImpl::GetFrameTree() { | |
1726 return &frame_tree_; | |
1727 } | |
1728 | |
1732 void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) { | 1729 void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) { |
1733 if (browser_plugin_embedder_) | 1730 if (browser_plugin_embedder_) |
1734 browser_plugin_embedder_->DidSendScreenRects(); | 1731 browser_plugin_embedder_->DidSendScreenRects(); |
1735 } | 1732 } |
1736 | 1733 |
1737 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { | 1734 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { |
1738 preferred_size_ = pref_size; | 1735 preferred_size_ = pref_size; |
1739 if (delegate_) | 1736 if (delegate_) |
1740 delegate_->UpdatePreferredSize(this, pref_size); | 1737 delegate_->UpdatePreferredSize(this, pref_size); |
1741 } | 1738 } |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2621 image_download_map_.erase(id); | 2618 image_download_map_.erase(id); |
2622 } | 2619 } |
2623 | 2620 |
2624 void WebContentsImpl::OnUpdateFaviconURL( | 2621 void WebContentsImpl::OnUpdateFaviconURL( |
2625 int32 page_id, | 2622 int32 page_id, |
2626 const std::vector<FaviconURL>& candidates) { | 2623 const std::vector<FaviconURL>& candidates) { |
2627 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2624 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2628 DidUpdateFaviconURL(page_id, candidates)); | 2625 DidUpdateFaviconURL(page_id, candidates)); |
2629 } | 2626 } |
2630 | 2627 |
2631 FrameTreeNode* WebContentsImpl::FindFrameTreeNodeByID(int64 frame_id) { | |
2632 // TODO(nasko): Remove this check once we move to creating the root node | |
2633 // through RenderFrameHost creation. | |
2634 if (!frame_tree_root_.get()) | |
2635 return NULL; | |
2636 | |
2637 FrameTreeNode* node = NULL; | |
2638 std::queue<FrameTreeNode*> queue; | |
2639 queue.push(frame_tree_root_.get()); | |
2640 | |
2641 while (!queue.empty()) { | |
2642 node = queue.front(); | |
2643 queue.pop(); | |
2644 if (node->frame_id() == frame_id) | |
2645 return node; | |
2646 | |
2647 for (size_t i = 0; i < node->child_count(); ++i) | |
2648 queue.push(node->child_at(i)); | |
2649 } | |
2650 | |
2651 return NULL; | |
2652 } | |
2653 | |
2654 void WebContentsImpl::OnFrameAttached( | |
2655 int64 parent_frame_id, | |
2656 int64 frame_id, | |
2657 const std::string& frame_name) { | |
2658 FrameTreeNode* parent = FindFrameTreeNodeByID(parent_frame_id); | |
2659 if (!parent) | |
2660 return; | |
2661 | |
2662 FrameTreeNode* node = new FrameTreeNode(frame_id, frame_name); | |
2663 parent->AddChild(node); | |
2664 } | |
2665 | |
2666 void WebContentsImpl::OnFrameDetached(int64 parent_frame_id, int64 frame_id) { | |
2667 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
2668 FrameDetached(message_source_, frame_id)); | |
2669 | |
2670 FrameTreeNode* parent = FindFrameTreeNodeByID(parent_frame_id); | |
2671 if (!parent) | |
2672 return; | |
2673 | |
2674 parent->RemoveChild(frame_id); | |
2675 } | |
2676 | |
2677 void WebContentsImpl::OnMediaNotification(int64 player_cookie, | 2628 void WebContentsImpl::OnMediaNotification(int64 player_cookie, |
2678 bool has_video, | 2629 bool has_video, |
2679 bool has_audio, | 2630 bool has_audio, |
2680 bool is_playing) { | 2631 bool is_playing) { |
2681 // Chrome OS does its own detection of audio and video. | 2632 // Chrome OS does its own detection of audio and video. |
2682 #if !defined(OS_CHROMEOS) | 2633 #if !defined(OS_CHROMEOS) |
2683 if (is_playing) { | 2634 if (is_playing) { |
2684 scoped_ptr<PowerSaveBlocker> blocker; | 2635 scoped_ptr<PowerSaveBlocker> blocker; |
2685 if (has_video) { | 2636 if (has_video) { |
2686 blocker = PowerSaveBlocker::Create( | 2637 blocker = PowerSaveBlocker::Create( |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3036 // TODO(avi): Remove. http://crbug.com/170921 | 2987 // TODO(avi): Remove. http://crbug.com/170921 |
3037 NotificationService::current()->Notify( | 2988 NotificationService::current()->Notify( |
3038 NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 2989 NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
3039 Source<WebContents>(this), | 2990 Source<WebContents>(this), |
3040 Details<const ResourceRedirectDetails>(&details)); | 2991 Details<const ResourceRedirectDetails>(&details)); |
3041 } | 2992 } |
3042 | 2993 |
3043 void WebContentsImpl::DidNavigate( | 2994 void WebContentsImpl::DidNavigate( |
3044 RenderViewHost* rvh, | 2995 RenderViewHost* rvh, |
3045 const ViewHostMsg_FrameNavigate_Params& params) { | 2996 const ViewHostMsg_FrameNavigate_Params& params) { |
3046 // If we don't have a frame tree root yet, this is the first navigation in | 2997 if (frame_tree_.IsFirstNavigationAfterSwap()) { |
3047 // using the current RenderViewHost, so we need to create it with the proper | 2998 // First navigation should be a main frame navigation. |
3048 // frame id. | |
3049 if (!frame_tree_root_.get()) { | |
3050 DCHECK(PageTransitionIsMainFrame(params.transition)); | 2999 DCHECK(PageTransitionIsMainFrame(params.transition)); |
3051 frame_tree_root_.reset(new FrameTreeNode(params.frame_id, std::string())); | 3000 frame_tree_.OnFirstNavigationAfterSwap(params.frame_id); |
3052 } | 3001 } |
3053 | 3002 |
3054 if (PageTransitionIsMainFrame(params.transition)) { | 3003 if (PageTransitionIsMainFrame(params.transition)) { |
3055 // When overscroll navigation gesture is enabled, a screenshot of the page | 3004 // When overscroll navigation gesture is enabled, a screenshot of the page |
3056 // in its current state is taken so that it can be used during the | 3005 // in its current state is taken so that it can be used during the |
3057 // nav-gesture. It is necessary to take the screenshot here, before calling | 3006 // nav-gesture. It is necessary to take the screenshot here, before calling |
3058 // RenderViewHostManager::DidNavigateMainFrame, because that can change | 3007 // RenderViewHostManager::DidNavigateMainFrame, because that can change |
3059 // WebContents::GetRenderViewHost to return the new host, instead of the one | 3008 // WebContents::GetRenderViewHost to return the new host, instead of the one |
3060 // that may have just been swapped out. | 3009 // that may have just been swapped out. |
3061 if (delegate_ && delegate_->CanOverscrollContent()) | 3010 if (delegate_ && delegate_->CanOverscrollContent()) |
3062 controller_.TakeScreenshot(); | 3011 controller_.TakeScreenshot(); |
3063 | 3012 |
3064 render_manager_.DidNavigateMainFrame(rvh); | 3013 render_manager_.DidNavigateMainFrame(rvh); |
3065 } | 3014 } |
3066 | 3015 |
3067 // We expect to have a valid frame tree root node at all times when | |
3068 // navigating. | |
3069 DCHECK(frame_tree_root_.get()); | |
3070 | |
3071 // Update the site of the SiteInstance if it doesn't have one yet, unless | 3016 // Update the site of the SiteInstance if it doesn't have one yet, unless |
3072 // assigning a site is not necessary for this URL. In that case, the | 3017 // assigning a site is not necessary for this URL. In that case, the |
3073 // SiteInstance can still be considered unused until a navigation to a real | 3018 // SiteInstance can still be considered unused until a navigation to a real |
3074 // page. | 3019 // page. |
3075 if (!static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite() && | 3020 if (!static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite() && |
3076 ShouldAssignSiteForURL(params.url)) { | 3021 ShouldAssignSiteForURL(params.url)) { |
3077 static_cast<SiteInstanceImpl*>(GetSiteInstance())->SetSite(params.url); | 3022 static_cast<SiteInstanceImpl*>(GetSiteInstance())->SetSite(params.url); |
3078 } | 3023 } |
3079 | 3024 |
3080 // Need to update MIME type here because it's referred to in | 3025 // Need to update MIME type here because it's referred to in |
3081 // UpdateNavigationCommands() called by RendererDidNavigate() to | 3026 // UpdateNavigationCommands() called by RendererDidNavigate() to |
3082 // determine whether or not to enable the encoding menu. | 3027 // determine whether or not to enable the encoding menu. |
3083 // It's updated only for the main frame. For a subframe, | 3028 // It's updated only for the main frame. For a subframe, |
3084 // RenderView::UpdateURL does not set params.contents_mime_type. | 3029 // RenderView::UpdateURL does not set params.contents_mime_type. |
3085 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) | 3030 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) |
3086 // TODO(jungshik): Add a test for the encoding menu to avoid | 3031 // TODO(jungshik): Add a test for the encoding menu to avoid |
3087 // regressing it again. | 3032 // regressing it again. |
3088 if (PageTransitionIsMainFrame(params.transition)) | 3033 if (PageTransitionIsMainFrame(params.transition)) |
3089 contents_mime_type_ = params.contents_mime_type; | 3034 contents_mime_type_ = params.contents_mime_type; |
3090 | 3035 |
3091 LoadCommittedDetails details; | 3036 LoadCommittedDetails details; |
3092 bool did_navigate = controller_.RendererDidNavigate(params, &details); | 3037 bool did_navigate = controller_.RendererDidNavigate(params, &details); |
3093 | 3038 |
3094 // For now, keep track of each frame's URL in its FrameTreeNode. This lets | 3039 // For now, keep track of each frame's URL in its FrameTreeNode. This lets |
3095 // us estimate our process count for implementing OOP iframes. | 3040 // us estimate our process count for implementing OOP iframes. |
3096 // TODO(creis): Remove this when we track which pages commit in each frame. | 3041 // TODO(creis): Remove this when we track which pages commit in each frame. |
3097 FrameTreeNode* node = FindFrameTreeNodeByID(params.frame_id); | 3042 frame_tree_.SetFrameUrl(params.frame_id, params.url); |
3098 if (node) | |
3099 node->set_current_url(params.url); | |
3100 | 3043 |
3101 // Send notification about committed provisional loads. This notification is | 3044 // Send notification about committed provisional loads. This notification is |
3102 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 3045 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
3103 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 3046 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
3104 if (details.type != NAVIGATION_TYPE_NAV_IGNORE) { | 3047 if (details.type != NAVIGATION_TYPE_NAV_IGNORE) { |
3105 // For AUTO_SUBFRAME navigations, an event for the main frame is generated | 3048 // For AUTO_SUBFRAME navigations, an event for the main frame is generated |
3106 // that is not recorded in the navigation history. For the purpose of | 3049 // that is not recorded in the navigation history. For the purpose of |
3107 // tracking navigation events, we treat this event as a sub frame navigation | 3050 // tracking navigation events, we treat this event as a sub frame navigation |
3108 // event. | 3051 // event. |
3109 bool is_main_frame = did_navigate ? details.is_main_frame : false; | 3052 bool is_main_frame = did_navigate ? details.is_main_frame : false; |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3667 } | 3610 } |
3668 | 3611 |
3669 void WebContentsImpl::NotifySwappedFromRenderManager(RenderViewHost* rvh) { | 3612 void WebContentsImpl::NotifySwappedFromRenderManager(RenderViewHost* rvh) { |
3670 NotifySwapped(rvh); | 3613 NotifySwapped(rvh); |
3671 | 3614 |
3672 // Make sure the visible RVH reflects the new delegate's preferences. | 3615 // Make sure the visible RVH reflects the new delegate's preferences. |
3673 if (delegate_) | 3616 if (delegate_) |
3674 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); | 3617 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); |
3675 | 3618 |
3676 view_->RenderViewSwappedIn(render_manager_.current_host()); | 3619 view_->RenderViewSwappedIn(render_manager_.current_host()); |
3677 | |
3678 FrameTreeNode* root = NULL; | |
3679 RenderViewHostImpl* new_rvh = static_cast<RenderViewHostImpl*>( | |
3680 render_manager_.current_host()); | |
3681 | |
3682 // We are doing a cross-site navigation and swapping processes. Since frame | |
3683 // ids are unique to a process, we need to recreate the frame tree with the | |
3684 // proper main frame id. | |
3685 // Note that it is possible for this method to be called before the new RVH | |
3686 // has committed a navigation (if RenderViewHostManager short-circuits the | |
3687 // CommitPending call because the current RVH is dead). In that case, we | |
3688 // haven't heard a valid frame id to use to initialize the root node, so clear | |
3689 // out the root node and the first subsequent navigation message will set it | |
3690 // correctly. | |
3691 if (new_rvh->main_frame_id() != -1) | |
3692 root = new FrameTreeNode(new_rvh->main_frame_id(), std::string()); | |
3693 | |
3694 frame_tree_root_.reset(root); | |
3695 } | 3620 } |
3696 | 3621 |
3697 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( | 3622 int WebContentsImpl::CreateOpenerRenderViewsForRenderManager( |
3698 SiteInstance* instance) { | 3623 SiteInstance* instance) { |
3699 if (!opener_) | 3624 if (!opener_) |
3700 return MSG_ROUTING_NONE; | 3625 return MSG_ROUTING_NONE; |
3701 | 3626 |
3702 // Recursively create RenderViews for anything else in the opener chain. | 3627 // Recursively create RenderViews for anything else in the opener chain. |
3703 return opener_->CreateOpenerRenderViews(instance); | 3628 return opener_->CreateOpenerRenderViews(instance); |
3704 } | 3629 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3858 | 3783 |
3859 gfx::Size WebContentsImpl::GetSizeForNewRenderView() const { | 3784 gfx::Size WebContentsImpl::GetSizeForNewRenderView() const { |
3860 gfx::Size size; | 3785 gfx::Size size; |
3861 if (delegate_) | 3786 if (delegate_) |
3862 size = delegate_->GetSizeForNewRenderView(this); | 3787 size = delegate_->GetSizeForNewRenderView(this); |
3863 if (size.IsEmpty()) | 3788 if (size.IsEmpty()) |
3864 size = view_->GetContainerSize(); | 3789 size = view_->GetContainerSize(); |
3865 return size; | 3790 return size; |
3866 } | 3791 } |
3867 | 3792 |
3793 void WebContentsImpl::OnFrameRemoved(int64 frame_id) { | |
3794 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
3795 FrameDetached(message_source_, frame_id)); | |
3796 } | |
3797 | |
3868 } // namespace content | 3798 } // namespace content |
OLD | NEW |