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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 // Merge the browsing history. | 444 // Merge the browsing history. |
445 new_tab_contents->web_contents()->GetController().CopyStateFromAndPrune( | 445 new_tab_contents->web_contents()->GetController().CopyStateFromAndPrune( |
446 &old_tab_contents->web_contents()->GetController()); | 446 &old_tab_contents->web_contents()->GetController()); |
447 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> | 447 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> |
448 SwapTabContents(old_tab_contents->web_contents(), | 448 SwapTabContents(old_tab_contents->web_contents(), |
449 new_tab_contents->web_contents()); | 449 new_tab_contents->web_contents()); |
450 prerender_contents->CommitHistory(new_tab_contents); | 450 prerender_contents->CommitHistory(new_tab_contents); |
451 | 451 |
452 GURL icon_url = prerender_contents->icon_url(); | 452 GURL icon_url = prerender_contents->icon_url(); |
453 if (!icon_url.is_empty()) { | 453 if (!icon_url.is_empty()) { |
454 std::vector<FaviconURL> urls; | 454 std::vector<content::FaviconURL> urls; |
455 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 455 urls.push_back(content::FaviconURL(icon_url, content::FaviconURL::FAVICON)); |
456 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> | 456 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> |
457 OnUpdateFaviconURL(prerender_contents->page_id(), urls); | 457 DidUpdateFaviconURL(prerender_contents->page_id(), urls); |
458 } | 458 } |
459 | 459 |
460 // Update PPLT metrics: | 460 // Update PPLT metrics: |
461 // If the tab has finished loading, record a PPLT of 0. | 461 // If the tab has finished loading, record a PPLT of 0. |
462 // If the tab is still loading, reset its start time to the current time. | 462 // If the tab is still loading, reset its start time to the current time. |
463 PrerenderTabHelper* prerender_tab_helper = | 463 PrerenderTabHelper* prerender_tab_helper = |
464 PrerenderTabHelper::FromWebContents(new_tab_contents->web_contents()); | 464 PrerenderTabHelper::FromWebContents(new_tab_contents->web_contents()); |
465 DCHECK(prerender_tab_helper != NULL); | 465 DCHECK(prerender_tab_helper != NULL); |
466 prerender_tab_helper->PrerenderSwappedIn(); | 466 prerender_tab_helper->PrerenderSwappedIn(); |
467 | 467 |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1342 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1343 return NULL; | 1343 return NULL; |
1344 Profile* profile = Profile::FromBrowserContext( | 1344 Profile* profile = Profile::FromBrowserContext( |
1345 render_process_host->GetBrowserContext()); | 1345 render_process_host->GetBrowserContext()); |
1346 if (!profile) | 1346 if (!profile) |
1347 return NULL; | 1347 return NULL; |
1348 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1348 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1349 } | 1349 } |
1350 | 1350 |
1351 } // namespace prerender | 1351 } // namespace prerender |
OLD | NEW |