| 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/chromeos/file_system_provider/notification_manager.h" | 5 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 9 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 message_center::RichNotificationData rich_notification_data; | 124 message_center::RichNotificationData rich_notification_data; |
| 125 rich_notification_data.buttons.push_back( | 125 rich_notification_data.buttons.push_back( |
| 126 message_center::ButtonInfo(l10n_util::GetStringUTF16( | 126 message_center::ButtonInfo(l10n_util::GetStringUTF16( |
| 127 IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_ABORT_BUTTON))); | 127 IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_ABORT_BUTTON))); |
| 128 | 128 |
| 129 scoped_ptr<message_center::Notification> notification( | 129 scoped_ptr<message_center::Notification> notification( |
| 130 new message_center::Notification( | 130 new message_center::Notification( |
| 131 message_center::NOTIFICATION_TYPE_SIMPLE, | 131 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 132 file_system_info_.mount_path().value(), | 132 file_system_info_.mount_path().value(), |
| 133 base::UTF8ToUTF16(file_system_info_.file_system_name()), | 133 base::UTF8ToUTF16(file_system_info_.display_name()), |
| 134 l10n_util::GetStringUTF16( | 134 l10n_util::GetStringUTF16( |
| 135 callbacks_.size() == 1 | 135 callbacks_.size() == 1 |
| 136 ? IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_WARNING | 136 ? IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_WARNING |
| 137 : IDS_FILE_SYSTEM_PROVIDER_MANY_UNRESPONSIVE_WARNING), | 137 : IDS_FILE_SYSTEM_PROVIDER_MANY_UNRESPONSIVE_WARNING), |
| 138 extension_icon_.get() ? *extension_icon_.get() : gfx::Image(), | 138 extension_icon_.get() ? *extension_icon_.get() : gfx::Image(), |
| 139 base::string16(), // display_source | 139 base::string16(), // display_source |
| 140 message_center::NotifierId( | 140 message_center::NotifierId( |
| 141 message_center::NotifierId::SYSTEM_COMPONENT, | 141 message_center::NotifierId::SYSTEM_COMPONENT, |
| 142 file_system_info_.mount_path().value()), | 142 file_system_info_.mount_path().value()), |
| 143 rich_notification_data, | 143 rich_notification_data, |
| 144 new ProviderNotificationDelegate(this))); | 144 new ProviderNotificationDelegate(this))); |
| 145 | 145 |
| 146 notification->SetSystemPriority(); | 146 notification->SetSystemPriority(); |
| 147 return notification.Pass(); | 147 return notification.Pass(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void NotificationManager::OnNotificationResult(NotificationResult result) { | 150 void NotificationManager::OnNotificationResult(NotificationResult result) { |
| 151 CallbackMap::iterator it = callbacks_.begin(); | 151 CallbackMap::iterator it = callbacks_.begin(); |
| 152 while (it != callbacks_.end()) { | 152 while (it != callbacks_.end()) { |
| 153 CallbackMap::iterator current_it = it++; | 153 CallbackMap::iterator current_it = it++; |
| 154 NotificationCallback callback = current_it->second; | 154 NotificationCallback callback = current_it->second; |
| 155 callbacks_.erase(current_it); | 155 callbacks_.erase(current_it); |
| 156 callback.Run(result); | 156 callback.Run(result); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace file_system_provider | 160 } // namespace file_system_provider |
| 161 } // namespace chromeos | 161 } // namespace chromeos |
| OLD | NEW |