| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_SYSTEM_NETWORK_TRAY_SMS_H | |
| 6 #define ASH_SYSTEM_NETWORK_TRAY_SMS_H | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "ash/system/network/sms_observer.h" | |
| 11 #include "ash/system/tray/system_tray_item.h" | |
| 12 #include "base/values.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 namespace internal { | |
| 16 | |
| 17 class TraySms : public SystemTrayItem, | |
| 18 public SmsObserver { | |
| 19 public: | |
| 20 TraySms(); | |
| 21 virtual ~TraySms(); | |
| 22 | |
| 23 // Overridden from SystemTrayItem. | |
| 24 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | |
| 25 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; | |
| 26 virtual views::View* CreateNotificationView( | |
| 27 user::LoginStatus status) OVERRIDE; | |
| 28 virtual void DestroyDefaultView() OVERRIDE; | |
| 29 virtual void DestroyDetailedView() OVERRIDE; | |
| 30 virtual void DestroyNotificationView() OVERRIDE; | |
| 31 | |
| 32 // Overridden from SmsObserver. | |
| 33 virtual void AddMessage(const base::DictionaryValue& message) OVERRIDE; | |
| 34 | |
| 35 protected: | |
| 36 class SmsDefaultView; | |
| 37 class SmsDetailedView; | |
| 38 class SmsMessageView; | |
| 39 class SmsNotificationView; | |
| 40 | |
| 41 // Gets the most recent message. Returns false if no messages or unable to | |
| 42 // retrieve the numebr and text from the message. | |
| 43 bool GetLatestMessage(size_t* index, std::string* number, std::string* text); | |
| 44 | |
| 45 // Removes message at |index| from message list. | |
| 46 void RemoveMessage(size_t index); | |
| 47 | |
| 48 // Called when sms messages have changed (by tray::SmsObserver). | |
| 49 void Update(bool notify); | |
| 50 | |
| 51 base::ListValue& messages() { return messages_; } | |
| 52 | |
| 53 private: | |
| 54 SmsDefaultView* default_; | |
| 55 SmsDetailedView* detailed_; | |
| 56 SmsNotificationView* notification_; | |
| 57 base::ListValue messages_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(TraySms); | |
| 60 }; | |
| 61 | |
| 62 } // namespace internal | |
| 63 } // namespace ash | |
| 64 | |
| 65 #endif // ASH_SYSTEM_NETWORK_TRAY_SMS_H | |
| OLD | NEW |