| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 if (extension_startup_helper.PackExtension(parsed_command_line())) | 1640 if (extension_startup_helper.PackExtension(parsed_command_line())) |
| 1641 return content::RESULT_CODE_NORMAL_EXIT; | 1641 return content::RESULT_CODE_NORMAL_EXIT; |
| 1642 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; | 1642 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 // When another process is running, use that process instead of starting a | 1645 // When another process is running, use that process instead of starting a |
| 1646 // new one. NotifyOtherProcess will currently give the other process up to | 1646 // new one. NotifyOtherProcess will currently give the other process up to |
| 1647 // 20 seconds to respond. Note that this needs to be done before we attempt | 1647 // 20 seconds to respond. Note that this needs to be done before we attempt |
| 1648 // to read the profile. | 1648 // to read the profile. |
| 1649 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate(); | 1649 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate(); |
| 1650 UMA_HISTOGRAM_ENUMERATION("Chrome.ProcessSingleton.NotifyResult", |
| 1651 notify_result_, |
| 1652 ProcessSingleton::kNumNotifyResults); |
| 1650 switch (notify_result_) { | 1653 switch (notify_result_) { |
| 1651 case ProcessSingleton::PROCESS_NONE: | 1654 case ProcessSingleton::PROCESS_NONE: |
| 1652 // No process already running, fall through to starting a new one. | 1655 // No process already running, fall through to starting a new one. |
| 1653 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( | 1656 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( |
| 1654 *base::CommandLine::ForCurrentProcess()); | 1657 *base::CommandLine::ForCurrentProcess()); |
| 1655 break; | 1658 break; |
| 1656 | 1659 |
| 1657 case ProcessSingleton::PROCESS_NOTIFIED: | 1660 case ProcessSingleton::PROCESS_NOTIFIED: |
| 1658 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 1661 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 1659 // On POSIX systems, print a message notifying the process is running. | 1662 // On POSIX systems, print a message notifying the process is running. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1672 case ProcessSingleton::PROFILE_IN_USE: | 1675 case ProcessSingleton::PROFILE_IN_USE: |
| 1673 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1676 return chrome::RESULT_CODE_PROFILE_IN_USE; |
| 1674 | 1677 |
| 1675 case ProcessSingleton::LOCK_ERROR: | 1678 case ProcessSingleton::LOCK_ERROR: |
| 1676 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " | 1679 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " |
| 1677 "directory. This means that running multiple instances " | 1680 "directory. This means that running multiple instances " |
| 1678 "would start multiple browser processes rather than " | 1681 "would start multiple browser processes rather than " |
| 1679 "opening a new window in the existing process. Aborting " | 1682 "opening a new window in the existing process. Aborting " |
| 1680 "now to avoid profile corruption."; | 1683 "now to avoid profile corruption."; |
| 1681 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1684 return chrome::RESULT_CODE_PROFILE_IN_USE; |
| 1682 | |
| 1683 default: | |
| 1684 NOTREACHED(); | |
| 1685 } | 1685 } |
| 1686 #endif // !defined(OS_ANDROID) | 1686 #endif // !defined(OS_ANDROID) |
| 1687 | 1687 |
| 1688 // Handle special early return paths (which couldn't be processed even earlier | 1688 // Handle special early return paths (which couldn't be processed even earlier |
| 1689 // as they require the process singleton to be held) first. | 1689 // as they require the process singleton to be held) first. |
| 1690 | 1690 |
| 1691 std::string try_chrome = | 1691 std::string try_chrome = |
| 1692 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); | 1692 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); |
| 1693 if (!try_chrome.empty()) { | 1693 if (!try_chrome.empty()) { |
| 1694 #if defined(OS_WIN) | 1694 #if defined(OS_WIN) |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 chromeos::CrosSettings::Shutdown(); | 2226 chromeos::CrosSettings::Shutdown(); |
| 2227 #endif // defined(OS_CHROMEOS) | 2227 #endif // defined(OS_CHROMEOS) |
| 2228 #endif // defined(OS_ANDROID) | 2228 #endif // defined(OS_ANDROID) |
| 2229 } | 2229 } |
| 2230 | 2230 |
| 2231 // Public members: | 2231 // Public members: |
| 2232 | 2232 |
| 2233 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2233 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2234 chrome_extra_parts_.push_back(parts); | 2234 chrome_extra_parts_.push_back(parts); |
| 2235 } | 2235 } |
| OLD | NEW |