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