| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/arc/notification/arc_notification_item.h" | 5 #include "ui/arc/notification/arc_notification_item.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 rich_data.small_image = ConvertAndroidSmallIcon(data.small_icon); | 213 rich_data.small_image = ConvertAndroidSmallIcon(data.small_icon); |
| 214 | 214 |
| 215 // The identifier of the notifier, which is used to distinguish the notifiers | 215 // The identifier of the notifier, which is used to distinguish the notifiers |
| 216 // in the message center. | 216 // in the message center. |
| 217 message_center::NotifierId notifier_id( | 217 message_center::NotifierId notifier_id( |
| 218 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); | 218 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); |
| 219 notifier_id.profile_id = profile_id_.GetUserEmail(); | 219 notifier_id.profile_id = profile_id_.GetUserEmail(); |
| 220 | 220 |
| 221 DCHECK(!data.title.is_null()); | 221 DCHECK(!data.title.is_null()); |
| 222 DCHECK(!data.message.is_null()); | 222 DCHECK(!data.message.is_null()); |
| 223 SetNotification(base::WrapUnique(new message_center::Notification( | 223 SetNotification(base::MakeUnique<message_center::Notification>( |
| 224 type, notification_id_, base::UTF8ToUTF16(data.title.get()), | 224 type, notification_id_, base::UTF8ToUTF16(data.title.get()), |
| 225 base::UTF8ToUTF16(data.message.get()), | 225 base::UTF8ToUTF16(data.message.get()), |
| 226 gfx::Image(), // icon image: Will be overriden later. | 226 gfx::Image(), // icon image: Will be overriden later. |
| 227 base::UTF8ToUTF16("arc"), // display source | 227 base::UTF8ToUTF16("arc"), // display source |
| 228 GURL(), // empty origin url, for system component | 228 GURL(), // empty origin url, for system component |
| 229 notifier_id, rich_data, | 229 notifier_id, rich_data, |
| 230 new ArcNotificationDelegate(weak_ptr_factory_.GetWeakPtr())))); | 230 new ArcNotificationDelegate(weak_ptr_factory_.GetWeakPtr()))); |
| 231 | 231 |
| 232 DCHECK(!data.icon_data.is_null()); | 232 DCHECK(!data.icon_data.is_null()); |
| 233 if (data.icon_data.size() == 0) { | 233 if (data.icon_data.size() == 0) { |
| 234 OnImageDecoded(SkBitmap()); // Pass an empty bitmap. | 234 OnImageDecoded(SkBitmap()); // Pass an empty bitmap. |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 | 237 |
| 238 // TODO(yoshiki): Remove decoding by passing a bitmap directly from Android. | 238 // TODO(yoshiki): Remove decoding by passing a bitmap directly from Android. |
| 239 base::PostTaskAndReplyWithResult( | 239 base::PostTaskAndReplyWithResult( |
| 240 base::WorkerPool::GetTaskRunner(true).get(), FROM_HERE, | 240 base::WorkerPool::GetTaskRunner(true).get(), FROM_HERE, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) { | 338 void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) { |
| 339 DCHECK(thread_checker_.CalledOnValidThread()); | 339 DCHECK(thread_checker_.CalledOnValidThread()); |
| 340 | 340 |
| 341 gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap); | 341 gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap); |
| 342 notification_->set_icon(image); | 342 notification_->set_icon(image); |
| 343 AddToMessageCenter(); | 343 AddToMessageCenter(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace arc | 346 } // namespace arc |
| OLD | NEW |