| 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/signin/signin_error_notifier_ash.h" | 5 #include "chrome/browser/signin/signin_error_notifier_ash.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/system_notifier.h" | 9 #include "ash/system/system_notifier.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 15 #include "chrome/browser/notifications/notification.h" | 15 #include "chrome/browser/notifications/notification.h" |
| 16 #include "chrome/browser/notifications/notification_delegate.h" | 16 #include "chrome/browser/notifications/notification_delegate.h" |
| 17 #include "chrome/browser/notifications/notification_ui_manager.h" | 17 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 19 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 20 #include "chrome/browser/ui/browser_tabstrip.h" | 20 #include "chrome/browser/ui/browser_tabstrip.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "chrome/browser/ui/chrome_pages.h" | 22 #include "chrome/browser/ui/chrome_pages.h" |
| 23 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 23 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 24 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 24 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 25 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 25 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "chrome/grit/chromium_strings.h" | 27 #include "chrome/grit/chromium_strings.h" |
| 28 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
| 29 #include "components/signin/core/account_id/account_id.h" |
| 29 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/message_center/notification.h" | 33 #include "ui/message_center/notification.h" |
| 33 #include "ui/message_center/notification_delegate.h" | 34 #include "ui/message_center/notification_delegate.h" |
| 34 | 35 |
| 35 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 36 #include "chrome/browser/chromeos/login/user_flow.h" | 37 #include "chrome/browser/chromeos/login/user_flow.h" |
| 37 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 38 #include "components/user_manager/user_manager.h" | 39 #include "components/user_manager/user_manager.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 168 |
| 168 // Set the delegate for the notification's sign-out button. | 169 // Set the delegate for the notification's sign-out button. |
| 169 SigninNotificationDelegate* delegate = | 170 SigninNotificationDelegate* delegate = |
| 170 new SigninNotificationDelegate(notification_id_, profile_); | 171 new SigninNotificationDelegate(notification_id_, profile_); |
| 171 | 172 |
| 172 message_center::NotifierId notifier_id( | 173 message_center::NotifierId notifier_id( |
| 173 message_center::NotifierId::SYSTEM_COMPONENT, | 174 message_center::NotifierId::SYSTEM_COMPONENT, |
| 174 kProfileSigninNotificationId); | 175 kProfileSigninNotificationId); |
| 175 | 176 |
| 176 // Set |profile_id| for multi-user notification blocker. | 177 // Set |profile_id| for multi-user notification blocker. |
| 177 notifier_id.profile_id = multi_user_util::GetUserIDFromProfile(profile_); | 178 notifier_id.profile_id = |
| 179 multi_user_util::GetAccountIdFromProfile(profile_).GetUserEmail(); |
| 178 | 180 |
| 179 Notification notification( | 181 Notification notification( |
| 180 message_center::NOTIFICATION_TYPE_SIMPLE, | 182 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 181 l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE), | 183 l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE), |
| 182 GetMessageBody(), ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 184 GetMessageBody(), ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 183 IDR_NOTIFICATION_ALERT), | 185 IDR_NOTIFICATION_ALERT), |
| 184 notifier_id, | 186 notifier_id, |
| 185 base::string16(), // display_source | 187 base::string16(), // display_source |
| 186 GURL(notification_id_), notification_id_, data, delegate); | 188 GURL(notification_id_), notification_id_, data, delegate); |
| 187 | 189 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 211 return l10n_util::GetStringUTF16( | 213 return l10n_util::GetStringUTF16( |
| 212 IDS_SYNC_UNAVAILABLE_ERROR_BUBBLE_VIEW_MESSAGE); | 214 IDS_SYNC_UNAVAILABLE_ERROR_BUBBLE_VIEW_MESSAGE); |
| 213 break; | 215 break; |
| 214 | 216 |
| 215 // Generic message for "other" errors. | 217 // Generic message for "other" errors. |
| 216 default: | 218 default: |
| 217 return l10n_util::GetStringUTF16( | 219 return l10n_util::GetStringUTF16( |
| 218 IDS_SYNC_OTHER_SIGN_IN_ERROR_BUBBLE_VIEW_MESSAGE); | 220 IDS_SYNC_OTHER_SIGN_IN_ERROR_BUBBLE_VIEW_MESSAGE); |
| 219 } | 221 } |
| 220 } | 222 } |
| OLD | NEW |