| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/field_trial.h" | 12 #include "base/field_trial.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/histogram.h" | 14 #include "base/histogram.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/scoped_nsautorelease_pool.h" | 16 #include "base/scoped_nsautorelease_pool.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "base/sys_string_conversions.h" |
| 21 #include "base/system_monitor.h" | 22 #include "base/system_monitor.h" |
| 22 #include "base/time.h" | 23 #include "base/time.h" |
| 23 #include "base/tracked_objects.h" | 24 #include "base/tracked_objects.h" |
| 24 #include "base/values.h" | 25 #include "base/values.h" |
| 25 #include "chrome/browser/browser_main_win.h" | 26 #include "chrome/browser/browser_main_win.h" |
| 26 #include "chrome/browser/browser_init.h" | 27 #include "chrome/browser/browser_init.h" |
| 27 #include "chrome/browser/browser_list.h" | 28 #include "chrome/browser/browser_list.h" |
| 28 #include "chrome/browser/browser_prefs.h" | 29 #include "chrome/browser/browser_prefs.h" |
| 29 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/browser_process_impl.h" | 31 #include "chrome/browser/browser_process_impl.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 return ResultCodes::SHELL_INTEGRATION_FAILED; | 562 return ResultCodes::SHELL_INTEGRATION_FAILED; |
| 562 } | 563 } |
| 563 } | 564 } |
| 564 | 565 |
| 565 // Importing other browser settings is done in a browser-like process | 566 // Importing other browser settings is done in a browser-like process |
| 566 // that exits when this task has finished. | 567 // that exits when this task has finished. |
| 567 if (parsed_command_line.HasSwitch(switches::kImport)) | 568 if (parsed_command_line.HasSwitch(switches::kImport)) |
| 568 return FirstRun::ImportNow(profile, parsed_command_line); | 569 return FirstRun::ImportNow(profile, parsed_command_line); |
| 569 | 570 |
| 570 // When another process is running, use it instead of starting us. | 571 // When another process is running, use it instead of starting us. |
| 571 if (process_singleton.NotifyOtherProcess()) | 572 if (process_singleton.NotifyOtherProcess()) { |
| 573 #if defined(OS_LINUX) |
| 574 printf("%s\n", base::SysWideToNativeMB( |
| 575 l10n_util::GetString(IDS_USED_EXISTING_BROWSER)).c_str()); |
| 576 #endif |
| 572 return ResultCodes::NORMAL_EXIT; | 577 return ResultCodes::NORMAL_EXIT; |
| 578 } |
| 573 | 579 |
| 574 // Do the tasks if chrome has been upgraded while it was last running. | 580 // Do the tasks if chrome has been upgraded while it was last running. |
| 575 if (!already_running && DoUpgradeTasks(parsed_command_line)) { | 581 if (!already_running && DoUpgradeTasks(parsed_command_line)) { |
| 576 return ResultCodes::NORMAL_EXIT; | 582 return ResultCodes::NORMAL_EXIT; |
| 577 } | 583 } |
| 578 | 584 |
| 579 // Check if there is any machine level Chrome installed on the current | 585 // Check if there is any machine level Chrome installed on the current |
| 580 // machine. If yes and the current Chrome process is user level, we do not | 586 // machine. If yes and the current Chrome process is user level, we do not |
| 581 // allow the user level Chrome to run. So we notify the user and uninstall | 587 // allow the user level Chrome to run. So we notify the user and uninstall |
| 582 // user level Chrome. | 588 // user level Chrome. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 if (metrics) | 773 if (metrics) |
| 768 metrics->Stop(); | 774 metrics->Stop(); |
| 769 | 775 |
| 770 // browser_shutdown takes care of deleting browser_process, so we need to | 776 // browser_shutdown takes care of deleting browser_process, so we need to |
| 771 // release it. | 777 // release it. |
| 772 browser_process.release(); | 778 browser_process.release(); |
| 773 browser_shutdown::Shutdown(); | 779 browser_shutdown::Shutdown(); |
| 774 | 780 |
| 775 return result_code; | 781 return result_code; |
| 776 } | 782 } |
| OLD | NEW |