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