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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1508 | 1508 |
1509 // If the command line specifies --pack-extension, attempt the pack extension | 1509 // If the command line specifies --pack-extension, attempt the pack extension |
1510 // startup action and exit. | 1510 // startup action and exit. |
1511 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { | 1511 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { |
1512 ExtensionsStartupUtil extension_startup_util; | 1512 ExtensionsStartupUtil extension_startup_util; |
1513 if (extension_startup_util.PackExtension(parsed_command_line())) | 1513 if (extension_startup_util.PackExtension(parsed_command_line())) |
1514 return content::RESULT_CODE_NORMAL_EXIT; | 1514 return content::RESULT_CODE_NORMAL_EXIT; |
1515 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; | 1515 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; |
1516 } | 1516 } |
1517 | 1517 |
1518 bool pass_command_line = | |
Paweł Hajdan Jr.
2012/06/23 07:23:37
This #ifdef-mixed assignment is ugly. Please find
| |
1518 #if !defined(OS_MACOSX) | 1519 #if !defined(OS_MACOSX) |
Albert Bodenhamer
2012/06/27 16:35:33
This is a bit hard to parse. perhaps something li
| |
1519 // In environments other than Mac OS X we support import of settings | 1520 // In environments other than Mac OS X we support import of settings |
1520 // from other browsers. In case this process is a short-lived "import" | 1521 // from other browsers. In case this process is a short-lived "import" |
1521 // process that another browser runs just to import the settings, we | 1522 // process that another browser runs just to import the settings, we |
1522 // don't want to be checking for another browser process, by design. | 1523 // don't want to be checking for another browser process, by design. |
1523 if (!HasImportSwitch(parsed_command_line())) { | 1524 !HasImportSwitch(parsed_command_line()) && |
1524 #endif | 1525 #endif |
1526 // If we're being launched just to check the connector policy, we are | |
1527 // short-lived and don't want to be passing that switch off. | |
1528 !parsed_command_line().HasSwitch( | |
1529 switches::kCheckCloudPrintConnectorPolicy); | |
1530 | |
1531 if (pass_command_line) { | |
1525 // When another process is running, use that process instead of starting a | 1532 // When another process is running, use that process instead of starting a |
1526 // new one. NotifyOtherProcess will currently give the other process up to | 1533 // new one. NotifyOtherProcess will currently give the other process up to |
1527 // 20 seconds to respond. Note that this needs to be done before we attempt | 1534 // 20 seconds to respond. Note that this needs to be done before we attempt |
1528 // to read the profile. | 1535 // to read the profile. |
1529 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate( | 1536 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate( |
1530 base::Bind(&ProcessSingletonNotificationCallback)); | 1537 base::Bind(&ProcessSingletonNotificationCallback)); |
1531 switch (notify_result_) { | 1538 switch (notify_result_) { |
1532 case ProcessSingleton::PROCESS_NONE: | 1539 case ProcessSingleton::PROCESS_NONE: |
1533 // No process already running, fall through to starting a new one. | 1540 // No process already running, fall through to starting a new one. |
1534 break; | 1541 break; |
(...skipping 12 matching lines...) Expand all Loading... | |
1547 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " | 1554 LOG(ERROR) << "Failed to create a ProcessSingleton for your profile " |
1548 "directory. This means that running multiple instances " | 1555 "directory. This means that running multiple instances " |
1549 "would start multiple browser processes rather than " | 1556 "would start multiple browser processes rather than " |
1550 "opening a new window in the existing process. Aborting " | 1557 "opening a new window in the existing process. Aborting " |
1551 "now to avoid profile corruption."; | 1558 "now to avoid profile corruption."; |
1552 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1559 return chrome::RESULT_CODE_PROFILE_IN_USE; |
1553 | 1560 |
1554 default: | 1561 default: |
1555 NOTREACHED(); | 1562 NOTREACHED(); |
1556 } | 1563 } |
1557 #if !defined(OS_MACOSX) // closing brace for if | |
1558 } | 1564 } |
1559 #endif | |
1560 | 1565 |
1561 #if defined(USE_X11) | 1566 #if defined(USE_X11) |
1562 SetBrowserX11ErrorHandlers(); | 1567 SetBrowserX11ErrorHandlers(); |
1563 #endif | 1568 #endif |
1564 | 1569 |
1565 // Desktop construction occurs here, (required before profile creation). | 1570 // Desktop construction occurs here, (required before profile creation). |
1566 PreProfileInit(); | 1571 PreProfileInit(); |
1567 | 1572 |
1568 // Profile creation ---------------------------------------------------------- | 1573 // Profile creation ---------------------------------------------------------- |
1569 | 1574 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1959 // otherwise it will be done by the destructor in a wrong thread. | 1964 // otherwise it will be done by the destructor in a wrong thread. |
1960 if (parameters().ui_task == NULL && translate_manager_ != NULL) | 1965 if (parameters().ui_task == NULL && translate_manager_ != NULL) |
1961 translate_manager_->CleanupPendingUlrFetcher(); | 1966 translate_manager_->CleanupPendingUlrFetcher(); |
1962 | 1967 |
1963 if (notify_result_ == ProcessSingleton::PROCESS_NONE) | 1968 if (notify_result_ == ProcessSingleton::PROCESS_NONE) |
1964 process_singleton_->Cleanup(); | 1969 process_singleton_->Cleanup(); |
1965 | 1970 |
1966 // Stop all tasks that might run on WatchDogThread. | 1971 // Stop all tasks that might run on WatchDogThread. |
1967 ThreadWatcherList::StopWatchingAll(); | 1972 ThreadWatcherList::StopWatchingAll(); |
1968 | 1973 |
1969 browser_process_->metrics_service()->Stop(); | 1974 if (browser_process_->metrics_service()) |
1975 browser_process_->metrics_service()->Stop(); | |
1970 | 1976 |
1971 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); | 1977 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); |
1972 browser_process_->StartTearDown(); | 1978 browser_process_->StartTearDown(); |
1973 } | 1979 } |
1974 | 1980 |
1975 void ChromeBrowserMainParts::PostDestroyThreads() { | 1981 void ChromeBrowserMainParts::PostDestroyThreads() { |
1976 browser_process_->PostDestroyThreads(); | 1982 browser_process_->PostDestroyThreads(); |
1977 // browser_shutdown takes care of deleting browser_process, so we need to | 1983 // browser_shutdown takes care of deleting browser_process, so we need to |
1978 // release it. | 1984 // release it. |
1979 ignore_result(browser_process_.release()); | 1985 ignore_result(browser_process_.release()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2035 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2041 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2036 uma_name += "_XP"; | 2042 uma_name += "_XP"; |
2037 | 2043 |
2038 uma_name += "_PreRead_"; | 2044 uma_name += "_PreRead_"; |
2039 uma_name += pre_read_percentage; | 2045 uma_name += pre_read_percentage; |
2040 AddPreReadHistogramTime(uma_name.c_str(), time); | 2046 AddPreReadHistogramTime(uma_name.c_str(), time); |
2041 } | 2047 } |
2042 #endif | 2048 #endif |
2043 #endif | 2049 #endif |
2044 } | 2050 } |
OLD | NEW |