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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 | 1548 |
1549 // If the command line specifies --pack-extension, attempt the pack extension | 1549 // If the command line specifies --pack-extension, attempt the pack extension |
1550 // startup action and exit. | 1550 // startup action and exit. |
1551 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { | 1551 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { |
1552 ExtensionsStartupUtil extension_startup_util; | 1552 ExtensionsStartupUtil extension_startup_util; |
1553 if (extension_startup_util.PackExtension(parsed_command_line())) | 1553 if (extension_startup_util.PackExtension(parsed_command_line())) |
1554 return content::RESULT_CODE_NORMAL_EXIT; | 1554 return content::RESULT_CODE_NORMAL_EXIT; |
1555 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; | 1555 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; |
1556 } | 1556 } |
1557 | 1557 |
1558 bool pass_command_line = true; | |
1559 | |
1560 #if !defined(OS_MACOSX) | 1558 #if !defined(OS_MACOSX) |
1561 // In environments other than Mac OS X we support import of settings | 1559 // In environments other than Mac OS X we support import of settings |
1562 // from other browsers. In case this process is a short-lived "import" | 1560 // from other browsers. In case this process is a short-lived "import" |
1563 // process that another browser runs just to import the settings, we | 1561 // process that another browser runs just to import the settings, we |
1564 // don't want to be checking for another browser process, by design. | 1562 // don't want to be checking for another browser process, by design. |
1565 pass_command_line = !HasImportSwitch(parsed_command_line()); | 1563 if (!HasImportSwitch(parsed_command_line())) { |
1566 #endif | 1564 #endif |
1567 | |
1568 // If we're being launched just to check the connector policy, we are | |
1569 // short-lived and don't want to be passing that switch off. | |
1570 pass_command_line = pass_command_line && !parsed_command_line().HasSwitch( | |
1571 switches::kCheckCloudPrintConnectorPolicy); | |
1572 | |
1573 if (pass_command_line) { | |
1574 // When another process is running, use that process instead of starting a | 1565 // When another process is running, use that process instead of starting a |
1575 // new one. NotifyOtherProcess will currently give the other process up to | 1566 // new one. NotifyOtherProcess will currently give the other process up to |
1576 // 20 seconds to respond. Note that this needs to be done before we attempt | 1567 // 20 seconds to respond. Note that this needs to be done before we attempt |
1577 // to read the profile. | 1568 // to read the profile. |
1578 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate( | 1569 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate( |
1579 base::Bind(&ProcessSingletonNotificationCallback)); | 1570 base::Bind(&ProcessSingletonNotificationCallback)); |
1580 switch (notify_result_) { | 1571 switch (notify_result_) { |
1581 case ProcessSingleton::PROCESS_NONE: | 1572 case ProcessSingleton::PROCESS_NONE: |
1582 // No process already running, fall through to starting a new one. | 1573 // No process already running, fall through to starting a new one. |
1583 break; | 1574 break; |
1584 | 1575 |
1585 case ProcessSingleton::PROCESS_NOTIFIED: | 1576 case ProcessSingleton::PROCESS_NOTIFIED: |
1586 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 1577 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
1587 printf("%s\n", base::SysWideToNativeMB(UTF16ToWide( | 1578 printf("%s\n", base::SysWideToNativeMB(UTF16ToWide( |
1588 l10n_util::GetStringUTF16(IDS_USED_EXISTING_BROWSER))).c_str()); | 1579 l10n_util::GetStringUTF16(IDS_USED_EXISTING_BROWSER))).c_str()); |
1589 #endif | 1580 #endif |
1590 return chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED; | 1581 return content::RESULT_CODE_NORMAL_EXIT; |
1591 | 1582 |
1592 case ProcessSingleton::PROFILE_IN_USE: | 1583 case ProcessSingleton::PROFILE_IN_USE: |
1593 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1584 return chrome::RESULT_CODE_PROFILE_IN_USE; |
1594 | 1585 |
1595 case ProcessSingleton::LOCK_ERROR: | 1586 case ProcessSingleton::LOCK_ERROR: |
1596 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " | 1587 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " |
1597 "directory. This means that running multiple instances " | 1588 "directory. This means that running multiple instances " |
1598 "would start multiple browser processes rather than " | 1589 "would start multiple browser processes rather than " |
1599 "opening a new window in the existing process. Aborting " | 1590 "opening a new window in the existing process. Aborting " |
1600 "now to avoid profile corruption."; | 1591 "now to avoid profile corruption."; |
1601 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1592 return chrome::RESULT_CODE_PROFILE_IN_USE; |
1602 | 1593 |
1603 default: | 1594 default: |
1604 NOTREACHED(); | 1595 NOTREACHED(); |
1605 } | 1596 } |
| 1597 #if !defined(OS_MACOSX) // closing brace for if |
1606 } | 1598 } |
| 1599 #endif |
1607 | 1600 |
1608 #if defined(USE_X11) | 1601 #if defined(USE_X11) |
1609 SetBrowserX11ErrorHandlers(); | 1602 SetBrowserX11ErrorHandlers(); |
1610 #endif | 1603 #endif |
1611 | 1604 |
1612 // Desktop construction occurs here, (required before profile creation). | 1605 // Desktop construction occurs here, (required before profile creation). |
1613 PreProfileInit(); | 1606 PreProfileInit(); |
1614 | 1607 |
1615 // Profile creation ---------------------------------------------------------- | 1608 // Profile creation ---------------------------------------------------------- |
1616 | 1609 |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2079 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2087 uma_name += "_XP"; | 2080 uma_name += "_XP"; |
2088 | 2081 |
2089 uma_name += "_PreRead_"; | 2082 uma_name += "_PreRead_"; |
2090 uma_name += pre_read_percentage; | 2083 uma_name += pre_read_percentage; |
2091 AddPreReadHistogramTime(uma_name.c_str(), time); | 2084 AddPreReadHistogramTime(uma_name.c_str(), time); |
2092 } | 2085 } |
2093 #endif | 2086 #endif |
2094 #endif | 2087 #endif |
2095 } | 2088 } |
OLD | NEW |