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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void NotifyCacheOnIO( | 160 void NotifyCacheOnIO( |
161 scoped_refptr<net::URLRequestContextGetter> request_context, | 161 scoped_refptr<net::URLRequestContextGetter> request_context, |
162 const GURL& url, | 162 const GURL& url, |
163 const std::string& http_method) { | 163 const std::string& http_method) { |
164 net::HttpCache* cache = request_context->GetURLRequestContext()-> | 164 net::HttpCache* cache = request_context->GetURLRequestContext()-> |
165 http_transaction_factory()->GetCache(); | 165 http_transaction_factory()->GetCache(); |
166 if (cache) | 166 if (cache) |
167 cache->OnExternalCacheHit(url, http_method); | 167 cache->OnExternalCacheHit(url, http_method); |
168 } | 168 } |
169 | 169 |
170 // Helper function for retrieving all the sites in a frame tree. | |
171 bool CollectSites(BrowserContext* context, | |
172 std::set<GURL>* sites, | |
173 FrameTreeNode* node) { | |
174 // Record about:blank as a real (process-having) site only if the SiteInstance | |
175 // is unassigned. Do not otherwise depend on the siteinstance's site URL, | |
176 // since its value reflects the current process model, and this function | |
177 // should behave identically across all process models. | |
178 if (node->current_url() == GURL(url::kAboutBlankURL) && | |
179 node->current_frame_host()->GetSiteInstance()->HasSite()) { | |
180 return true; | |
181 } | |
182 sites->insert(SiteInstance::GetSiteForURL(context, node->current_url())); | |
183 return true; | |
184 } | |
185 | |
186 bool FindMatchingProcess(int render_process_id, | 170 bool FindMatchingProcess(int render_process_id, |
187 bool* did_match_process, | 171 bool* did_match_process, |
188 FrameTreeNode* node) { | 172 FrameTreeNode* node) { |
189 if (node->current_frame_host()->GetProcess()->GetID() == render_process_id) { | 173 if (node->current_frame_host()->GetProcess()->GetID() == render_process_id) { |
190 *did_match_process = true; | 174 *did_match_process = true; |
191 return false; | 175 return false; |
192 } | 176 } |
193 return true; | 177 return true; |
194 } | 178 } |
195 | 179 |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } | 1012 } |
1029 | 1013 |
1030 uint64 WebContentsImpl::GetUploadSize() const { | 1014 uint64 WebContentsImpl::GetUploadSize() const { |
1031 return upload_size_; | 1015 return upload_size_; |
1032 } | 1016 } |
1033 | 1017 |
1034 uint64 WebContentsImpl::GetUploadPosition() const { | 1018 uint64 WebContentsImpl::GetUploadPosition() const { |
1035 return upload_position_; | 1019 return upload_position_; |
1036 } | 1020 } |
1037 | 1021 |
1038 std::set<GURL> WebContentsImpl::GetSitesInTab() const { | |
1039 std::set<GURL> sites; | |
1040 frame_tree_.ForEach(base::Bind(&CollectSites, | |
1041 base::Unretained(GetBrowserContext()), | |
1042 base::Unretained(&sites))); | |
1043 return sites; | |
1044 } | |
1045 | |
1046 const std::string& WebContentsImpl::GetEncoding() const { | 1022 const std::string& WebContentsImpl::GetEncoding() const { |
1047 return canonical_encoding_; | 1023 return canonical_encoding_; |
1048 } | 1024 } |
1049 | 1025 |
1050 bool WebContentsImpl::DisplayedInsecureContent() const { | 1026 bool WebContentsImpl::DisplayedInsecureContent() const { |
1051 return displayed_insecure_content_; | 1027 return displayed_insecure_content_; |
1052 } | 1028 } |
1053 | 1029 |
1054 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { | 1030 void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) { |
1055 DCHECK(!is_being_destroyed_); | 1031 DCHECK(!is_being_destroyed_); |
(...skipping 3611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4667 return NULL; | 4643 return NULL; |
4668 } | 4644 } |
4669 | 4645 |
4670 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4646 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4671 force_disable_overscroll_content_ = force_disable; | 4647 force_disable_overscroll_content_ = force_disable; |
4672 if (view_) | 4648 if (view_) |
4673 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4649 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4674 } | 4650 } |
4675 | 4651 |
4676 } // namespace content | 4652 } // namespace content |
OLD | NEW |