| 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" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 NotificationService::current()->Notify( | 370 NotificationService::current()->Notify( |
| 371 NotificationType::PRERENDER_CONTENTS_USED, | 371 NotificationType::PRERENDER_CONTENTS_USED, |
| 372 Source<std::pair<int, int> >(&child_route_pair), | 372 Source<std::pair<int, int> >(&child_route_pair), |
| 373 NotificationService::NoDetails()); | 373 NotificationService::NoDetails()); |
| 374 | 374 |
| 375 ViewHostMsg_FrameNavigate_Params* p = pc->navigate_params(); | 375 ViewHostMsg_FrameNavigate_Params* p = pc->navigate_params(); |
| 376 if (p != NULL) | 376 if (p != NULL) |
| 377 tc->DidNavigate(rvh, *p); | 377 tc->DidNavigate(rvh, *p); |
| 378 | 378 |
| 379 // TODO(evan): use directionality of title. | 379 string16 title = pc->title(); |
| 380 // http://code.google.com/p/chromium/issues/detail?id=27094 | 380 if (!title.empty()) |
| 381 string16 title_str = pc->title(); | 381 tc->UpdateTitle(rvh, pc->page_id(), UTF16ToWideHack(title)); |
| 382 if (!title_str.empty()) { | |
| 383 base::i18n::String16WithDirection title(title_str, | |
| 384 base::i18n::LEFT_TO_RIGHT); | |
| 385 tc->UpdateTitle(rvh, pc->page_id(), title); | |
| 386 } | |
| 387 | 382 |
| 388 GURL icon_url = pc->icon_url(); | 383 GURL icon_url = pc->icon_url(); |
| 389 if (!icon_url.is_empty()) { | 384 if (!icon_url.is_empty()) { |
| 390 std::vector<FaviconURL> urls; | 385 std::vector<FaviconURL> urls; |
| 391 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); | 386 urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON)); |
| 392 tc->favicon_helper().OnUpdateFaviconURL(pc->page_id(), urls); | 387 tc->favicon_helper().OnUpdateFaviconURL(pc->page_id(), urls); |
| 393 } | 388 } |
| 394 | 389 |
| 395 if (pc->has_stopped_loading()) | 390 if (pc->has_stopped_loading()) |
| 396 tc->DidStopLoading(); | 391 tc->DidStopLoading(); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 DCHECK(CalledOnValidThread()); | 656 DCHECK(CalledOnValidThread()); |
| 662 return prerendered_tc_set_.count(tc) > 0; | 657 return prerendered_tc_set_.count(tc) > 0; |
| 663 } | 658 } |
| 664 | 659 |
| 665 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { | 660 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { |
| 666 DCHECK(CalledOnValidThread()); | 661 DCHECK(CalledOnValidThread()); |
| 667 return would_be_prerendered_tc_set_.count(tc) > 0; | 662 return would_be_prerendered_tc_set_.count(tc) > 0; |
| 668 } | 663 } |
| 669 | 664 |
| 670 } // namespace prerender | 665 } // namespace prerender |
| OLD | NEW |