OLD | NEW |
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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/hi_res_timer_manager.h" | 9 #include "app/hi_res_timer_manager.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) | 459 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) |
460 << "Must be able to get user data directory!"; | 460 << "Must be able to get user data directory!"; |
461 #endif | 461 #endif |
462 | 462 |
463 ProcessSingleton process_singleton(user_data_dir); | 463 ProcessSingleton process_singleton(user_data_dir); |
464 | 464 |
465 bool is_first_run = FirstRun::IsChromeFirstRun() || | 465 bool is_first_run = FirstRun::IsChromeFirstRun() || |
466 parsed_command_line.HasSwitch(switches::kFirstRun); | 466 parsed_command_line.HasSwitch(switches::kFirstRun); |
467 | 467 |
468 scoped_ptr<BrowserProcessImpl> browser_process; | 468 scoped_ptr<BrowserProcessImpl> browser_process; |
469 if (parsed_command_line.HasSwitch(switches::kImport)) { | 469 if (parsed_command_line.HasSwitch(switches::kImport) || |
| 470 parsed_command_line.HasSwitch(switches::kImportFromFile)) { |
470 // We use different BrowserProcess when importing so no GoogleURLTracker is | 471 // We use different BrowserProcess when importing so no GoogleURLTracker is |
471 // instantiated (as it makes a URLRequest and we don't have an IO thread, | 472 // instantiated (as it makes a URLRequest and we don't have an IO thread, |
472 // see bug #1292702). | 473 // see bug #1292702). |
473 browser_process.reset(new FirstRunBrowserProcess(parsed_command_line)); | 474 browser_process.reset(new FirstRunBrowserProcess(parsed_command_line)); |
474 is_first_run = false; | 475 is_first_run = false; |
475 } else { | 476 } else { |
476 browser_process.reset(new BrowserProcessImpl(parsed_command_line)); | 477 browser_process.reset(new BrowserProcessImpl(parsed_command_line)); |
477 } | 478 } |
478 | 479 |
479 // BrowserProcessImpl's constructor should set g_browser_process. | 480 // BrowserProcessImpl's constructor should set g_browser_process. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 size.SetSize(StringToInt(dimensions[0]), StringToInt(dimensions[1])); | 779 size.SetSize(StringToInt(dimensions[0]), StringToInt(dimensions[1])); |
779 } | 780 } |
780 } | 781 } |
781 browser::ShowLoginWizard(first_screen, size); | 782 browser::ShowLoginWizard(first_screen, size); |
782 } | 783 } |
783 #endif // OS_CHROMEOS | 784 #endif // OS_CHROMEOS |
784 | 785 |
785 // Importing other browser settings is done in a browser-like process | 786 // Importing other browser settings is done in a browser-like process |
786 // that exits when this task has finished. | 787 // that exits when this task has finished. |
787 #if defined(OS_WIN) | 788 #if defined(OS_WIN) |
788 if (parsed_command_line.HasSwitch(switches::kImport)) | 789 if (parsed_command_line.HasSwitch(switches::kImport) || |
| 790 parsed_command_line.HasSwitch(switches::kImportFromFile)) |
789 return FirstRun::ImportNow(profile, parsed_command_line); | 791 return FirstRun::ImportNow(profile, parsed_command_line); |
790 #endif | 792 #endif |
791 | 793 |
792 // When another process is running, use it instead of starting us. | 794 // When another process is running, use it instead of starting us. |
793 switch (process_singleton.NotifyOtherProcess()) { | 795 switch (process_singleton.NotifyOtherProcess()) { |
794 case ProcessSingleton::PROCESS_NONE: | 796 case ProcessSingleton::PROCESS_NONE: |
795 // No process already running, fall through to starting a new one. | 797 // No process already running, fall through to starting a new one. |
796 break; | 798 break; |
797 | 799 |
798 case ProcessSingleton::PROCESS_NOTIFIED: | 800 case ProcessSingleton::PROCESS_NOTIFIED: |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 if (metrics) | 1019 if (metrics) |
1018 metrics->Stop(); | 1020 metrics->Stop(); |
1019 | 1021 |
1020 // browser_shutdown takes care of deleting browser_process, so we need to | 1022 // browser_shutdown takes care of deleting browser_process, so we need to |
1021 // release it. | 1023 // release it. |
1022 browser_process.release(); | 1024 browser_process.release(); |
1023 browser_shutdown::Shutdown(); | 1025 browser_shutdown::Shutdown(); |
1024 | 1026 |
1025 return result_code; | 1027 return result_code; |
1026 } | 1028 } |
OLD | NEW |