Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifications/sync_notifier/synced_notification.h" | 5 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" |
| 6 | 6 |
| 7 #include "sync/protocol/sync.pb.h" | 7 #include "sync/protocol/sync.pb.h" |
| 8 #include "sync/protocol/synced_notification_specifics.pb.h" | 8 #include "sync/protocol/synced_notification_specifics.pb.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED, | 26 sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED, |
| 27 local_enum_must_match_protobuf_enum); | 27 local_enum_must_match_protobuf_enum); |
| 28 | 28 |
| 29 SyncedNotification::SyncedNotification(const syncer::SyncData& sync_data) { | 29 SyncedNotification::SyncedNotification(const syncer::SyncData& sync_data) { |
| 30 Update(sync_data); | 30 Update(sync_data); |
| 31 } | 31 } |
| 32 | 32 |
| 33 SyncedNotification::~SyncedNotification() {} | 33 SyncedNotification::~SyncedNotification() {} |
| 34 | 34 |
| 35 void SyncedNotification::Update(const syncer::SyncData& sync_data) { | 35 void SyncedNotification::Update(const syncer::SyncData& sync_data) { |
| 36 // TODO(petewil): Let's add checking that the notification looks valid. | |
| 36 specifics_.CopyFrom(sync_data.GetSpecifics().synced_notification()); | 37 specifics_.CopyFrom(sync_data.GetSpecifics().synced_notification()); |
| 37 } | 38 } |
| 38 | 39 |
| 39 sync_pb::EntitySpecifics SyncedNotification::GetEntitySpecifics() const { | 40 sync_pb::EntitySpecifics SyncedNotification::GetEntitySpecifics() const { |
| 40 sync_pb::EntitySpecifics entity_specifics; | 41 sync_pb::EntitySpecifics entity_specifics; |
| 41 entity_specifics.mutable_synced_notification()->CopyFrom(specifics_); | 42 entity_specifics.mutable_synced_notification()->CopyFrom(specifics_); |
| 42 return entity_specifics; | 43 return entity_specifics; |
| 43 } | 44 } |
| 44 | 45 |
| 45 std::string SyncedNotification::title() const { | 46 std::string SyncedNotification::title() const { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 67 } | 68 } |
| 68 | 69 |
| 69 GURL SyncedNotification::app_icon_url() const { | 70 GURL SyncedNotification::app_icon_url() const { |
| 70 return ExtractAppIconUrl(); | 71 return ExtractAppIconUrl(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 GURL SyncedNotification::image_url() const { | 74 GURL SyncedNotification::image_url() const { |
| 74 return ExtractImageUrl(); | 75 return ExtractImageUrl(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 std::string SyncedNotification::first_external_id() const { | |
| 78 return ExtractFirstExternalId(); | |
| 79 } | |
| 80 | |
| 81 std::string SyncedNotification::notification_id() const { | |
| 82 return ExtractNotificationId(); | |
| 83 } | |
| 84 | |
| 85 std::string SyncedNotification::text() const { | 78 std::string SyncedNotification::text() const { |
| 86 return ExtractText(); | 79 return ExtractText(); |
| 87 } | 80 } |
| 88 | 81 |
| 89 SyncedNotification::ReadState SyncedNotification::read_state() const { | 82 SyncedNotification::ReadState SyncedNotification::read_state() const { |
| 90 return ExtractReadState(); | 83 return ExtractReadState(); |
| 91 } | 84 } |
| 92 | 85 |
| 86 uint64 SyncedNotification::creation_time() const { | |
| 87 return ExtractCreationTime(); | |
| 88 } | |
| 89 | |
| 90 std::string SyncedNotification::default_destination_title() const { | |
| 91 return ExtractDefaultDestinationTitle(); | |
| 92 } | |
| 93 | |
| 94 std::string SyncedNotification::default_destination_icon_url() const { | |
| 95 return ExtractDefaultDestinationIconUrl(); | |
| 96 } | |
| 97 | |
| 98 std::string SyncedNotification::default_destination_url() const { | |
| 99 return ExtractDefaultDestinationUrl(); | |
| 100 } | |
| 101 | |
| 102 std::string SyncedNotification::button_one_title() const { | |
| 103 return ExtractButtonOneTitle(); | |
| 104 } | |
| 105 | |
| 106 std::string SyncedNotification::button_one_icon_url() const { | |
| 107 return ExtractButtonOneIconUrl(); | |
| 108 } | |
| 109 | |
| 110 std::string SyncedNotification::button_one_url() const { | |
| 111 return ExtractButtonOneUrl(); | |
| 112 } | |
| 113 | |
| 114 std::string SyncedNotification::button_two_title() const { | |
| 115 return ExtractButtonTwoTitle(); | |
| 116 } | |
| 117 | |
| 118 std::string SyncedNotification::button_two_icon_url() const { | |
| 119 return ExtractButtonTwoIconUrl(); | |
| 120 } | |
| 121 | |
| 122 std::string SyncedNotification::button_two_url() const { | |
| 123 return ExtractButtonTwoUrl(); | |
| 124 } | |
| 125 | |
| 126 int SyncedNotification::priority() const { | |
| 127 return ExtractPriority(); | |
| 128 } | |
| 129 | |
| 130 int SyncedNotification::button_count() const { | |
| 131 return ExtractButtonCount(); | |
| 132 } | |
| 133 | |
| 134 int SyncedNotification::notification_count() const { | |
| 135 return ExtractNotificationCount(); | |
| 136 } | |
| 137 | |
| 138 std::string SyncedNotification::contained_notification_title(int index) const { | |
| 139 return ExtractContainedNotificationTitle(index); | |
| 140 } | |
| 141 | |
| 142 std::string SyncedNotification::contained_notification_message( | |
| 143 int index) const { | |
| 144 return ExtractContainedNotificationMessage(index); | |
| 145 } | |
| 146 | |
| 93 // TODO(petewil): Consider the timestamp too once it gets added to the protobuf. | 147 // TODO(petewil): Consider the timestamp too once it gets added to the protobuf. |
| 148 // TODO: add more fields in here | |
| 94 bool SyncedNotification::EqualsIgnoringReadState( | 149 bool SyncedNotification::EqualsIgnoringReadState( |
| 95 const SyncedNotification& other) const { | 150 const SyncedNotification& other) const { |
| 96 return (title() == other.title() && | 151 return (title() == other.title() && |
| 97 app_id() == other.app_id() && | 152 app_id() == other.app_id() && |
| 98 key() == other.key() && | 153 key() == other.key() && |
| 99 text() == other.text() && | 154 text() == other.text() && |
| 100 origin_url() == other.origin_url() && | 155 origin_url() == other.origin_url() && |
| 101 app_icon_url() == other.app_icon_url() && | 156 app_icon_url() == other.app_icon_url() && |
| 102 image_url() == other.image_url() ); | 157 image_url() == other.image_url() ); |
| 103 } | 158 } |
| 104 | 159 |
| 105 bool SyncedNotification::IdMatches(const SyncedNotification& other) const { | |
| 106 // Two notifications have the same ID if the <appId/coalescingKey> pair | |
| 107 // matches. | |
| 108 return (notification_id() == other.notification_id()); | |
| 109 } | |
| 110 | |
| 111 // Set the read state on the notification, returns true for success. | 160 // Set the read state on the notification, returns true for success. |
| 112 void SyncedNotification::SetReadState(const ReadState& read_state) { | 161 void SyncedNotification::SetReadState(const ReadState& read_state) { |
| 113 | 162 |
| 114 // convert the read state to the protobuf type for read state | 163 // convert the read state to the protobuf type for read state |
| 115 if (kDismissed == read_state) | 164 if (kDismissed == read_state) |
| 116 specifics_.mutable_coalesced_notification()->set_read_state( | 165 specifics_.mutable_coalesced_notification()->set_read_state( |
| 117 sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED); | 166 sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED); |
| 118 else if (kUnread == read_state) | 167 else if (kUnread == read_state) |
| 119 specifics_.mutable_coalesced_notification()->set_read_state( | 168 specifics_.mutable_coalesced_notification()->set_read_state( |
| 120 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); | 169 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); |
| 121 else if (kRead == read_state) | 170 else if (kRead == read_state) |
| 122 specifics_.mutable_coalesced_notification()->set_read_state( | 171 specifics_.mutable_coalesced_notification()->set_read_state( |
| 123 sync_pb::CoalescedSyncedNotification_ReadState_READ); | 172 sync_pb::CoalescedSyncedNotification_ReadState_READ); |
| 124 else | 173 else |
| 125 NOTREACHED(); | 174 NOTREACHED(); |
| 126 } | 175 } |
| 127 | 176 |
| 128 void SyncedNotification::NotificationHasBeenRead() { | |
| 129 SetReadState(kRead); | |
| 130 } | |
| 131 | |
| 132 void SyncedNotification::NotificationHasBeenDismissed() { | 177 void SyncedNotification::NotificationHasBeenDismissed() { |
| 133 SetReadState(kDismissed); | 178 SetReadState(kDismissed); |
| 134 } | 179 } |
| 135 | 180 |
| 136 std::string SyncedNotification::ExtractFirstExternalId() const { | |
| 137 if (!specifics_.has_coalesced_notification() || | |
| 138 specifics_.coalesced_notification().notification_size() < 1 || | |
| 139 !specifics_.coalesced_notification().notification(0).has_external_id()) | |
| 140 return std::string(); | |
| 141 | |
| 142 return specifics_.coalesced_notification().notification(0).external_id(); | |
| 143 } | |
| 144 | |
| 145 std::string SyncedNotification::ExtractTitle() const { | 181 std::string SyncedNotification::ExtractTitle() const { |
| 146 if (!specifics_.coalesced_notification().render_info().expanded_info(). | 182 if (!specifics_.coalesced_notification().render_info().expanded_info(). |
| 147 simple_expanded_layout().has_title()) | 183 simple_expanded_layout().has_title()) |
| 148 return ""; | 184 return std::string(); |
| 149 | 185 |
| 150 return specifics_.coalesced_notification().render_info().expanded_info(). | 186 return specifics_.coalesced_notification().render_info().expanded_info(). |
| 151 simple_expanded_layout().title(); | 187 simple_expanded_layout().title(); |
| 152 } | 188 } |
| 153 | 189 |
| 154 std::string SyncedNotification::ExtractHeading() const { | 190 std::string SyncedNotification::ExtractHeading() const { |
| 155 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | 191 if (!specifics_.coalesced_notification().render_info().collapsed_info(). |
| 156 simple_collapsed_layout().has_heading()) | 192 simple_collapsed_layout().has_heading()) |
| 157 return ""; | 193 return std::string(); |
| 158 | 194 |
| 159 return specifics_.coalesced_notification().render_info().collapsed_info(). | 195 return specifics_.coalesced_notification().render_info().collapsed_info(). |
| 160 simple_collapsed_layout().heading(); | 196 simple_collapsed_layout().heading(); |
| 161 } | 197 } |
| 162 | 198 |
| 163 std::string SyncedNotification::ExtractDescription() const { | 199 std::string SyncedNotification::ExtractDescription() const { |
| 164 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | 200 if (!specifics_.coalesced_notification().render_info().collapsed_info(). |
| 165 simple_collapsed_layout().has_description()) | 201 simple_collapsed_layout().has_description()) |
| 166 return ""; | 202 return std::string(); |
| 167 | 203 |
| 168 return specifics_.coalesced_notification().render_info().collapsed_info(). | 204 return specifics_.coalesced_notification().render_info().collapsed_info(). |
| 169 simple_collapsed_layout().description(); | 205 simple_collapsed_layout().description(); |
| 170 } | 206 } |
| 171 | 207 |
| 172 std::string SyncedNotification::ExtractAppId() const { | 208 std::string SyncedNotification::ExtractAppId() const { |
| 173 if (!specifics_.coalesced_notification().has_app_id()) | 209 if (!specifics_.coalesced_notification().has_app_id()) |
| 174 return ""; | 210 return std::string(); |
| 175 return specifics_.coalesced_notification().app_id(); | 211 return specifics_.coalesced_notification().app_id(); |
| 176 } | 212 } |
| 177 | 213 |
| 178 std::string SyncedNotification::ExtractKey() const { | 214 std::string SyncedNotification::ExtractKey() const { |
| 179 if (!specifics_.coalesced_notification().has_key()) | 215 if (!specifics_.coalesced_notification().has_key()) |
| 180 return ""; | 216 return std::string(); |
| 181 return specifics_.coalesced_notification().key(); | 217 return specifics_.coalesced_notification().key(); |
| 182 } | 218 } |
| 183 | 219 |
| 184 GURL SyncedNotification::ExtractOriginUrl() const { | 220 GURL SyncedNotification::ExtractOriginUrl() const { |
| 185 std::string origin_url(kExtensionScheme); | 221 std::string origin_url(kExtensionScheme); |
| 186 origin_url += app_id(); | 222 origin_url += app_id(); |
| 187 return GURL(origin_url); | 223 return GURL(origin_url); |
| 188 } | 224 } |
| 189 | 225 |
| 226 // TODO(petewil): This only returns the first icon. We should make all the | |
| 227 // icons available. | |
| 190 GURL SyncedNotification::ExtractAppIconUrl() const { | 228 GURL SyncedNotification::ExtractAppIconUrl() const { |
| 191 if (specifics_.coalesced_notification().render_info().expanded_info(). | 229 if (specifics_.coalesced_notification().render_info().expanded_info(). |
| 192 collapsed_info_size() == 0) | 230 collapsed_info_size() == 0) |
| 193 return GURL(); | 231 return GURL(); |
| 194 | 232 |
| 195 if (!specifics_.coalesced_notification().render_info().expanded_info(). | 233 if (!specifics_.coalesced_notification().render_info().expanded_info(). |
| 196 collapsed_info(0).simple_collapsed_layout().has_app_icon()) | 234 collapsed_info(0).simple_collapsed_layout().has_app_icon()) |
| 197 return GURL(); | 235 return GURL(); |
| 198 | 236 |
| 199 return GURL(specifics_.coalesced_notification().render_info(). | 237 return GURL(specifics_.coalesced_notification().render_info(). |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 212 simple_expanded_layout().media(0).image().has_url()) | 250 simple_expanded_layout().media(0).image().has_url()) |
| 213 return GURL(); | 251 return GURL(); |
| 214 | 252 |
| 215 return GURL(specifics_.coalesced_notification().render_info(). | 253 return GURL(specifics_.coalesced_notification().render_info(). |
| 216 expanded_info().simple_expanded_layout().media(0).image().url()); | 254 expanded_info().simple_expanded_layout().media(0).image().url()); |
| 217 } | 255 } |
| 218 | 256 |
| 219 std::string SyncedNotification::ExtractText() const { | 257 std::string SyncedNotification::ExtractText() const { |
| 220 if (!specifics_.coalesced_notification().render_info().expanded_info(). | 258 if (!specifics_.coalesced_notification().render_info().expanded_info(). |
| 221 simple_expanded_layout().has_text()) | 259 simple_expanded_layout().has_text()) |
| 222 return ""; | 260 return std::string(); |
| 223 | 261 |
| 224 return specifics_.coalesced_notification().render_info().expanded_info(). | 262 return specifics_.coalesced_notification().render_info().expanded_info(). |
| 225 simple_expanded_layout().text(); | 263 simple_expanded_layout().text(); |
| 226 } | 264 } |
| 227 | 265 |
| 228 SyncedNotification::ReadState SyncedNotification::ExtractReadState() const { | 266 SyncedNotification::ReadState SyncedNotification::ExtractReadState() const { |
| 229 DCHECK(specifics_.coalesced_notification().has_read_state()); | 267 DCHECK(specifics_.coalesced_notification().has_read_state()); |
| 230 | 268 |
| 231 sync_pb::CoalescedSyncedNotification_ReadState found_read_state = | 269 sync_pb::CoalescedSyncedNotification_ReadState found_read_state = |
| 232 specifics_.coalesced_notification().read_state(); | 270 specifics_.coalesced_notification().read_state(); |
| 233 | 271 |
| 234 if (found_read_state == | 272 if (found_read_state == |
| 235 sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED) { | 273 sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED) { |
| 236 return kDismissed; | 274 return kDismissed; |
| 237 } else if (found_read_state == | 275 } else if (found_read_state == |
| 238 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD) { | 276 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD) { |
| 239 return kUnread; | 277 return kUnread; |
| 240 } else if (found_read_state == | 278 } else if (found_read_state == |
| 241 sync_pb::CoalescedSyncedNotification_ReadState_READ) { | 279 sync_pb::CoalescedSyncedNotification_ReadState_READ) { |
| 242 return kRead; | 280 return kRead; |
| 243 } else { | 281 } else { |
| 244 NOTREACHED(); | 282 NOTREACHED(); |
| 245 return static_cast<SyncedNotification::ReadState>(found_read_state); | 283 return static_cast<SyncedNotification::ReadState>(found_read_state); |
| 246 } | 284 } |
| 247 } | 285 } |
| 248 | 286 |
| 249 std::string SyncedNotification::ExtractNotificationId() const { | 287 // Time in milliseconds since the unix epoch, or 0 if not available. |
| 250 return key(); | 288 uint64 SyncedNotification::ExtractCreationTime() const { |
| 289 uint64 creation_time_milliseconds; | |
| 290 | |
| 291 if (!specifics_.coalesced_notification().has_creation_time_msec()) | |
| 292 return 0.0; | |
|
dcheng
2013/03/26 17:49:29
return 0 is sufficient here.
Pete Williamson
2013/03/27 17:07:53
Done.
| |
| 293 | |
| 294 creation_time_milliseconds = specifics_.coalesced_notification(). | |
|
dcheng
2013/03/26 17:49:29
return directly.
Pete Williamson
2013/03/27 17:07:53
Done.
| |
| 295 creation_time_msec(); | |
| 296 | |
| 297 return creation_time_milliseconds; | |
| 298 } | |
| 299 | |
| 300 int SyncedNotification::ExtractPriority() const { | |
| 301 if (!specifics_.coalesced_notification().has_priority()) | |
| 302 return 0; | |
| 303 return static_cast<int>(specifics_.coalesced_notification(). | |
| 304 priority()); | |
| 305 } | |
| 306 | |
| 307 int SyncedNotification::ExtractNotificationCount() const { | |
| 308 return specifics_.coalesced_notification().render_info(). | |
| 309 expanded_info().collapsed_info_size(); | |
| 310 } | |
| 311 | |
| 312 int SyncedNotification::ExtractButtonCount() const { | |
| 313 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 314 target_size(); | |
| 315 } | |
| 316 | |
| 317 std::string SyncedNotification::ExtractDefaultDestinationTitle() const { | |
| 318 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 319 default_destination().icon().has_alt_text()) { | |
| 320 return std::string(); | |
| 321 } | |
| 322 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 323 default_destination().icon().alt_text(); | |
| 324 } | |
| 325 | |
| 326 std::string SyncedNotification::ExtractDefaultDestinationIconUrl() const { | |
| 327 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 328 default_destination().icon().has_url()) { | |
| 329 return std::string(); | |
| 330 } | |
| 331 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 332 default_destination().icon().url(); | |
| 333 } | |
| 334 | |
| 335 std::string SyncedNotification::ExtractDefaultDestinationUrl() const { | |
| 336 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 337 default_destination().has_url()) { | |
| 338 return std::string(); | |
| 339 } | |
| 340 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 341 default_destination().url(); | |
| 342 } | |
| 343 | |
| 344 std::string SyncedNotification::ExtractButtonOneTitle() const { | |
| 345 // Must ensure that we have a target before trying to access it. | |
| 346 if (ExtractButtonCount() < 1) | |
| 347 return std::string(); | |
| 348 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 349 target(0).action().icon().has_alt_text()) { | |
| 350 return std::string(); | |
| 351 } | |
| 352 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 353 target(0).action().icon().alt_text(); | |
| 354 } | |
| 355 | |
| 356 std::string SyncedNotification::ExtractButtonOneIconUrl() const { | |
| 357 // Must ensure that we have a target before trying to access it. | |
| 358 if (ExtractButtonCount() < 1) | |
| 359 return std::string(); | |
| 360 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 361 target(0).action().icon().has_url()) { | |
| 362 return std::string(); | |
| 363 } | |
| 364 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 365 target(0).action().icon().url(); | |
| 366 } | |
| 367 | |
| 368 std::string SyncedNotification::ExtractButtonOneUrl() const { | |
| 369 // Must ensure that we have a target before trying to access it. | |
| 370 if (ExtractButtonCount() < 1) | |
| 371 return std::string(); | |
| 372 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 373 target(0).action().has_url()) { | |
| 374 return std::string(); | |
| 375 } | |
| 376 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 377 target(0).action().url(); | |
| 378 } | |
| 379 | |
| 380 std::string SyncedNotification::ExtractButtonTwoTitle() const { | |
| 381 // Must ensure that we have a target before trying to access it. | |
| 382 if (ExtractButtonCount() < 2) | |
| 383 return std::string(); | |
| 384 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 385 target(1).action().icon().has_alt_text()) { | |
| 386 return std::string(); | |
| 387 } | |
| 388 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 389 target(1).action().icon().alt_text(); | |
| 390 } | |
| 391 | |
| 392 std::string SyncedNotification::ExtractButtonTwoIconUrl() const { | |
| 393 // Must ensure that we have a target before trying to access it. | |
| 394 if (ExtractButtonCount() < 2) | |
| 395 return std::string(); | |
| 396 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 397 target(1).action().icon().has_url()) { | |
| 398 return std::string(); | |
| 399 } | |
| 400 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 401 target(1).action().icon().url(); | |
| 402 } | |
| 403 | |
| 404 std::string SyncedNotification::ExtractButtonTwoUrl() const { | |
| 405 // Must ensure that we have a target before trying to access it. | |
| 406 if (ExtractButtonCount() < 2) | |
| 407 return std::string(); | |
| 408 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 409 target(1).action().has_url()) { | |
| 410 return std::string(); | |
| 411 } | |
| 412 return specifics_.coalesced_notification().render_info().collapsed_info(). | |
| 413 target(1).action().url(); | |
| 414 } | |
| 415 | |
| 416 std::string SyncedNotification::ExtractContainedNotificationTitle( | |
| 417 int index) const { | |
| 418 if (specifics_.coalesced_notification().render_info().expanded_info(). | |
| 419 collapsed_info_size() < index + 1) | |
| 420 return std::string(); | |
| 421 | |
| 422 return specifics_.coalesced_notification().render_info().expanded_info(). | |
| 423 collapsed_info(index).simple_collapsed_layout().heading(); | |
| 424 } | |
| 425 | |
| 426 std::string SyncedNotification::ExtractContainedNotificationMessage( | |
| 427 int index) const { | |
| 428 if (specifics_.coalesced_notification().render_info().expanded_info(). | |
| 429 collapsed_info_size() < index + 1) | |
| 430 return std::string(); | |
| 431 | |
| 432 return specifics_.coalesced_notification().render_info().expanded_info(). | |
| 433 collapsed_info(index).simple_collapsed_layout().description(); | |
| 251 } | 434 } |
| 252 | 435 |
| 253 } // namespace notifier | 436 } // namespace notifier |
| OLD | NEW |