Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 49014: New tab page was linking to the wrong URL for the history page. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/new_tab.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/dom_ui/new_tab_ui.h" 7 #include "chrome/browser/dom_ui/new_tab_ui.h"
8 8
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 DictionaryValue localized_strings; 237 DictionaryValue localized_strings;
238 localized_strings.SetString(L"title", title); 238 localized_strings.SetString(L"title", title);
239 localized_strings.SetString(L"mostvisited", most_visited); 239 localized_strings.SetString(L"mostvisited", most_visited);
240 localized_strings.SetString(L"searches", 240 localized_strings.SetString(L"searches",
241 l10n_util::GetString(IDS_NEW_TAB_SEARCHES)); 241 l10n_util::GetString(IDS_NEW_TAB_SEARCHES));
242 localized_strings.SetString(L"bookmarks", 242 localized_strings.SetString(L"bookmarks",
243 l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS)); 243 l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS));
244 localized_strings.SetString(L"showhistory", 244 localized_strings.SetString(L"showhistory",
245 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW)); 245 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW));
246 localized_strings.SetString(L"showhistoryurl",
247 chrome::kChromeUIHistoryURL);
246 localized_strings.SetString(L"searchhistory", 248 localized_strings.SetString(L"searchhistory",
247 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH)); 249 l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH));
248 localized_strings.SetString(L"recentlyclosed", 250 localized_strings.SetString(L"recentlyclosed",
249 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED)); 251 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED));
250 localized_strings.SetString(L"mostvisitedintro", 252 localized_strings.SetString(L"mostvisitedintro",
251 l10n_util::GetStringF(IDS_NEW_TAB_MOST_VISITED_INTRO, 253 l10n_util::GetStringF(IDS_NEW_TAB_MOST_VISITED_INTRO,
252 l10n_util::GetString(IDS_WELCOME_PAGE_URL))); 254 l10n_util::GetString(IDS_WELCOME_PAGE_URL)));
253 localized_strings.SetString(L"closedwindow", 255 localized_strings.SetString(L"closedwindow",
254 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)); 256 l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW));
255 257
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 return true; 900 return true;
899 } 901 }
900 902
901 /////////////////////////////////////////////////////////////////////////////// 903 ///////////////////////////////////////////////////////////////////////////////
902 // HistoryHandler 904 // HistoryHandler
903 905
904 class HistoryHandler : public DOMMessageHandler { 906 class HistoryHandler : public DOMMessageHandler {
905 public: 907 public:
906 explicit HistoryHandler(DOMUI* dom_ui); 908 explicit HistoryHandler(DOMUI* dom_ui);
907 909
908 // Callback which navigates to the history page.
909 void HandleShowHistoryPage(const Value*);
910
911 // Callback which navigates to the history page and performs a search. 910 // Callback which navigates to the history page and performs a search.
912 void HandleSearchHistoryPage(const Value* content); 911 void HandleSearchHistoryPage(const Value* content);
913 912
914 private: 913 private:
915 DOMUI* dom_ui_; 914 DOMUI* dom_ui_;
916 915
917 DISALLOW_COPY_AND_ASSIGN(HistoryHandler); 916 DISALLOW_COPY_AND_ASSIGN(HistoryHandler);
918 }; 917 };
919 918
920 HistoryHandler::HistoryHandler(DOMUI* dom_ui) 919 HistoryHandler::HistoryHandler(DOMUI* dom_ui)
921 : DOMMessageHandler(dom_ui), 920 : DOMMessageHandler(dom_ui),
922 dom_ui_(dom_ui) { 921 dom_ui_(dom_ui) {
923 dom_ui->RegisterMessageCallback("showHistoryPage",
924 NewCallback(this, &HistoryHandler::HandleShowHistoryPage));
925 dom_ui->RegisterMessageCallback("searchHistoryPage", 922 dom_ui->RegisterMessageCallback("searchHistoryPage",
926 NewCallback(this, &HistoryHandler::HandleSearchHistoryPage)); 923 NewCallback(this, &HistoryHandler::HandleSearchHistoryPage));
927 } 924 }
928 925
929 void HistoryHandler::HandleShowHistoryPage(const Value*) {
930 NavigationController* controller = dom_ui_->web_contents()->controller();
931 if (controller) {
932 UserMetrics::RecordAction(L"NTP_ShowHistory", dom_ui_->GetProfile());
933 controller->LoadURL(GURL(chrome::kChromeUINewTabURL), GURL(),
934 PageTransition::LINK);
935 // We are deleted by LoadURL, so do not call anything else.
936 }
937 }
938
939 void HistoryHandler::HandleSearchHistoryPage(const Value* content) { 926 void HistoryHandler::HandleSearchHistoryPage(const Value* content) {
940 if (content && content->GetType() == Value::TYPE_LIST) { 927 if (content && content->GetType() == Value::TYPE_LIST) {
941 const ListValue* list_value = static_cast<const ListValue*>(content); 928 const ListValue* list_value = static_cast<const ListValue*>(content);
942 Value* list_member; 929 Value* list_member;
943 if (list_value->Get(0, &list_member) && 930 if (list_value->Get(0, &list_member) &&
944 list_member->GetType() == Value::TYPE_STRING) { 931 list_member->GetType() == Value::TYPE_STRING) {
945 const StringValue* string_value = 932 const StringValue* string_value =
946 static_cast<const StringValue*>(list_member); 933 static_cast<const StringValue*>(list_member);
947 std::wstring wstring_value; 934 std::wstring wstring_value;
948 if (string_value->GetAsString(&wstring_value)) { 935 if (string_value->GetAsString(&wstring_value)) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 #endif 1049 #endif
1063 1050
1064 NewTabHTMLSource* html_source = new NewTabHTMLSource(); 1051 NewTabHTMLSource* html_source = new NewTabHTMLSource();
1065 1052
1066 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 1053 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
1067 NewRunnableMethod(&chrome_url_data_manager, 1054 NewRunnableMethod(&chrome_url_data_manager,
1068 &ChromeURLDataManager::AddDataSource, 1055 &ChromeURLDataManager::AddDataSource,
1069 html_source)); 1056 html_source));
1070 } 1057 }
1071 } 1058 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/new_tab.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698