| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/cocoa/apps/quit_with_apps_controller_mac.h" | 5 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/i18n/number_formatting.h" | 11 #include "base/i18n/number_formatting.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/notifications/notification.h" | 17 #include "chrome/browser/notifications/notification.h" |
| 18 #include "chrome/browser/notifications/notification_ui_manager.h" | 18 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/browser_iterator.h" | 20 #include "chrome/browser/ui/browser_iterator.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 23 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 24 #include "grit/chrome_unscaled_resources.h" |
| 24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 #include "grit/google_chrome_strings.h" | 27 #include "grit/google_chrome_strings.h" |
| 27 #include "grit/theme_resources.h" | |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/l10n/l10n_util_mac.h" | 29 #include "ui/base/l10n/l10n_util_mac.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 31 | 31 |
| 32 const char kQuitWithAppsOriginUrl[] = "chrome://quit-with-apps"; | 32 const char kQuitWithAppsOriginUrl[] = "chrome://quit-with-apps"; |
| 33 const int kQuitAllAppsButtonIndex = 0; | 33 const int kQuitAllAppsButtonIndex = 0; |
| 34 const int kDontShowAgainButtonIndex = 1; | 34 const int kDontShowAgainButtonIndex = 1; |
| 35 | 35 |
| 36 const char QuitWithAppsController::kQuitWithAppsNotificationID[] = | 36 const char QuitWithAppsController::kQuitWithAppsNotificationID[] = |
| 37 "quit-with-apps"; | 37 "quit-with-apps"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 message_center::RichNotificationData rich_notification_data; | 51 message_center::RichNotificationData rich_notification_data; |
| 52 rich_notification_data.buttons.push_back(quit_apps_button_info); | 52 rich_notification_data.buttons.push_back(quit_apps_button_info); |
| 53 rich_notification_data.buttons.push_back(suppression_button_info); | 53 rich_notification_data.buttons.push_back(suppression_button_info); |
| 54 | 54 |
| 55 notification_.reset(new Notification( | 55 notification_.reset(new Notification( |
| 56 message_center::NOTIFICATION_TYPE_SIMPLE, | 56 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 57 GURL(kQuitWithAppsOriginUrl), | 57 GURL(kQuitWithAppsOriginUrl), |
| 58 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_TITLE), | 58 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_TITLE), |
| 59 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_EXPLANATION), | 59 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_EXPLANATION), |
| 60 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 60 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 61 IDR_APP_DEFAULT_ICON), | 61 IDR_PRODUCT_LOGO_128), |
| 62 blink::WebTextDirectionDefault, | 62 blink::WebTextDirectionDefault, |
| 63 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 63 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 64 kQuitWithAppsNotificationID), | 64 kQuitWithAppsNotificationID), |
| 65 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_NOTIFICATION_DISPLAY_SOURCE), | 65 l10n_util::GetStringUTF16(IDS_QUIT_WITH_APPS_NOTIFICATION_DISPLAY_SOURCE), |
| 66 replace_id, | 66 replace_id, |
| 67 rich_notification_data, | 67 rich_notification_data, |
| 68 this)); | 68 this)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 QuitWithAppsController::~QuitWithAppsController() {} | 71 QuitWithAppsController::~QuitWithAppsController() {} |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Always return false, the notification UI can be used to quit all apps which | 140 // Always return false, the notification UI can be used to quit all apps which |
| 141 // will cause Chrome to quit. | 141 // will cause Chrome to quit. |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 // static | 145 // static |
| 146 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { | 146 void QuitWithAppsController::RegisterPrefs(PrefRegistrySimple* registry) { |
| 147 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); | 147 registry->RegisterBooleanPref(prefs::kNotifyWhenAppsKeepChromeAlive, true); |
| 148 } | 148 } |
| OLD | NEW |