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/sync/sync_error_notifier_ash.h" | 5 #include "chrome/browser/sync/sync_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/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
24 #include "third_party/WebKit/public/web/WebTextDirection.h" | 24 #include "third_party/WebKit/public/web/WebTextDirection.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/message_center/notification.h" | 27 #include "ui/message_center/notification.h" |
28 #include "ui/message_center/notification_delegate.h" | 28 #include "ui/message_center/notification_delegate.h" |
29 | 29 |
30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
31 #include "chrome/browser/chromeos/login/user_flow.h" | 31 #include "chrome/browser/chromeos/login/user_flow.h" |
32 #include "chrome/browser/chromeos/login/users/user_manager.h" | 32 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 33 #include "components/user_manager/user_manager.h" |
33 #endif | 34 #endif |
34 | 35 |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
38 const char kProfileSyncNotificationId[] = "chrome://settings/sync/"; | 39 const char kProfileSyncNotificationId[] = "chrome://settings/sync/"; |
39 | 40 |
40 // A simple notification delegate for the sync setup button. | 41 // A simple notification delegate for the sync setup button. |
41 class SyncNotificationDelegate : public NotificationDelegate { | 42 class SyncNotificationDelegate : public NotificationDelegate { |
42 public: | 43 public: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // notification_ui_manager() may return NULL when shutting down. | 149 // notification_ui_manager() may return NULL when shutting down. |
149 if (!notification_ui_manager) | 150 if (!notification_ui_manager) |
150 return; | 151 return; |
151 | 152 |
152 if (!error_controller_->HasError()) { | 153 if (!error_controller_->HasError()) { |
153 g_browser_process->notification_ui_manager()->CancelById(notification_id_); | 154 g_browser_process->notification_ui_manager()->CancelById(notification_id_); |
154 return; | 155 return; |
155 } | 156 } |
156 | 157 |
157 #if defined(OS_CHROMEOS) | 158 #if defined(OS_CHROMEOS) |
158 if (chromeos::UserManager::IsInitialized()) { | 159 if (user_manager::UserManager::IsInitialized()) { |
159 chromeos::UserFlow* user_flow = | 160 chromeos::UserFlow* user_flow = |
160 chromeos::UserManager::Get()->GetCurrentUserFlow(); | 161 chromeos::ChromeUserManager::Get()->GetCurrentUserFlow(); |
161 | 162 |
162 // Check whether Chrome OS user flow allows launching browser. | 163 // Check whether Chrome OS user flow allows launching browser. |
163 // Example: Supervised user creation flow which handles token invalidation | 164 // Example: Supervised user creation flow which handles token invalidation |
164 // itself and notifications should be suppressed. http://crbug.com/359045 | 165 // itself and notifications should be suppressed. http://crbug.com/359045 |
165 if (!user_flow->ShouldLaunchBrowser()) | 166 if (!user_flow->ShouldLaunchBrowser()) |
166 return; | 167 return; |
167 } | 168 } |
168 #endif | 169 #endif |
169 | 170 |
170 // Keep the existing notification if there is one. | 171 // Keep the existing notification if there is one. |
(...skipping 25 matching lines...) Expand all Loading... |
196 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 197 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
197 IDR_NOTIFICATION_ALERT), | 198 IDR_NOTIFICATION_ALERT), |
198 blink::WebTextDirectionDefault, | 199 blink::WebTextDirectionDefault, |
199 notifier_id, | 200 notifier_id, |
200 base::string16(), // display_source | 201 base::string16(), // display_source |
201 base::ASCIIToUTF16(notification_id_), | 202 base::ASCIIToUTF16(notification_id_), |
202 data, | 203 data, |
203 delegate); | 204 delegate); |
204 notification_ui_manager->Add(notification, profile_); | 205 notification_ui_manager->Add(notification, profile_); |
205 } | 206 } |
OLD | NEW |