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

Side by Side Diff: chrome/browser/first_run/first_run_gtk.cc

Issue 3069014: Convert a bunch of easy AppendSwitchWithValue to *ASCII. (Closed)
Patch Set: fix Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 if (!import_bookmarks_path.empty()) { 107 if (!import_bookmarks_path.empty()) {
108 // There are bookmarks to import from a file. 108 // There are bookmarks to import from a file.
109 if (!FirstRun::ImportBookmarks(import_bookmarks_path)) { 109 if (!FirstRun::ImportBookmarks(import_bookmarks_path)) {
110 LOG(WARNING) << "silent bookmark import failed"; 110 LOG(WARNING) << "silent bookmark import failed";
111 } 111 }
112 } 112 }
113 return false; 113 return false;
114 } 114 }
115 115
116 // TODO(port): This is just a piece of the silent import functionality from 116 // TODO(port): This is just a piece of the silent import functionality from
117 // ImportSettings for Windows. It would be nice to get the rest of it ported. 117 // ImportSettings for Windows. It would be nice to get the rest of it ported.
118 bool FirstRun::ImportBookmarks(const std::wstring& import_bookmarks_path) { 118 bool FirstRun::ImportBookmarks(const std::wstring& import_bookmarks_path) {
119 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); 119 const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
120 CommandLine import_cmd(cmdline.GetProgram()); 120 CommandLine import_cmd(cmdline.GetProgram());
121 121
122 // Propagate user data directory switch. 122 // Propagate user data directory switch.
123 if (cmdline.HasSwitch(switches::kUserDataDir)) { 123 if (cmdline.HasSwitch(switches::kUserDataDir)) {
124 import_cmd.AppendSwitchWithValue( 124 import_cmd.AppendSwitchPath(switches::kUserDataDir,
125 switches::kUserDataDir, 125 cmdline.GetSwitchValuePath(switches::kUserDataDir));
126 cmdline.GetSwitchValueASCII(switches::kUserDataDir));
127 } 126 }
128 // Since ImportSettings is called before the local state is stored on disk 127 // Since ImportSettings is called before the local state is stored on disk
129 // we pass the language as an argument. GetApplicationLocale checks the 128 // we pass the language as an argument. GetApplicationLocale checks the
130 // current command line as fallback. 129 // current command line as fallback.
131 import_cmd.AppendSwitchWithValue( 130 import_cmd.AppendSwitchASCII(switches::kLang,
132 switches::kLang, 131 g_browser_process->GetApplicationLocale());
133 ASCIIToWide(g_browser_process->GetApplicationLocale()));
134 132
135 import_cmd.CommandLine::AppendSwitchWithValue( 133 import_cmd.CommandLine::AppendSwitchWithValue(
136 switches::kImportFromFile, import_bookmarks_path); 134 switches::kImportFromFile, import_bookmarks_path);
137 // Time to launch the process that is going to do the import. We'll wait 135 // Time to launch the process that is going to do the import. We'll wait
138 // for the process to return. 136 // for the process to return.
139 return base::LaunchApp(import_cmd, true, false, NULL); 137 return base::LaunchApp(import_cmd, true, false, NULL);
140 } 138 }
141 139
142 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 140 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
143 CommandLine* Upgrade::new_command_line_ = NULL; 141 CommandLine* Upgrade::new_command_line_ = NULL;
(...skipping 24 matching lines...) Expand all
168 } 166 }
169 file_util::FileInfo exe_file_info; 167 file_util::FileInfo exe_file_info;
170 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) { 168 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) {
171 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - " 169 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - "
172 << exe_file_path.value(); 170 << exe_file_path.value();
173 return saved_last_modified_time_of_exe_; 171 return saved_last_modified_time_of_exe_;
174 } 172 }
175 return exe_file_info.last_modified.ToDoubleT(); 173 return exe_file_info.last_modified.ToDoubleT();
176 } 174 }
177 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) 175 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698