| 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 "chrome/browser/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // static | 226 // static |
| 227 PrerenderContents::Factory* PrerenderContents::CreateFactory() { | 227 PrerenderContents::Factory* PrerenderContents::CreateFactory() { |
| 228 return new PrerenderContentsFactoryImpl(); | 228 return new PrerenderContentsFactoryImpl(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // static | 231 // static |
| 232 PrerenderContents* PrerenderContents::FromWebContents( | 232 PrerenderContents* PrerenderContents::FromWebContents( |
| 233 content::WebContents* web_contents) { | 233 content::WebContents* web_contents) { |
| 234 if (!web_contents) | 234 if (!web_contents) |
| 235 return NULL; | 235 return NULL; |
| 236 PrerenderManager* prerender_manager = PrerenderManagerFactory::GetForProfile( | 236 PrerenderManager* prerender_manager = |
| 237 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 237 PrerenderManagerFactory::GetForBrowserContext( |
| 238 web_contents->GetBrowserContext()); |
| 238 if (!prerender_manager) | 239 if (!prerender_manager) |
| 239 return NULL; | 240 return NULL; |
| 240 return prerender_manager->GetPrerenderContents(web_contents); | 241 return prerender_manager->GetPrerenderContents(web_contents); |
| 241 } | 242 } |
| 242 | 243 |
| 243 void PrerenderContents::StartPrerendering( | 244 void PrerenderContents::StartPrerendering( |
| 244 const gfx::Rect& bounds, | 245 const gfx::Rect& bounds, |
| 245 SessionStorageNamespace* session_storage_namespace) { | 246 SessionStorageNamespace* session_storage_namespace) { |
| 246 DCHECK(profile_); | 247 DCHECK(profile_); |
| 247 DCHECK(!bounds.IsEmpty()); | 248 DCHECK(!bounds.IsEmpty()); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 void PrerenderContents::AddResourceThrottle( | 725 void PrerenderContents::AddResourceThrottle( |
| 725 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 726 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 726 resource_throttles_.push_back(throttle); | 727 resource_throttles_.push_back(throttle); |
| 727 } | 728 } |
| 728 | 729 |
| 729 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 730 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
| 730 network_bytes_ += bytes; | 731 network_bytes_ += bytes; |
| 731 } | 732 } |
| 732 | 733 |
| 733 } // namespace prerender | 734 } // namespace prerender |
| OLD | NEW |