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

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

Issue 126052: Fixes bug where keyword editor would end up prefixing all keyword urls... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « chrome/browser/browser_init.cc ('k') | chrome/browser/importer/importer.cc » ('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 "app/animation.h" 9 #include "app/animation.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 if (!template_url) { 872 if (!template_url) {
873 // The keyword seems to have changed out from under us. 873 // The keyword seems to have changed out from under us.
874 // Not an error, but nothing we can do... 874 // Not an error, but nothing we can do...
875 return; 875 return;
876 } 876 }
877 const TemplateURLRef* url_ref = template_url->url(); 877 const TemplateURLRef* url_ref = template_url->url();
878 if (!url_ref || !url_ref->SupportsReplacement()) { 878 if (!url_ref || !url_ref->SupportsReplacement()) {
879 NOTREACHED(); 879 NOTREACHED();
880 return; 880 return;
881 } 881 }
882 GURL url = url_ref->ReplaceSearchTerms(*template_url, search, 882 GURL url = GURL(WideToUTF8(url_ref->ReplaceSearchTerms(*template_url, search,
883 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()); 883 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
884 884
885 if (url.is_valid()) { 885 if (url.is_valid()) {
886 // Record the user action 886 // Record the user action
887 std::vector<const TemplateURL*> urls = 887 std::vector<const TemplateURL*> urls =
888 template_url_model_->GetTemplateURLs(); 888 template_url_model_->GetTemplateURLs();
889 sort(urls.begin(), urls.end(), TemplateURLSortByUsage); 889 sort(urls.begin(), urls.end(), TemplateURLSortByUsage);
890 ListValue urls_value; 890 ListValue urls_value;
891 int item_number = 0; 891 int item_number = 0;
892 for (size_t i = 0; 892 for (size_t i = 0;
893 i < std::min<size_t>(urls.size(), kSearchURLs); ++i) { 893 i < std::min<size_t>(urls.size(), kSearchURLs); ++i) {
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 // static 1435 // static
1436 void NewTabUI::RegisterUserPrefs(PrefService* prefs) { 1436 void NewTabUI::RegisterUserPrefs(PrefService* prefs) {
1437 MostVisitedHandler::RegisterUserPrefs(prefs); 1437 MostVisitedHandler::RegisterUserPrefs(prefs);
1438 } 1438 }
1439 1439
1440 // static 1440 // static
1441 bool NewTabUI::EnableNewNewTabPage() { 1441 bool NewTabUI::EnableNewNewTabPage() {
1442 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 1442 const CommandLine* command_line = CommandLine::ForCurrentProcess();
1443 return command_line->HasSwitch(switches::kNewNewTabPage); 1443 return command_line->HasSwitch(switches::kNewNewTabPage);
1444 } 1444 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/importer/importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698