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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 return specifics_.coalesced_notification().creation_time_msec(); | 498 return specifics_.coalesced_notification().creation_time_msec(); |
499 } | 499 } |
500 | 500 |
501 int SyncedNotification::GetPriority() const { | 501 int SyncedNotification::GetPriority() const { |
502 if (!specifics_.coalesced_notification().has_priority()) | 502 if (!specifics_.coalesced_notification().has_priority()) |
503 return kUndefinedPriority; | 503 return kUndefinedPriority; |
504 int protobuf_priority = specifics_.coalesced_notification().priority(); | 504 int protobuf_priority = specifics_.coalesced_notification().priority(); |
505 | 505 |
506 // Convert the prioroty to the scheme used by the notification center. | 506 // Convert the prioroty to the scheme used by the notification center. |
507 if (protobuf_priority == | 507 if (protobuf_priority == |
508 sync_pb::CoalescedSyncedNotification_Priority_LOW) { | 508 sync_pb::CoalescedSyncedNotification_Priority_INVISIBLE) { |
509 return message_center::LOW_PRIORITY; | 509 return message_center::LOW_PRIORITY; |
510 } else if (protobuf_priority == | 510 } else if (protobuf_priority == |
511 sync_pb::CoalescedSyncedNotification_Priority_STANDARD) { | 511 sync_pb::CoalescedSyncedNotification_Priority_LOW) { |
512 return message_center::DEFAULT_PRIORITY; | 512 return message_center::DEFAULT_PRIORITY; |
513 } else if (protobuf_priority == | 513 } else if (protobuf_priority == |
514 sync_pb::CoalescedSyncedNotification_Priority_HIGH) { | 514 sync_pb::CoalescedSyncedNotification_Priority_HIGH) { |
515 return message_center::HIGH_PRIORITY; | 515 return message_center::HIGH_PRIORITY; |
516 } else { | 516 } else { |
517 // Complain if this is a new priority we have not seen before. | 517 // Complain if this is a new priority we have not seen before. |
518 DCHECK(protobuf_priority < | 518 DCHECK(protobuf_priority < |
519 sync_pb::CoalescedSyncedNotification_Priority_LOW || | 519 sync_pb::CoalescedSyncedNotification_Priority_INVISIBLE || |
520 sync_pb::CoalescedSyncedNotification_Priority_HIGH < | 520 sync_pb::CoalescedSyncedNotification_Priority_HIGH < |
521 protobuf_priority); | 521 protobuf_priority); |
522 return kUndefinedPriority; | 522 return kUndefinedPriority; |
523 } | 523 } |
524 } | 524 } |
525 | 525 |
526 std::string SyncedNotification::GetDefaultDestinationTitle() const { | 526 std::string SyncedNotification::GetDefaultDestinationTitle() const { |
527 if (!specifics_.coalesced_notification().render_info().collapsed_info(). | 527 if (!specifics_.coalesced_notification().render_info().collapsed_info(). |
528 default_destination().icon().has_alt_text()) { | 528 default_destination().icon().has_alt_text()) { |
529 return std::string(); | 529 return std::string(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 specifics_.mutable_coalesced_notification()->set_read_state( | 757 specifics_.mutable_coalesced_notification()->set_read_state( |
758 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); | 758 sync_pb::CoalescedSyncedNotification_ReadState_UNREAD); |
759 else if (kRead == read_state) | 759 else if (kRead == read_state) |
760 specifics_.mutable_coalesced_notification()->set_read_state( | 760 specifics_.mutable_coalesced_notification()->set_read_state( |
761 sync_pb::CoalescedSyncedNotification_ReadState_READ); | 761 sync_pb::CoalescedSyncedNotification_ReadState_READ); |
762 else | 762 else |
763 NOTREACHED(); | 763 NOTREACHED(); |
764 } | 764 } |
765 | 765 |
766 } // namespace notifier | 766 } // namespace notifier |
OLD | NEW |