OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/prerender/prerender_contents.h" | 22 #include "chrome/browser/prerender/prerender_contents.h" |
23 #include "chrome/browser/prerender/prerender_field_trial.h" | 23 #include "chrome/browser/prerender/prerender_field_trial.h" |
24 #include "chrome/browser/prerender/prerender_final_status.h" | 24 #include "chrome/browser/prerender/prerender_final_status.h" |
25 #include "chrome/browser/prerender/prerender_histograms.h" | 25 #include "chrome/browser/prerender/prerender_histograms.h" |
26 #include "chrome/browser/prerender/prerender_history.h" | 26 #include "chrome/browser/prerender/prerender_history.h" |
27 #include "chrome/browser/prerender/prerender_manager_factory.h" | 27 #include "chrome/browser/prerender/prerender_manager_factory.h" |
28 #include "chrome/browser/prerender/prerender_tab_helper.h" | 28 #include "chrome/browser/prerender/prerender_tab_helper.h" |
29 #include "chrome/browser/prerender/prerender_tracker.h" | 29 #include "chrome/browser/prerender/prerender_tracker.h" |
30 #include "chrome/browser/prerender/prerender_util.h" | 30 #include "chrome/browser/prerender/prerender_util.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 33 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 34 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | |
34 #include "chrome/common/chrome_notification_types.h" | 35 #include "chrome/common/chrome_notification_types.h" |
35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
37 #include "content/browser/cancelable_request.h" | 38 #include "content/browser/cancelable_request.h" |
38 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 39 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
39 #include "content/browser/renderer_host/render_view_host.h" | 40 #include "content/browser/renderer_host/render_view_host.h" |
40 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 41 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
41 #include "content/browser/tab_contents/render_view_host_manager.h" | 42 #include "content/browser/tab_contents/render_view_host_manager.h" |
42 #include "content/browser/tab_contents/tab_contents.h" | 43 #include "content/browser/tab_contents/tab_contents.h" |
43 #include "content/browser/tab_contents/tab_contents_delegate.h" | 44 #include "content/browser/tab_contents/tab_contents_delegate.h" |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 TabContentsWrapper* old_tab_contents = | 657 TabContentsWrapper* old_tab_contents = |
657 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 658 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
658 DCHECK(new_tab_contents); | 659 DCHECK(new_tab_contents); |
659 DCHECK(old_tab_contents); | 660 DCHECK(old_tab_contents); |
660 | 661 |
661 MarkTabContentsAsPrerendered(new_tab_contents->tab_contents()); | 662 MarkTabContentsAsPrerendered(new_tab_contents->tab_contents()); |
662 | 663 |
663 // Merge the browsing history. | 664 // Merge the browsing history. |
664 new_tab_contents->controller().CopyStateFromAndPrune( | 665 new_tab_contents->controller().CopyStateFromAndPrune( |
665 &old_tab_contents->controller()); | 666 &old_tab_contents->controller()); |
666 old_tab_contents->delegate()->SwapTabContents(old_tab_contents, | 667 old_tab_contents->core_tab_helper()->delegate()-> |
667 new_tab_contents); | 668 SwapTabContents(old_tab_contents, new_tab_contents); |
668 prerender_contents->CommitHistory(new_tab_contents); | 669 prerender_contents->CommitHistory(new_tab_contents); |
669 | 670 |
670 GURL icon_url = prerender_contents->icon_url(); | 671 GURL icon_url = prerender_contents->icon_url(); |
671 if (!icon_url.is_empty()) { | 672 if (!icon_url.is_empty()) { |
672 std::vector<FaviconURL> urls; | 673 std::vector<FaviconURL> urls; |
673 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 674 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); |
674 new_tab_contents->favicon_tab_helper()->OnUpdateFaviconURL( | 675 new_tab_contents->favicon_tab_helper()->OnUpdateFaviconURL( |
675 prerender_contents->page_id(), | 676 prerender_contents->page_id(), |
676 urls); | 677 urls); |
677 } | 678 } |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1146 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1146 return NULL; | 1147 return NULL; |
1147 Profile* profile = Profile::FromBrowserContext( | 1148 Profile* profile = Profile::FromBrowserContext( |
1148 render_process_host->GetBrowserContext()); | 1149 render_process_host->GetBrowserContext()); |
1149 if (!profile) | 1150 if (!profile) |
1150 return NULL; | 1151 return NULL; |
1151 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1152 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1152 } | 1153 } |
1153 | 1154 |
1154 } // namespace prerender | 1155 } // namespace prerender |
OLD | NEW |