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 <set> | 10 #include <set> |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 226 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
227 #include "chrome/browser/first_run/upgrade_util.h" | 227 #include "chrome/browser/first_run/upgrade_util.h" |
228 #endif | 228 #endif |
229 | 229 |
230 #if !defined(DISABLE_NACL) | 230 #if !defined(DISABLE_NACL) |
231 #include "chrome/browser/component_updater/pnacl_component_installer.h" | 231 #include "chrome/browser/component_updater/pnacl_component_installer.h" |
232 #include "components/nacl/browser/nacl_process_host.h" | 232 #include "components/nacl/browser/nacl_process_host.h" |
233 #endif // !defined(DISABLE_NACL) | 233 #endif // !defined(DISABLE_NACL) |
234 | 234 |
| 235 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 236 #include "chrome/browser/background/background_mode_manager.h" |
| 237 #endif // BUILDFLAG(ENABLE_BACKGROUND) |
| 238 |
235 #if defined(ENABLE_EXTENSIONS) | 239 #if defined(ENABLE_EXTENSIONS) |
236 #include "chrome/browser/extensions/startup_helper.h" | 240 #include "chrome/browser/extensions/startup_helper.h" |
237 #include "extensions/browser/extension_protocols.h" | 241 #include "extensions/browser/extension_protocols.h" |
238 #include "extensions/common/features/feature_provider.h" | 242 #include "extensions/common/features/feature_provider.h" |
239 #include "extensions/components/javascript_dialog_extensions_client/javascript_d
ialog_extension_client_impl.h" | 243 #include "extensions/components/javascript_dialog_extensions_client/javascript_d
ialog_extension_client_impl.h" |
240 #endif // defined(ENABLE_EXTENSIONS) | 244 #endif // defined(ENABLE_EXTENSIONS) |
241 | 245 |
242 #if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 246 #if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
243 #include "printing/printed_document.h" | 247 #include "printing/printed_document.h" |
244 #endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) | 248 #endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 #endif // defined(SYZYASAN) | 2013 #endif // defined(SYZYASAN) |
2010 #endif // defined(OS_ANDROID) | 2014 #endif // defined(OS_ANDROID) |
2011 } | 2015 } |
2012 | 2016 |
2013 void ChromeBrowserMainParts::PostDestroyThreads() { | 2017 void ChromeBrowserMainParts::PostDestroyThreads() { |
2014 #if defined(OS_ANDROID) | 2018 #if defined(OS_ANDROID) |
2015 // On Android, there is no quit/exit. So the browser's main message loop will | 2019 // On Android, there is no quit/exit. So the browser's main message loop will |
2016 // not finish. | 2020 // not finish. |
2017 NOTREACHED(); | 2021 NOTREACHED(); |
2018 #else | 2022 #else |
| 2023 |
| 2024 int restart_flags = restart_last_session_ |
| 2025 ? browser_shutdown::RESTART_LAST_SESSION |
| 2026 : browser_shutdown::NO_FLAGS; |
| 2027 |
| 2028 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 2029 if (restart_flags) { |
| 2030 restart_flags |= BackgroundModeManager::should_restart_in_background() |
| 2031 ? browser_shutdown::RESTART_IN_BACKGROUND |
| 2032 : browser_shutdown::NO_FLAGS; |
| 2033 } |
| 2034 #endif // BUILDFLAG(ENABLE_BACKGROUND) |
| 2035 |
2019 browser_process_->PostDestroyThreads(); | 2036 browser_process_->PostDestroyThreads(); |
2020 // browser_shutdown takes care of deleting browser_process, so we need to | 2037 // browser_shutdown takes care of deleting browser_process, so we need to |
2021 // release it. | 2038 // release it. |
2022 ignore_result(browser_process_.release()); | 2039 ignore_result(browser_process_.release()); |
2023 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); | 2040 browser_shutdown::ShutdownPostThreadsStop(restart_flags); |
2024 master_prefs_.reset(); | 2041 master_prefs_.reset(); |
2025 process_singleton_.reset(); | 2042 process_singleton_.reset(); |
2026 device_event_log::Shutdown(); | 2043 device_event_log::Shutdown(); |
2027 | 2044 |
2028 // We need to do this check as late as possible, but due to modularity, this | 2045 // We need to do this check as late as possible, but due to modularity, this |
2029 // may be the last point in Chrome. This would be more effective if done at | 2046 // may be the last point in Chrome. This would be more effective if done at |
2030 // a higher level on the stack, so that it is impossible for an early return | 2047 // a higher level on the stack, so that it is impossible for an early return |
2031 // to bypass this code. Perhaps we need a *final* hook that is called on all | 2048 // to bypass this code. Perhaps we need a *final* hook that is called on all |
2032 // paths from content/browser/browser_main. | 2049 // paths from content/browser/browser_main. |
2033 CHECK(metrics::MetricsService::UmaMetricsProperlyShutdown()); | 2050 CHECK(metrics::MetricsService::UmaMetricsProperlyShutdown()); |
2034 | 2051 |
2035 #if defined(OS_CHROMEOS) | 2052 #if defined(OS_CHROMEOS) |
2036 chromeos::CrosSettings::Shutdown(); | 2053 chromeos::CrosSettings::Shutdown(); |
2037 #endif // defined(OS_CHROMEOS) | 2054 #endif // defined(OS_CHROMEOS) |
2038 #endif // defined(OS_ANDROID) | 2055 #endif // defined(OS_ANDROID) |
2039 } | 2056 } |
2040 | 2057 |
2041 // Public members: | 2058 // Public members: |
2042 | 2059 |
2043 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2060 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
2044 chrome_extra_parts_.push_back(parts); | 2061 chrome_extra_parts_.push_back(parts); |
2045 } | 2062 } |
OLD | NEW |