| 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/files/file_path.h" | 10 #include "base/files/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/mac/sdk_forward_declarations.h" | 13 #include "base/mac/sdk_forward_declarations.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/sys_string_conversions.h" | 17 #include "base/strings/sys_string_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
| 20 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 20 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
| 21 #include "chrome/browser/apps/app_window_registry_util.h" |
| 21 #include "chrome/browser/background/background_application_list_model.h" | 22 #include "chrome/browser/background/background_application_list_model.h" |
| 22 #include "chrome/browser/background/background_mode_manager.h" | 23 #include "chrome/browser/background/background_mode_manager.h" |
| 23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browser_shutdown.h" | 25 #include "chrome/browser/browser_shutdown.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/command_updater.h" | 27 #include "chrome/browser/command_updater.h" |
| 27 #include "chrome/browser/download/download_service.h" | 28 #include "chrome/browser/download/download_service.h" |
| 28 #include "chrome/browser/download/download_service_factory.h" | 29 #include "chrome/browser/download/download_service_factory.h" |
| 29 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
| 30 #include "chrome/browser/first_run/first_run.h" | 31 #include "chrome/browser/first_run/first_run.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 #include "chrome/grit/chromium_strings.h" | 81 #include "chrome/grit/chromium_strings.h" |
| 81 #include "chrome/grit/generated_resources.h" | 82 #include "chrome/grit/generated_resources.h" |
| 82 #include "components/signin/core/browser/signin_manager.h" | 83 #include "components/signin/core/browser/signin_manager.h" |
| 83 #include "components/signin/core/common/profile_management_switches.h" | 84 #include "components/signin/core/common/profile_management_switches.h" |
| 84 #include "content/public/browser/browser_thread.h" | 85 #include "content/public/browser/browser_thread.h" |
| 85 #include "content/public/browser/download_manager.h" | 86 #include "content/public/browser/download_manager.h" |
| 86 #include "content/public/browser/notification_service.h" | 87 #include "content/public/browser/notification_service.h" |
| 87 #include "content/public/browser/notification_types.h" | 88 #include "content/public/browser/notification_types.h" |
| 88 #include "content/public/browser/plugin_service.h" | 89 #include "content/public/browser/plugin_service.h" |
| 89 #include "content/public/browser/user_metrics.h" | 90 #include "content/public/browser/user_metrics.h" |
| 90 #include "extensions/browser/app_window/app_window_registry.h" | |
| 91 #include "extensions/browser/extension_system.h" | 91 #include "extensions/browser/extension_system.h" |
| 92 #include "net/base/filename_util.h" | 92 #include "net/base/filename_util.h" |
| 93 #include "ui/base/cocoa/focus_window_set.h" | 93 #include "ui/base/cocoa/focus_window_set.h" |
| 94 #include "ui/base/l10n/l10n_util.h" | 94 #include "ui/base/l10n/l10n_util.h" |
| 95 #include "ui/base/l10n/l10n_util_mac.h" | 95 #include "ui/base/l10n/l10n_util_mac.h" |
| 96 | 96 |
| 97 using base::UserMetricsAction; | 97 using base::UserMetricsAction; |
| 98 using content::BrowserContext; | 98 using content::BrowserContext; |
| 99 using content::BrowserThread; | 99 using content::BrowserThread; |
| 100 using content::DownloadManager; | 100 using content::DownloadManager; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 browser_shutdown::SetTryingToQuit(false); | 426 browser_shutdown::SetTryingToQuit(false); |
| 427 | 427 |
| 428 // TODO(viettrungluu): Were we to remove Apple Event handlers above, we | 428 // TODO(viettrungluu): Were we to remove Apple Event handlers above, we |
| 429 // would have to reinstall them here. http://crbug.com/40861 | 429 // would have to reinstall them here. http://crbug.com/40861 |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 | 432 |
| 433 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)app { | 433 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)app { |
| 434 // If there are no windows, quit immediately. | 434 // If there are no windows, quit immediately. |
| 435 if (chrome::BrowserIterator().done() && | 435 if (chrome::BrowserIterator().done() && |
| 436 !extensions::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(0)) { | 436 !AppWindowRegistryUtil::IsAppWindowRegisteredInAnyProfile(0)) { |
| 437 return NSTerminateNow; | 437 return NSTerminateNow; |
| 438 } | 438 } |
| 439 | 439 |
| 440 // Check if the preference is turned on. | 440 // Check if the preference is turned on. |
| 441 const PrefService* prefs = g_browser_process->local_state(); | 441 const PrefService* prefs = g_browser_process->local_state(); |
| 442 if (!prefs->GetBoolean(prefs::kConfirmToQuitEnabled)) { | 442 if (!prefs->GetBoolean(prefs::kConfirmToQuitEnabled)) { |
| 443 confirm_quit::RecordHistogram(confirm_quit::kNoConfirm); | 443 confirm_quit::RecordHistogram(confirm_quit::kNoConfirm); |
| 444 return NSTerminateNow; | 444 return NSTerminateNow; |
| 445 } | 445 } |
| 446 | 446 |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 | 1580 |
| 1581 //--------------------------------------------------------------------------- | 1581 //--------------------------------------------------------------------------- |
| 1582 | 1582 |
| 1583 namespace app_controller_mac { | 1583 namespace app_controller_mac { |
| 1584 | 1584 |
| 1585 bool IsOpeningNewWindow() { | 1585 bool IsOpeningNewWindow() { |
| 1586 return g_is_opening_new_window; | 1586 return g_is_opening_new_window; |
| 1587 } | 1587 } |
| 1588 | 1588 |
| 1589 } // namespace app_controller_mac | 1589 } // namespace app_controller_mac |
| OLD | NEW |