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

Side by Side Diff: chrome/browser/browser_main.cc

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/browser_process_impl.h » ('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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/field_trial.h" 10 #include "base/field_trial.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return StringPiece(lazy_dir_lister.Pointer()->html_data); 169 return StringPiece(lazy_dir_lister.Pointer()->html_data);
170 170
171 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); 171 return ResourceBundle::GetSharedInstance().GetRawDataResource(key);
172 } 172 }
173 #endif 173 #endif
174 174
175 } // namespace 175 } // namespace
176 176
177 // Main routine for running as the Browser process. 177 // Main routine for running as the Browser process.
178 int BrowserMain(const MainFunctionParams& parameters) { 178 int BrowserMain(const MainFunctionParams& parameters) {
179 CommandLine& parsed_command_line = parameters.command_line_; 179 const CommandLine& parsed_command_line = parameters.command_line_;
180 180
181 // WARNING: If we get a WM_ENDSESSION objects created on the stack here 181 // WARNING: If we get a WM_ENDSESSION objects created on the stack here
182 // are NOT deleted. If you need something to run during WM_ENDSESSION add it 182 // are NOT deleted. If you need something to run during WM_ENDSESSION add it
183 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. 183 // to browser_shutdown::Shutdown or BrowserProcess::EndSession.
184 184
185 // TODO(beng, brettw): someday, break this out into sub functions with well 185 // TODO(beng, brettw): someday, break this out into sub functions with well
186 // defined roles (e.g. pre/post-profile startup, etc). 186 // defined roles (e.g. pre/post-profile startup, etc).
187 187
188 #ifdef TRACK_ALL_TASK_OBJECTS 188 #ifdef TRACK_ALL_TASK_OBJECTS
189 // Start tracking the creation and deletion of Task instance. 189 // Start tracking the creation and deletion of Task instance.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // Flush the message loop which lets the UserDataDirDialog close. 320 // Flush the message loop which lets the UserDataDirDialog close.
321 MessageLoop::current()->Run(); 321 MessageLoop::current()->Run();
322 322
323 ResourceBundle::CleanupSharedInstance(); 323 ResourceBundle::CleanupSharedInstance();
324 324
325 if (!user_data_dir.empty()) { 325 if (!user_data_dir.empty()) {
326 // Because of the way CommandLine parses, it's sufficient to append a new 326 // Because of the way CommandLine parses, it's sufficient to append a new
327 // --user-data-dir switch. The last flag of the same name wins. 327 // --user-data-dir switch. The last flag of the same name wins.
328 // TODO(tc): It would be nice to remove the flag we don't want, but that 328 // TODO(tc): It would be nice to remove the flag we don't want, but that
329 // sounds risky if we parse differently than CommandLineToArgvW. 329 // sounds risky if we parse differently than CommandLineToArgvW.
330 std::wstring new_command_line = 330 CommandLine new_command_line = parsed_command_line;
331 parsed_command_line.command_line_string(); 331 new_command_line.AppendSwitchWithValue(switches::kUserDataDir,
332 CommandLine::AppendSwitchWithValue(&new_command_line, 332 user_data_dir);
333 switches::kUserDataDir, user_data_dir);
334 base::LaunchApp(new_command_line, false, false, NULL); 333 base::LaunchApp(new_command_line, false, false, NULL);
335 } 334 }
336 335
337 return ResultCodes::NORMAL_EXIT; 336 return ResultCodes::NORMAL_EXIT;
338 #endif 337 #endif
339 } 338 }
340 339
341 PrefService* user_prefs = profile->GetPrefs(); 340 PrefService* user_prefs = profile->GetPrefs();
342 DCHECK(user_prefs); 341 DCHECK(user_prefs);
343 342
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 metrics->Stop(); 540 metrics->Stop();
542 541
543 // browser_shutdown takes care of deleting browser_process, so we need to 542 // browser_shutdown takes care of deleting browser_process, so we need to
544 // release it. 543 // release it.
545 browser_process.release(); 544 browser_process.release();
546 browser_shutdown::Shutdown(); 545 browser_shutdown::Shutdown();
547 546
548 return result_code; 547 return result_code;
549 } 548 }
550 549
OLDNEW
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/browser_process_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698