diff options
Diffstat (limited to 'content/browser/web_contents/web_contents_impl.cc')
-rw-r--r-- | content/browser/web_contents/web_contents_impl.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index c9c8ddd..7ba6c58 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -1029,6 +1029,31 @@ uint64 WebContentsImpl::GetUploadPosition() const { return upload_position_; } +std::set<GURL> WebContentsImpl::GetSitesInTab() const { + BrowserContext* browser_context = GetBrowserContext(); + std::set<GURL> sites; + if (!frame_tree_root_.get()) + return sites; + + // Iterates over the FrameTreeNodes to find each unique site URL that is + // currently committed. + FrameTreeNode* node = NULL; + std::queue<FrameTreeNode*> queue; + queue.push(frame_tree_root_.get()); + + while (!queue.empty()) { + node = queue.front(); + queue.pop(); + sites.insert(SiteInstance::GetSiteForURL(browser_context, + node->current_url())); + + for (size_t i = 0; i < node->child_count(); ++i) + queue.push(node->child_at(i)); + } + + return sites; +} + const std::string& WebContentsImpl::GetEncoding() const { return encoding_; } @@ -2940,6 +2965,13 @@ void WebContentsImpl::DidNavigate( LoadCommittedDetails details; bool did_navigate = controller_.RendererDidNavigate(params, &details); + // For now, keep track of each frame's URL in its FrameTreeNode. This lets + // us estimate our process count for implementing OOP iframes. + // TODO(creis): Remove this when we track which pages commit in each frame. + FrameTreeNode* node = FindFrameTreeNodeByID(params.frame_id); + if (node) + node->set_current_url(params.url); + // Send notification about committed provisional loads. This notification is // different from the NAV_ENTRY_COMMITTED notification which doesn't include // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |