| 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/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/favicon_helper.h" | 11 #include "chrome/browser/favicon_helper.h" |
| 12 #include "chrome/browser/prerender/prerender_contents.h" | 12 #include "chrome/browser/prerender/prerender_contents.h" |
| 13 #include "chrome/browser/prerender/prerender_final_status.h" | 13 #include "chrome/browser/prerender/prerender_final_status.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/icon_messages.h" |
| 15 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
| 16 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
| 17 #include "content/browser/renderer_host/render_view_host.h" | 18 #include "content/browser/renderer_host/render_view_host.h" |
| 18 #include "content/browser/renderer_host/render_process_host.h" | 19 #include "content/browser/renderer_host/render_process_host.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 20 #include "content/browser/tab_contents/render_view_host_manager.h" | 21 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 21 | 22 |
| 22 namespace prerender { | 23 namespace prerender { |
| 23 | 24 |
| 24 // static | 25 // static |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 176 |
| 176 ViewHostMsg_FrameNavigate_Params* p = pc->navigate_params(); | 177 ViewHostMsg_FrameNavigate_Params* p = pc->navigate_params(); |
| 177 if (p != NULL) | 178 if (p != NULL) |
| 178 tc->DidNavigate(rvh, *p); | 179 tc->DidNavigate(rvh, *p); |
| 179 | 180 |
| 180 string16 title = pc->title(); | 181 string16 title = pc->title(); |
| 181 if (!title.empty()) | 182 if (!title.empty()) |
| 182 tc->UpdateTitle(rvh, pc->page_id(), UTF16ToWideHack(title)); | 183 tc->UpdateTitle(rvh, pc->page_id(), UTF16ToWideHack(title)); |
| 183 | 184 |
| 184 GURL icon_url = pc->icon_url(); | 185 GURL icon_url = pc->icon_url(); |
| 185 if (!icon_url.is_empty()) | 186 if (!icon_url.is_empty()) { |
| 186 tc->favicon_helper().OnUpdateFaviconURL(pc->page_id(), icon_url); | 187 std::vector<FaviconURL> urls; |
| 187 | 188 urls.push_back(FaviconURL(icon_url, FAVICON)); |
| 189 tc->favicon_helper().OnUpdateFaviconURL(pc->page_id(), urls); |
| 190 } |
| 188 if (pc->has_stopped_loading()) | 191 if (pc->has_stopped_loading()) |
| 189 tc->DidStopLoading(); | 192 tc->DidStopLoading(); |
| 190 | 193 |
| 191 return true; | 194 return true; |
| 192 } | 195 } |
| 193 | 196 |
| 194 void PrerenderManager::RemoveEntry(PrerenderContents* entry) { | 197 void PrerenderManager::RemoveEntry(PrerenderContents* entry) { |
| 195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 196 for (std::list<PrerenderContentsData>::iterator it = prerender_list_.begin(); | 199 for (std::list<PrerenderContentsData>::iterator it = prerender_list_.begin(); |
| 197 it != prerender_list_.end(); | 200 it != prerender_list_.end(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 365 |
| 363 bool PrerenderManager::IsTabContentsPrerendered(TabContents* tc) const { | 366 bool PrerenderManager::IsTabContentsPrerendered(TabContents* tc) const { |
| 364 return prerendered_tc_set_.count(tc) > 0; | 367 return prerendered_tc_set_.count(tc) > 0; |
| 365 } | 368 } |
| 366 | 369 |
| 367 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { | 370 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { |
| 368 return would_be_prerendered_tc_set_.count(tc) > 0; | 371 return would_be_prerendered_tc_set_.count(tc) > 0; |
| 369 } | 372 } |
| 370 | 373 |
| 371 } // namespace prerender | 374 } // namespace prerender |
| OLD | NEW |