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

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 6246036: FilePath: Remove most of ToWStringHack, adding a LossyDisplayName() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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
OLDNEW
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/ui/browser_init.h" 5 #include "chrome/browser/ui/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/event_recorder.h" 10 #include "base/event_recorder.h"
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 false)); 958 false));
959 } 959 }
960 } 960 }
961 961
962 std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine( 962 std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine(
963 Profile* profile) { 963 Profile* profile) {
964 std::vector<GURL> urls; 964 std::vector<GURL> urls;
965 const std::vector<CommandLine::StringType>& params = command_line_.args(); 965 const std::vector<CommandLine::StringType>& params = command_line_.args();
966 966
967 for (size_t i = 0; i < params.size(); ++i) { 967 for (size_t i = 0; i < params.size(); ++i) {
968 FilePath param = FilePath(params[i]); 968 FilePath param = FilePath(params[i]);
Mark Mentovai 2011/02/01 22:54:55 Is this an abuse of FilePath?
969 // Handle Vista way of searching - "? <search-term>" 969 // Handle Vista way of searching - "? <search-term>"
970 if (param.value().find(FILE_PATH_LITERAL("? ")) == 0) { 970 if (param.value().find(FILE_PATH_LITERAL("? ")) == 0) {
971 const TemplateURL* default_provider = 971 const TemplateURL* default_provider =
972 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); 972 profile->GetTemplateURLModel()->GetDefaultSearchProvider();
973 if (!default_provider || !default_provider->url()) { 973 if (!default_provider || !default_provider->url()) {
974 // No search provider available. Just treat this as regular URL. 974 // No search provider available. Just treat this as regular URL.
975 urls.push_back(URLFixerUpper::FixupRelativeFile(cur_dir_, param)); 975 urls.push_back(URLFixerUpper::FixupRelativeFile(cur_dir_, param));
976 continue; 976 continue;
977 } 977 }
978 const TemplateURLRef* search_url = default_provider->url(); 978 const TemplateURLRef* search_url = default_provider->url();
979 DCHECK(search_url->SupportsReplacement()); 979 DCHECK(search_url->SupportsReplacement());
980 std::wstring search_term = param.ToWStringHack().substr(2); 980 string16 search_term = param.LossyDisplayName().substr(2);
981 urls.push_back(GURL(search_url->ReplaceSearchTerms( 981 urls.push_back(GURL(search_url->ReplaceSearchTerms(
982 *default_provider, WideToUTF16Hack(search_term), 982 *default_provider, search_term,
983 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()))); 983 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())));
984 } else { 984 } else {
985 // This will create a file URL or a regular URL. 985 // This will create a file URL or a regular URL.
986 // This call can (in rare circumstances) block the UI thread. 986 // This call can (in rare circumstances) block the UI thread.
987 // Allow it until this bug is fixed. 987 // Allow it until this bug is fixed.
988 // http://code.google.com/p/chromium/issues/detail?id=60641 988 // http://code.google.com/p/chromium/issues/detail?id=60641
989 GURL url; 989 GURL url;
990 { 990 {
991 base::ThreadRestrictions::ScopedAllowIO allow_io; 991 base::ThreadRestrictions::ScopedAllowIO allow_io;
992 url = URLFixerUpper::FixupRelativeFile(cur_dir_, param); 992 url = URLFixerUpper::FixupRelativeFile(cur_dir_, param);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 return false; 1215 return false;
1216 automation->SetExpectedTabCount(expected_tabs); 1216 automation->SetExpectedTabCount(expected_tabs);
1217 1217
1218 AutomationProviderList* list = 1218 AutomationProviderList* list =
1219 g_browser_process->InitAutomationProviderList(); 1219 g_browser_process->InitAutomationProviderList();
1220 DCHECK(list); 1220 DCHECK(list);
1221 list->AddProvider(automation); 1221 list->AddProvider(automation);
1222 1222
1223 return true; 1223 return true;
1224 } 1224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698