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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 } | 1024 } |
1025 | 1025 |
1026 uint64 WebContentsImpl::GetUploadSize() const { | 1026 uint64 WebContentsImpl::GetUploadSize() const { |
1027 return upload_size_; | 1027 return upload_size_; |
1028 } | 1028 } |
1029 | 1029 |
1030 uint64 WebContentsImpl::GetUploadPosition() const { | 1030 uint64 WebContentsImpl::GetUploadPosition() const { |
1031 return upload_position_; | 1031 return upload_position_; |
1032 } | 1032 } |
1033 | 1033 |
| 1034 std::set<GURL> WebContentsImpl::GetSitesInTab() const { |
| 1035 BrowserContext* browser_context = GetBrowserContext(); |
| 1036 std::set<GURL> sites; |
| 1037 if (!frame_tree_root_.get()) |
| 1038 return sites; |
| 1039 |
| 1040 // Iterates over the FrameTreeNodes to find each unique site URL that is |
| 1041 // currently committed. |
| 1042 FrameTreeNode* node = NULL; |
| 1043 std::queue<FrameTreeNode*> queue; |
| 1044 queue.push(frame_tree_root_.get()); |
| 1045 |
| 1046 while (!queue.empty()) { |
| 1047 node = queue.front(); |
| 1048 queue.pop(); |
| 1049 sites.insert(SiteInstance::GetSiteForURL(browser_context, |
| 1050 node->current_url())); |
| 1051 |
| 1052 for (size_t i = 0; i < node->child_count(); ++i) |
| 1053 queue.push(node->child_at(i)); |
| 1054 } |
| 1055 |
| 1056 return sites; |
| 1057 } |
| 1058 |
1034 const std::string& WebContentsImpl::GetEncoding() const { | 1059 const std::string& WebContentsImpl::GetEncoding() const { |
1035 return encoding_; | 1060 return encoding_; |
1036 } | 1061 } |
1037 | 1062 |
1038 bool WebContentsImpl::DisplayedInsecureContent() const { | 1063 bool WebContentsImpl::DisplayedInsecureContent() const { |
1039 return displayed_insecure_content_; | 1064 return displayed_insecure_content_; |
1040 } | 1065 } |
1041 | 1066 |
1042 void WebContentsImpl::IncrementCapturerCount() { | 1067 void WebContentsImpl::IncrementCapturerCount() { |
1043 DCHECK(!is_being_destroyed_); | 1068 DCHECK(!is_being_destroyed_); |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2933 // RenderView::UpdateURL does not set params.contents_mime_type. | 2958 // RenderView::UpdateURL does not set params.contents_mime_type. |
2934 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) | 2959 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) |
2935 // TODO(jungshik): Add a test for the encoding menu to avoid | 2960 // TODO(jungshik): Add a test for the encoding menu to avoid |
2936 // regressing it again. | 2961 // regressing it again. |
2937 if (PageTransitionIsMainFrame(params.transition)) | 2962 if (PageTransitionIsMainFrame(params.transition)) |
2938 contents_mime_type_ = params.contents_mime_type; | 2963 contents_mime_type_ = params.contents_mime_type; |
2939 | 2964 |
2940 LoadCommittedDetails details; | 2965 LoadCommittedDetails details; |
2941 bool did_navigate = controller_.RendererDidNavigate(params, &details); | 2966 bool did_navigate = controller_.RendererDidNavigate(params, &details); |
2942 | 2967 |
| 2968 // For now, keep track of each frame's URL in its FrameTreeNode. This lets |
| 2969 // us estimate our process count for implementing OOP iframes. |
| 2970 // TODO(creis): Remove this when we track which pages commit in each frame. |
| 2971 FrameTreeNode* node = FindFrameTreeNodeByID(params.frame_id); |
| 2972 if (node) |
| 2973 node->set_current_url(params.url); |
| 2974 |
2943 // Send notification about committed provisional loads. This notification is | 2975 // Send notification about committed provisional loads. This notification is |
2944 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 2976 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
2945 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 2977 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
2946 if (details.type != NAVIGATION_TYPE_NAV_IGNORE) { | 2978 if (details.type != NAVIGATION_TYPE_NAV_IGNORE) { |
2947 // For AUTO_SUBFRAME navigations, an event for the main frame is generated | 2979 // For AUTO_SUBFRAME navigations, an event for the main frame is generated |
2948 // that is not recorded in the navigation history. For the purpose of | 2980 // that is not recorded in the navigation history. For the purpose of |
2949 // tracking navigation events, we treat this event as a sub frame navigation | 2981 // tracking navigation events, we treat this event as a sub frame navigation |
2950 // event. | 2982 // event. |
2951 bool is_main_frame = did_navigate ? details.is_main_frame : false; | 2983 bool is_main_frame = did_navigate ? details.is_main_frame : false; |
2952 PageTransition transition_type = params.transition; | 2984 PageTransition transition_type = params.transition; |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3662 } | 3694 } |
3663 | 3695 |
3664 BrowserPluginGuestManager* | 3696 BrowserPluginGuestManager* |
3665 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3697 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3666 return static_cast<BrowserPluginGuestManager*>( | 3698 return static_cast<BrowserPluginGuestManager*>( |
3667 GetBrowserContext()->GetUserData( | 3699 GetBrowserContext()->GetUserData( |
3668 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3700 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3669 } | 3701 } |
3670 | 3702 |
3671 } // namespace content | 3703 } // namespace content |
OLD | NEW |