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

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

Issue 2394483004: arc: OnClosedFromAndroid removes notifications as not by_user (Closed)
Patch Set: remove by_user from OnClosedFromAndroid Created 4 years, 2 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
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 <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // TODO(yoshiki): Remove decoding by passing a bitmap directly from Android. 241 // TODO(yoshiki): Remove decoding by passing a bitmap directly from Android.
242 base::PostTaskAndReplyWithResult( 242 base::PostTaskAndReplyWithResult(
243 base::WorkerPool::GetTaskRunner(true).get(), FROM_HERE, 243 base::WorkerPool::GetTaskRunner(true).get(), FROM_HERE,
244 base::Bind(&DecodeImage, data->icon_data.storage()), 244 base::Bind(&DecodeImage, data->icon_data.storage()),
245 base::Bind(&ArcNotificationItem::OnImageDecoded, 245 base::Bind(&ArcNotificationItem::OnImageDecoded,
246 weak_ptr_factory_.GetWeakPtr())); 246 weak_ptr_factory_.GetWeakPtr()));
247 } 247 }
248 248
249 ArcNotificationItem::~ArcNotificationItem() {} 249 ArcNotificationItem::~ArcNotificationItem() {}
250 250
251 void ArcNotificationItem::OnClosedFromAndroid(bool by_user) { 251 void ArcNotificationItem::OnClosedFromAndroid() {
252 being_removed_by_manager_ = true; // Closing is initiated by the manager. 252 being_removed_by_manager_ = true; // Closing is initiated by the manager.
253 message_center_->RemoveNotification(notification_id_, by_user); 253 message_center_->RemoveNotification(notification_id_, false /* by_user */);
254 } 254 }
255 255
256 void ArcNotificationItem::Close(bool by_user) { 256 void ArcNotificationItem::Close(bool by_user) {
257 if (being_removed_by_manager_) { 257 if (being_removed_by_manager_) {
258 // Closing is caused by the manager, so we don't need to nofify a close 258 // Closing is caused by the manager, so we don't need to nofify a close
259 // event to the manager. 259 // event to the manager.
260 return; 260 return;
261 } 261 }
262 262
263 // Do not touch its any members afterwards, because this instance will be 263 // Do not touch its any members afterwards, because this instance will be
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) { 329 void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) {
330 DCHECK(thread_checker_.CalledOnValidThread()); 330 DCHECK(thread_checker_.CalledOnValidThread());
331 331
332 gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap); 332 gfx::Image image = gfx::Image::CreateFrom1xBitmap(bitmap);
333 notification_->set_icon(image); 333 notification_->set_icon(image);
334 AddToMessageCenter(); 334 AddToMessageCenter();
335 } 335 }
336 336
337 } // namespace arc 337 } // namespace arc
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_item.h ('k') | ui/arc/notification/arc_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698