| 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_COMMON_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H_ | |
| 6 #define ASH_COMMON_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. Returns true if |index| was | |
| 47 // valid and a message was removed. | |
| 48 bool RemoveMessage(size_t index); | |
| 49 | |
| 50 // Called when sms messages have changed (through | |
| 51 // chromeos::NetworkSmsHandler::Observer). | |
| 52 void Update(bool notify); | |
| 53 | |
| 54 base::ListValue& messages() { return messages_; } | |
| 55 | |
| 56 private: | |
| 57 SmsDefaultView* default_; | |
| 58 SmsDetailedView* detailed_; | |
| 59 SmsNotificationView* notification_; | |
| 60 base::ListValue messages_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(TraySms); | |
| 63 }; | |
| 64 | |
| 65 } // namespace ash | |
| 66 | |
| 67 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H_ | |
| OLD | NEW |