| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/favicon_tab_helper.h" | |
| 13 #include "chrome/browser/prerender/prerender_contents.h" | 12 #include "chrome/browser/prerender/prerender_contents.h" |
| 14 #include "chrome/browser/prerender/prerender_final_status.h" | 13 #include "chrome/browser/prerender/prerender_final_status.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | |
| 17 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
| 18 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
| 19 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
| 20 #include "content/browser/renderer_host/render_process_host.h" | 18 #include "content/browser/renderer_host/render_process_host.h" |
| 21 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 19 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 22 #include "content/browser/tab_contents/render_view_host_manager.h" | 20 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 23 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
| 24 #include "content/common/notification_service.h" | 22 #include "content/common/notification_service.h" |
| 25 #include "googleurl/src/url_parse.h" | 23 #include "googleurl/src/url_parse.h" |
| 26 #include "googleurl/src/url_canon.h" | 24 #include "googleurl/src/url_canon.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 330 |
| 333 ViewHostMsg_FrameNavigate_Params* p = pc->navigate_params(); | 331 ViewHostMsg_FrameNavigate_Params* p = pc->navigate_params(); |
| 334 if (p != NULL) | 332 if (p != NULL) |
| 335 tc->DidNavigate(rvh, *p); | 333 tc->DidNavigate(rvh, *p); |
| 336 | 334 |
| 337 string16 title = pc->title(); | 335 string16 title = pc->title(); |
| 338 if (!title.empty()) | 336 if (!title.empty()) |
| 339 tc->UpdateTitle(rvh, pc->page_id(), UTF16ToWideHack(title)); | 337 tc->UpdateTitle(rvh, pc->page_id(), UTF16ToWideHack(title)); |
| 340 | 338 |
| 341 GURL icon_url = pc->icon_url(); | 339 GURL icon_url = pc->icon_url(); |
| 342 if (!icon_url.is_empty()) { | 340 if (!icon_url.is_empty()) |
| 343 // TODO(avi): move prerendering to use TCWs; remove this. | 341 tc->favicon_helper().OnUpdateFaviconURL(pc->page_id(), icon_url); |
| 344 TabContentsWrapper* wrapper = | |
| 345 TabContentsWrapper::GetCurrentWrapperForContents(tc); | |
| 346 wrapper->favicon_tab_helper()->OnUpdateFaviconURL(pc->page_id(), icon_url); | |
| 347 } | |
| 348 | 342 |
| 349 if (pc->has_stopped_loading()) | 343 if (pc->has_stopped_loading()) |
| 350 tc->DidStopLoading(); | 344 tc->DidStopLoading(); |
| 351 | 345 |
| 352 return true; | 346 return true; |
| 353 } | 347 } |
| 354 | 348 |
| 355 void PrerenderManager::RemoveEntry(PrerenderContents* entry) { | 349 void PrerenderManager::RemoveEntry(PrerenderContents* entry) { |
| 356 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 357 for (std::list<PrerenderContentsData>::iterator it = prerender_list_.begin(); | 351 for (std::list<PrerenderContentsData>::iterator it = prerender_list_.begin(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 | 593 |
| 600 bool PrerenderManager::IsTabContentsPrerendered(TabContents* tc) const { | 594 bool PrerenderManager::IsTabContentsPrerendered(TabContents* tc) const { |
| 601 return prerendered_tc_set_.count(tc) > 0; | 595 return prerendered_tc_set_.count(tc) > 0; |
| 602 } | 596 } |
| 603 | 597 |
| 604 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { | 598 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { |
| 605 return would_be_prerendered_tc_set_.count(tc) > 0; | 599 return would_be_prerendered_tc_set_.count(tc) > 0; |
| 606 } | 600 } |
| 607 | 601 |
| 608 } // namespace prerender | 602 } // namespace prerender |
| OLD | NEW |