OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/dom_ui/new_tab_ui.h" | 5 #include "chrome/browser/dom_ui/new_tab_ui.h" |
6 | 6 |
7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
9 #include "chrome/app/locales/locale_settings.h" | 9 #include "chrome/app/locales/locale_settings.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 NewTabHTMLSource* html_source = new NewTabHTMLSource(); | 791 NewTabHTMLSource* html_source = new NewTabHTMLSource(); |
792 | 792 |
793 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 793 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
794 NewRunnableMethod(&chrome_url_data_manager, | 794 NewRunnableMethod(&chrome_url_data_manager, |
795 &ChromeURLDataManager::AddDataSource, | 795 &ChromeURLDataManager::AddDataSource, |
796 html_source)); | 796 html_source)); |
797 } | 797 } |
798 } | 798 } |
799 | 799 |
800 bool NewTabUIContents::Navigate(const NavigationEntry& entry, bool reload) { | 800 bool NewTabUIContents::NavigateToPendingEntry(bool reload) { |
801 const bool result = WebContents::Navigate(entry, reload); | 801 const bool result = WebContents::NavigateToPendingEntry(reload); |
802 | 802 controller()->GetPendingEntry()->set_title(forced_title_); |
803 // Force the title to say 'New tab', even when loading. The supplied entry is | |
804 // also the pending entry. | |
805 NavigationEntry* pending_entry = controller()->GetPendingEntry(); | |
806 DCHECK(pending_entry && pending_entry == &entry); | |
807 pending_entry->set_title(forced_title_); | |
808 | |
809 return result; | 803 return result; |
810 } | 804 } |
811 | 805 |
812 const std::wstring& NewTabUIContents::GetTitle() const { | 806 const std::wstring& NewTabUIContents::GetTitle() const { |
813 if (!forced_title_.empty()) | 807 if (!forced_title_.empty()) |
814 return forced_title_; | 808 return forced_title_; |
815 return WebContents::GetTitle(); | 809 return WebContents::GetTitle(); |
816 } | 810 } |
817 | 811 |
818 void NewTabUIContents::SetInitialFocus() { | 812 void NewTabUIContents::SetInitialFocus() { |
(...skipping 30 matching lines...) Expand all Loading... |
849 for (size_t i = 0; i < urls.size(); ++i) { | 843 for (size_t i = 0; i < urls.size(); ++i) { |
850 if (url == urls[i]) { | 844 if (url == urls[i]) { |
851 UserMetrics::RecordComputedAction(StringPrintf(L"MostVisited%d", i), | 845 UserMetrics::RecordComputedAction(StringPrintf(L"MostVisited%d", i), |
852 profile()); | 846 profile()); |
853 break; | 847 break; |
854 } | 848 } |
855 } | 849 } |
856 } | 850 } |
857 } | 851 } |
858 | 852 |
OLD | NEW |