| 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_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 &old_tab_contents->web_contents()->GetController()); | 404 &old_tab_contents->web_contents()->GetController()); |
| 405 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> | 405 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> |
| 406 SwapTabContents(old_tab_contents->web_contents(), | 406 SwapTabContents(old_tab_contents->web_contents(), |
| 407 new_tab_contents->web_contents()); | 407 new_tab_contents->web_contents()); |
| 408 prerender_contents->CommitHistory(new_tab_contents); | 408 prerender_contents->CommitHistory(new_tab_contents); |
| 409 | 409 |
| 410 GURL icon_url = prerender_contents->icon_url(); | 410 GURL icon_url = prerender_contents->icon_url(); |
| 411 if (!icon_url.is_empty()) { | 411 if (!icon_url.is_empty()) { |
| 412 std::vector<FaviconURL> urls; | 412 std::vector<FaviconURL> urls; |
| 413 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 413 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); |
| 414 new_tab_contents->favicon_tab_helper()->OnUpdateFaviconURL( | 414 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> |
| 415 prerender_contents->page_id(), | 415 OnUpdateFaviconURL(prerender_contents->page_id(), urls); |
| 416 urls); | |
| 417 } | 416 } |
| 418 | 417 |
| 419 // Update PPLT metrics: | 418 // Update PPLT metrics: |
| 420 // If the tab has finished loading, record a PPLT of 0. | 419 // If the tab has finished loading, record a PPLT of 0. |
| 421 // If the tab is still loading, reset its start time to the current time. | 420 // If the tab is still loading, reset its start time to the current time. |
| 422 PrerenderTabHelper* prerender_tab_helper = | 421 PrerenderTabHelper* prerender_tab_helper = |
| 423 new_tab_contents->prerender_tab_helper(); | 422 new_tab_contents->prerender_tab_helper(); |
| 424 DCHECK(prerender_tab_helper != NULL); | 423 DCHECK(prerender_tab_helper != NULL); |
| 425 prerender_tab_helper->PrerenderSwappedIn(); | 424 prerender_tab_helper->PrerenderSwappedIn(); |
| 426 | 425 |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1296 if (!render_process_host || !render_process_host->GetBrowserContext()) |
| 1298 return NULL; | 1297 return NULL; |
| 1299 Profile* profile = Profile::FromBrowserContext( | 1298 Profile* profile = Profile::FromBrowserContext( |
| 1300 render_process_host->GetBrowserContext()); | 1299 render_process_host->GetBrowserContext()); |
| 1301 if (!profile) | 1300 if (!profile) |
| 1302 return NULL; | 1301 return NULL; |
| 1303 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1302 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
| 1304 } | 1303 } |
| 1305 | 1304 |
| 1306 } // namespace prerender | 1305 } // namespace prerender |
| OLD | NEW |