| 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/common/system/system_notifier.h" | 7 #include "ash/common/system/system_notifier.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 OnErrorChanged(); | 107 OnErrorChanged(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 SyncErrorNotifier::~SyncErrorNotifier() { | 110 SyncErrorNotifier::~SyncErrorNotifier() { |
| 111 DCHECK(!error_controller_) | 111 DCHECK(!error_controller_) |
| 112 << "SyncErrorNotifier::Shutdown() was not called"; | 112 << "SyncErrorNotifier::Shutdown() was not called"; |
| 113 } | 113 } |
| 114 | 114 |
| 115 void SyncErrorNotifier::Shutdown() { | 115 void SyncErrorNotifier::Shutdown() { |
| 116 error_controller_->RemoveObserver(this); | 116 error_controller_->RemoveObserver(this); |
| 117 error_controller_ = NULL; | 117 error_controller_ = nullptr; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void SyncErrorNotifier::OnErrorChanged() { | 120 void SyncErrorNotifier::OnErrorChanged() { |
| 121 NotificationUIManager* notification_ui_manager = | 121 NotificationUIManager* notification_ui_manager = |
| 122 g_browser_process->notification_ui_manager(); | 122 g_browser_process->notification_ui_manager(); |
| 123 | 123 |
| 124 // notification_ui_manager() may return NULL when shutting down. | 124 // notification_ui_manager() may return null when shutting down. |
| 125 if (!notification_ui_manager) | 125 if (!notification_ui_manager) |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 if (!error_controller_->HasError()) { | 128 if (!error_controller_->HasError()) { |
| 129 g_browser_process->notification_ui_manager()->CancelById( | 129 g_browser_process->notification_ui_manager()->CancelById( |
| 130 notification_id_, NotificationUIManager::GetProfileID(profile_)); | 130 notification_id_, NotificationUIManager::GetProfileID(profile_)); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 #if defined(OS_CHROMEOS) | 134 #if defined(OS_CHROMEOS) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 message_center::NOTIFICATION_TYPE_SIMPLE, | 171 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 172 l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE), | 172 l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE), |
| 173 l10n_util::GetStringUTF16(IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE), | 173 l10n_util::GetStringUTF16(IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE), |
| 174 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 174 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 175 IDR_NOTIFICATION_ALERT), | 175 IDR_NOTIFICATION_ALERT), |
| 176 notifier_id, | 176 notifier_id, |
| 177 base::string16(), // display_source | 177 base::string16(), // display_source |
| 178 GURL(notification_id_), notification_id_, data, delegate); | 178 GURL(notification_id_), notification_id_, data, delegate); |
| 179 notification_ui_manager->Add(notification, profile_); | 179 notification_ui_manager->Add(notification, profile_); |
| 180 } | 180 } |
| OLD | NEW |