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

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

Issue 1640333003: Change ARC notification type from SIMPLE to BASE_FORMAT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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 | no next file » | 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 <vector> 8 #include <vector>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // If old |newer_data_| has been stored, discard the old one. 98 // If old |newer_data_| has been stored, discard the old one.
99 newer_data_ = data.Clone(); 99 newer_data_ = data.Clone();
100 return; 100 return;
101 } 101 }
102 102
103 message_center::RichNotificationData rich_data; 103 message_center::RichNotificationData rich_data;
104 message_center::NotificationType type; 104 message_center::NotificationType type;
105 105
106 switch (data.type) { 106 switch (data.type) {
107 case ArcNotificationType::BASIC: 107 case ArcNotificationType::BASIC:
108 type = message_center::NOTIFICATION_TYPE_SIMPLE; 108 type = message_center::NOTIFICATION_TYPE_BASE_FORMAT;
109 break; 109 break;
110 case ArcNotificationType::IMAGE: 110 case ArcNotificationType::IMAGE:
111 // TODO(yoshiki): Implement this types. 111 // TODO(yoshiki): Implement this types.
112 type = message_center::NOTIFICATION_TYPE_SIMPLE; 112 type = message_center::NOTIFICATION_TYPE_BASE_FORMAT;
113 LOG(ERROR) << "Unsupported notification type: image"; 113 LOG(ERROR) << "Unsupported notification type: image";
114 break; 114 break;
115 case ArcNotificationType::PROGRESS: 115 case ArcNotificationType::PROGRESS:
116 type = message_center::NOTIFICATION_TYPE_PROGRESS; 116 type = message_center::NOTIFICATION_TYPE_PROGRESS;
117 rich_data.timestamp = base::Time::UnixEpoch() + 117 rich_data.timestamp = base::Time::UnixEpoch() +
118 base::TimeDelta::FromMilliseconds(data.time); 118 base::TimeDelta::FromMilliseconds(data.time);
119 rich_data.progress = std::max( 119 rich_data.progress = std::max(
120 0, std::min(100, static_cast<int>(std::round( 120 0, std::min(100, static_cast<int>(std::round(
121 static_cast<float>(data.progress_current) / 121 static_cast<float>(data.progress_current) /
122 data.progress_max * 100)))); 122 data.progress_max * 100))));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 message_center_->AddNotification(std::move(notification_)); 189 message_center_->AddNotification(std::move(notification_));
190 190
191 if (newer_data_) { 191 if (newer_data_) {
192 // There is the newer data, so updates again. 192 // There is the newer data, so updates again.
193 ArcNotificationDataPtr data(std::move(newer_data_)); 193 ArcNotificationDataPtr data(std::move(newer_data_));
194 UpdateWithArcNotificationData(*data); 194 UpdateWithArcNotificationData(*data);
195 } 195 }
196 } 196 }
197 197
198 } // namespace arc 198 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698