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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 // Merge the browsing history. | 432 // Merge the browsing history. |
433 new_tab_contents->web_contents()->GetController().CopyStateFromAndPrune( | 433 new_tab_contents->web_contents()->GetController().CopyStateFromAndPrune( |
434 &old_tab_contents->web_contents()->GetController()); | 434 &old_tab_contents->web_contents()->GetController()); |
435 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> | 435 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> |
436 SwapTabContents(old_tab_contents->web_contents(), | 436 SwapTabContents(old_tab_contents->web_contents(), |
437 new_tab_contents->web_contents()); | 437 new_tab_contents->web_contents()); |
438 prerender_contents->CommitHistory(new_tab_contents); | 438 prerender_contents->CommitHistory(new_tab_contents); |
439 | 439 |
440 GURL icon_url = prerender_contents->icon_url(); | 440 GURL icon_url = prerender_contents->icon_url(); |
441 if (!icon_url.is_empty()) { | 441 if (!icon_url.is_empty()) { |
442 std::vector<FaviconURL> urls; | 442 std::vector<content::FaviconURL> urls; |
443 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 443 urls.push_back(content::FaviconURL(icon_url, content::FaviconURL::FAVICON)); |
444 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> | 444 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> |
445 OnUpdateFaviconURL(prerender_contents->page_id(), urls); | 445 OnUpdateFaviconURL(prerender_contents->page_id(), urls); |
446 } | 446 } |
447 | 447 |
448 // Update PPLT metrics: | 448 // Update PPLT metrics: |
449 // If the tab has finished loading, record a PPLT of 0. | 449 // If the tab has finished loading, record a PPLT of 0. |
450 // If the tab is still loading, reset its start time to the current time. | 450 // If the tab is still loading, reset its start time to the current time. |
451 PrerenderTabHelper* prerender_tab_helper = | 451 PrerenderTabHelper* prerender_tab_helper = |
452 PrerenderTabHelper::FromWebContents(new_tab_contents->web_contents()); | 452 PrerenderTabHelper::FromWebContents(new_tab_contents->web_contents()); |
453 DCHECK(prerender_tab_helper != NULL); | 453 DCHECK(prerender_tab_helper != NULL); |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1351 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1352 return NULL; | 1352 return NULL; |
1353 Profile* profile = Profile::FromBrowserContext( | 1353 Profile* profile = Profile::FromBrowserContext( |
1354 render_process_host->GetBrowserContext()); | 1354 render_process_host->GetBrowserContext()); |
1355 if (!profile) | 1355 if (!profile) |
1356 return NULL; | 1356 return NULL; |
1357 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1357 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1358 } | 1358 } |
1359 | 1359 |
1360 } // namespace prerender | 1360 } // namespace prerender |
OLD | NEW |