Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: ui/arc/notification/arc_notification_item.cc

Issue 2862673002: Use constexpr TaskTraits constructor in ui. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/ozone/device/device_manager_manual.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (data->icon_data.size() == 0) { 232 if (data->icon_data.size() == 0) {
233 OnImageDecoded(SkBitmap()); // Pass an empty bitmap. 233 OnImageDecoded(SkBitmap()); // Pass an empty bitmap.
234 return; 234 return;
235 } 235 }
236 236
237 // TODO(yoshiki): Remove decoding by passing a bitmap directly from Android. 237 // TODO(yoshiki): Remove decoding by passing a bitmap directly from Android.
238 base::PostTaskWithTraitsAndReplyWithResult( 238 base::PostTaskWithTraitsAndReplyWithResult(
239 FROM_HERE, base::TaskTraits().WithShutdownBehavior( 239 FROM_HERE, {base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
240 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
241 base::Bind(&DecodeImage, data->icon_data), 240 base::Bind(&DecodeImage, data->icon_data),
242 base::Bind(&ArcNotificationItem::OnImageDecoded, 241 base::Bind(&ArcNotificationItem::OnImageDecoded,
243 weak_ptr_factory_.GetWeakPtr())); 242 weak_ptr_factory_.GetWeakPtr()));
244 } 243 }
245 244
246 ArcNotificationItem::~ArcNotificationItem() {} 245 ArcNotificationItem::~ArcNotificationItem() {}
247 246
248 void ArcNotificationItem::OnClosedFromAndroid() { 247 void ArcNotificationItem::OnClosedFromAndroid() {
249 being_removed_by_manager_ = true; // Closing is initiated by the manager. 248 being_removed_by_manager_ = true; // Closing is initiated by the manager.
250 message_center_->RemoveNotification(notification_id_, false /* by_user */); 249 message_center_->RemoveNotification(notification_id_, false /* by_user */);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 340
342 void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) { 341 void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) {
343 DCHECK(thread_checker_.CalledOnValidThread()); 342 DCHECK(thread_checker_.CalledOnValidThread());
344 343
345 gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap); 344 gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap);
346 notification_->set_icon(image); 345 notification_->set_icon(image);
347 AddToMessageCenter(); 346 AddToMessageCenter();
348 } 347 }
349 348
350 } // namespace arc 349 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/device/device_manager_manual.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698