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

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

Issue 10896: Re-do the way browser windows are shown:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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) 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 <windows.h> 5 #include <windows.h>
6 #include <shellapi.h> 6 #include <shellapi.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // failed and that the process is being debugged. 252 // failed and that the process is being debugged.
253 void RecordBreakpadStatusUMA(MetricsService* metrics) { 253 void RecordBreakpadStatusUMA(MetricsService* metrics) {
254 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); 254 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0);
255 metrics->RecordBreakpadRegistration((len == 0)); 255 metrics->RecordBreakpadRegistration((len == 0));
256 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); 256 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent());
257 } 257 }
258 258
259 } // namespace 259 } // namespace
260 260
261 // Main routine for running as the Browser process. 261 // Main routine for running as the Browser process.
262 int BrowserMain(CommandLine &parsed_command_line, int show_command, 262 int BrowserMain(CommandLine &parsed_command_line,
263 sandbox::BrokerServices* broker_services) { 263 sandbox::BrokerServices* broker_services) {
264 // WARNING: If we get a WM_ENDSESSION objects created on the stack here 264 // WARNING: If we get a WM_ENDSESSION objects created on the stack here
265 // are NOT deleted. If you need something to run during WM_ENDSESSION add it 265 // are NOT deleted. If you need something to run during WM_ENDSESSION add it
266 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. 266 // to browser_shutdown::Shutdown or BrowserProcess::EndSession.
267 267
268 // TODO(beng, brettw): someday, break this out into sub functions with well 268 // TODO(beng, brettw): someday, break this out into sub functions with well
269 // defined roles (e.g. pre/post-profile startup, etc). 269 // defined roles (e.g. pre/post-profile startup, etc).
270 270
271 MessageLoop main_message_loop(MessageLoop::TYPE_UI); 271 MessageLoop main_message_loop(MessageLoop::TYPE_UI);
272 272
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 return ResultCodes::SHELL_INTEGRATION_FAILED; 414 return ResultCodes::SHELL_INTEGRATION_FAILED;
415 } 415 }
416 } 416 }
417 417
418 // Importing other browser settings is done in a browser-like process 418 // Importing other browser settings is done in a browser-like process
419 // that exits when this task has finished. 419 // that exits when this task has finished.
420 if (parsed_command_line.HasSwitch(switches::kImport)) 420 if (parsed_command_line.HasSwitch(switches::kImport))
421 return FirstRun::ImportNow(profile, parsed_command_line); 421 return FirstRun::ImportNow(profile, parsed_command_line);
422 422
423 // When another process is running, use it instead of starting us. 423 // When another process is running, use it instead of starting us.
424 if (message_window.NotifyOtherProcess(show_command)) 424 if (message_window.NotifyOtherProcess())
425 return ResultCodes::NORMAL_EXIT; 425 return ResultCodes::NORMAL_EXIT;
426 426
427 message_window.HuntForZombieChromeProcesses(); 427 message_window.HuntForZombieChromeProcesses();
428 428
429 // Do the tasks if chrome has been upgraded while it was last running. 429 // Do the tasks if chrome has been upgraded while it was last running.
430 if (!already_running && DoUpgradeTasks(parsed_command_line)) { 430 if (!already_running && DoUpgradeTasks(parsed_command_line)) {
431 return ResultCodes::NORMAL_EXIT; 431 return ResultCodes::NORMAL_EXIT;
432 } 432 }
433 433
434 // Check if there is any machine level Chrome installed on the current 434 // Check if there is any machine level Chrome installed on the current
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 browser_process->print_job_manager()->set_debug_dump_path( 555 browser_process->print_job_manager()->set_debug_dump_path(
556 parsed_command_line.GetSwitchValue(switches::kDebugPrint)); 556 parsed_command_line.GetSwitchValue(switches::kDebugPrint));
557 } 557 }
558 558
559 HandleErrorTestParameters(parsed_command_line); 559 HandleErrorTestParameters(parsed_command_line);
560 560
561 RecordBreakpadStatusUMA(metrics); 561 RecordBreakpadStatusUMA(metrics);
562 562
563 int result_code = ResultCodes::NORMAL_EXIT; 563 int result_code = ResultCodes::NORMAL_EXIT;
564 if (BrowserInit::ProcessCommandLine(parsed_command_line, L"", local_state, 564 if (BrowserInit::ProcessCommandLine(parsed_command_line, L"", local_state,
565 show_command, true, profile, 565 true, profile, &result_code)) {
566 &result_code)) {
567 MessageLoopForUI::current()->Run(browser_process->accelerator_handler()); 566 MessageLoopForUI::current()->Run(browser_process->accelerator_handler());
568 } 567 }
569 568
570 if (metrics) 569 if (metrics)
571 metrics->Stop(); 570 metrics->Stop();
572 571
573 // browser_shutdown takes care of deleting browser_process, so we need to 572 // browser_shutdown takes care of deleting browser_process, so we need to
574 // release it. 573 // release it.
575 browser_process.release(); 574 browser_process.release();
576 575
577 browser_shutdown::Shutdown(); 576 browser_shutdown::Shutdown();
578 577
579 // The following teardown code will pacify Purify, but is not necessary for 578 // The following teardown code will pacify Purify, but is not necessary for
580 // shutdown. Only list methods here that have no significant side effects 579 // shutdown. Only list methods here that have no significant side effects
581 // and can be run in single threaded mode before terminating. 580 // and can be run in single threaded mode before terminating.
582 #ifndef NDEBUG // Don't call these in a Release build: they just waste time. 581 #ifndef NDEBUG // Don't call these in a Release build: they just waste time.
583 // The following should ONLY be called when in single threaded mode. It is 582 // The following should ONLY be called when in single threaded mode. It is
584 // unsafe to do this cleanup if other threads are still active. 583 // unsafe to do this cleanup if other threads are still active.
585 // It is also very unnecessary, so I'm only doing this in debug to satisfy 584 // It is also very unnecessary, so I'm only doing this in debug to satisfy
586 // purify. 585 // purify.
587 if (tracking_objects) 586 if (tracking_objects)
588 tracked_objects::ThreadData::ShutdownSingleThreadedCleanup(); 587 tracked_objects::ThreadData::ShutdownSingleThreadedCleanup();
589 #endif // NDEBUG 588 #endif // NDEBUG
590 589
591 return result_code; 590 return result_code;
592 } 591 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698