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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "content/public/browser/navigation_controller.h" | 47 #include "content/public/browser/navigation_controller.h" |
48 #include "content/public/browser/notification_observer.h" | 48 #include "content/public/browser/notification_observer.h" |
49 #include "content/public/browser/notification_registrar.h" | 49 #include "content/public/browser/notification_registrar.h" |
50 #include "content/public/browser/notification_source.h" | 50 #include "content/public/browser/notification_source.h" |
51 #include "content/public/browser/render_process_host.h" | 51 #include "content/public/browser/render_process_host.h" |
52 #include "content/public/browser/render_view_host.h" | 52 #include "content/public/browser/render_view_host.h" |
53 #include "content/public/browser/session_storage_namespace.h" | 53 #include "content/public/browser/session_storage_namespace.h" |
54 #include "content/public/browser/web_contents.h" | 54 #include "content/public/browser/web_contents.h" |
55 #include "content/public/browser/web_contents_delegate.h" | 55 #include "content/public/browser/web_contents_delegate.h" |
56 #include "content/public/browser/web_contents_view.h" | 56 #include "content/public/browser/web_contents_view.h" |
| 57 #include "content/public/common/favicon_url.h" |
57 | 58 |
58 using content::BrowserThread; | 59 using content::BrowserThread; |
59 using content::RenderViewHost; | 60 using content::RenderViewHost; |
60 using content::SessionStorageNamespace; | 61 using content::SessionStorageNamespace; |
61 using content::WebContents; | 62 using content::WebContents; |
62 | 63 |
63 namespace prerender { | 64 namespace prerender { |
64 | 65 |
65 namespace { | 66 namespace { |
66 | 67 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 // Merge the browsing history. | 445 // Merge the browsing history. |
445 new_tab_contents->web_contents()->GetController().CopyStateFromAndPrune( | 446 new_tab_contents->web_contents()->GetController().CopyStateFromAndPrune( |
446 &old_tab_contents->web_contents()->GetController()); | 447 &old_tab_contents->web_contents()->GetController()); |
447 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> | 448 CoreTabHelper::FromWebContents(old_tab_contents->web_contents())->delegate()-> |
448 SwapTabContents(old_tab_contents->web_contents(), | 449 SwapTabContents(old_tab_contents->web_contents(), |
449 new_tab_contents->web_contents()); | 450 new_tab_contents->web_contents()); |
450 prerender_contents->CommitHistory(new_tab_contents); | 451 prerender_contents->CommitHistory(new_tab_contents); |
451 | 452 |
452 GURL icon_url = prerender_contents->icon_url(); | 453 GURL icon_url = prerender_contents->icon_url(); |
453 if (!icon_url.is_empty()) { | 454 if (!icon_url.is_empty()) { |
454 std::vector<FaviconURL> urls; | 455 std::vector<content::FaviconURL> urls; |
455 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 456 urls.push_back(content::FaviconURL(icon_url, content::FaviconURL::FAVICON)); |
456 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> | 457 FaviconTabHelper::FromWebContents(new_tab_contents->web_contents())-> |
457 OnUpdateFaviconURL(prerender_contents->page_id(), urls); | 458 DidUpdateFaviconURL(prerender_contents->page_id(), urls); |
458 } | 459 } |
459 | 460 |
460 // Update PPLT metrics: | 461 // Update PPLT metrics: |
461 // If the tab has finished loading, record a PPLT of 0. | 462 // 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. | 463 // If the tab is still loading, reset its start time to the current time. |
463 PrerenderTabHelper* prerender_tab_helper = | 464 PrerenderTabHelper* prerender_tab_helper = |
464 PrerenderTabHelper::FromWebContents(new_tab_contents->web_contents()); | 465 PrerenderTabHelper::FromWebContents(new_tab_contents->web_contents()); |
465 DCHECK(prerender_tab_helper != NULL); | 466 DCHECK(prerender_tab_helper != NULL); |
466 prerender_tab_helper->PrerenderSwappedIn(); | 467 prerender_tab_helper->PrerenderSwappedIn(); |
467 | 468 |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1358 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1358 return NULL; | 1359 return NULL; |
1359 Profile* profile = Profile::FromBrowserContext( | 1360 Profile* profile = Profile::FromBrowserContext( |
1360 render_process_host->GetBrowserContext()); | 1361 render_process_host->GetBrowserContext()); |
1361 if (!profile) | 1362 if (!profile) |
1362 return NULL; | 1363 return NULL; |
1363 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1364 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1364 } | 1365 } |
1365 | 1366 |
1366 } // namespace prerender | 1367 } // namespace prerender |
OLD | NEW |