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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
12 #include "base/mac/mac_util.h" | 12 #include "base/mac/mac_util.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
18 #include "chrome/browser/background/background_application_list_model.h" | 18 #include "chrome/browser/background/background_application_list_model.h" |
19 #include "chrome/browser/background/background_mode_manager.h" | 19 #include "chrome/browser/background/background_mode_manager.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/browser_shutdown.h" | 21 #include "chrome/browser/browser_shutdown.h" |
22 #include "chrome/browser/command_updater.h" | 22 #include "chrome/browser/command_updater.h" |
23 #include "chrome/browser/download/download_service.h" | 23 #include "chrome/browser/download/download_service.h" |
24 #include "chrome/browser/download/download_service_factory.h" | 24 #include "chrome/browser/download/download_service_factory.h" |
25 #include "chrome/browser/first_run/first_run.h" | 25 #include "chrome/browser/first_run/first_run.h" |
26 #include "chrome/browser/prefs/pref_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
27 #include "chrome/browser/printing/cloud_print/virtual_driver_install_helper.h" | 27 #include "chrome/browser/printing/cloud_print/virtual_driver_install_helper.h" |
28 #include "chrome/browser/printing/print_dialog_cloud.h" | 28 #include "chrome/browser/printing/print_dialog_cloud.h" |
29 #include "chrome/browser/printing/print_job_manager.h" | |
30 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/service/service_process_control.h" | 30 #include "chrome/browser/service/service_process_control.h" |
32 #include "chrome/browser/sessions/session_service.h" | 31 #include "chrome/browser/sessions/session_service.h" |
33 #include "chrome/browser/sessions/session_service_factory.h" | 32 #include "chrome/browser/sessions/session_service_factory.h" |
34 #include "chrome/browser/sessions/tab_restore_service.h" | 33 #include "chrome/browser/sessions/tab_restore_service.h" |
35 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 34 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
36 #include "chrome/browser/sync/profile_sync_service.h" | 35 #include "chrome/browser/sync/profile_sync_service.h" |
37 #include "chrome/browser/sync/sync_ui_util.h" | 36 #include "chrome/browser/sync/sync_ui_util.h" |
38 #include "chrome/browser/sync/sync_ui_util_mac.h" | 37 #include "chrome/browser/sync/sync_ui_util_mac.h" |
39 #include "chrome/browser/ui/browser.h" | 38 #include "chrome/browser/ui/browser.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // though.) http://crbug.com/40861 | 306 // though.) http://crbug.com/40861 |
308 | 307 |
309 // Check if the user really wants to quit by employing the confirm-to-quit | 308 // Check if the user really wants to quit by employing the confirm-to-quit |
310 // mechanism. | 309 // mechanism. |
311 if (!browser_shutdown::IsTryingToQuit() && | 310 if (!browser_shutdown::IsTryingToQuit() && |
312 [self applicationShouldTerminate:app] != NSTerminateNow) | 311 [self applicationShouldTerminate:app] != NSTerminateNow) |
313 return NO; | 312 return NO; |
314 | 313 |
315 size_t num_browsers = BrowserList::size(); | 314 size_t num_browsers = BrowserList::size(); |
316 | 315 |
317 // Give any print jobs in progress time to finish. | |
318 if (!browser_shutdown::IsTryingToQuit()) | |
319 g_browser_process->print_job_manager()->StopJobs(true); | |
320 | |
321 // Initiate a shutdown (via BrowserList::CloseAllBrowsers()) if we aren't | 316 // Initiate a shutdown (via BrowserList::CloseAllBrowsers()) if we aren't |
322 // already shutting down. | 317 // already shutting down. |
323 if (!browser_shutdown::IsTryingToQuit()) { | 318 if (!browser_shutdown::IsTryingToQuit()) { |
324 content::NotificationService::current()->Notify( | 319 content::NotificationService::current()->Notify( |
325 content::NOTIFICATION_APP_EXITING, | 320 content::NOTIFICATION_APP_EXITING, |
326 content::NotificationService::AllSources(), | 321 content::NotificationService::AllSources(), |
327 content::NotificationService::NoDetails()); | 322 content::NotificationService::NoDetails()); |
328 BrowserList::CloseAllBrowsers(); | 323 BrowserList::CloseAllBrowsers(); |
329 } | 324 } |
330 | 325 |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 | 1314 |
1320 } // namespace browser | 1315 } // namespace browser |
1321 | 1316 |
1322 namespace app_controller_mac { | 1317 namespace app_controller_mac { |
1323 | 1318 |
1324 bool IsOpeningNewWindow() { | 1319 bool IsOpeningNewWindow() { |
1325 return g_is_opening_new_window; | 1320 return g_is_opening_new_window; |
1326 } | 1321 } |
1327 | 1322 |
1328 } // namespace app_controller_mac | 1323 } // namespace app_controller_mac |
OLD | NEW |