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.
5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H
10 #include "ash/system/tray/system_tray_item.h"
11 #include "base/values.h"
12 #include "chromeos/network/network_sms_handler.h"
16 class TraySms
: public SystemTrayItem
,
17 public chromeos::NetworkSmsHandler::Observer
{
19 explicit TraySms(SystemTray
* system_tray
);
22 // Overridden from SystemTrayItem.
23 views::View
* CreateDefaultView(user::LoginStatus status
) override
;
24 views::View
* CreateDetailedView(user::LoginStatus status
) override
;
25 views::View
* CreateNotificationView(user::LoginStatus status
) override
;
26 void DestroyDefaultView() override
;
27 void DestroyDetailedView() override
;
28 void DestroyNotificationView() override
;
30 // Overridden from chromeos::NetworkSmsHandler::Observer.
31 void MessageReceived(const base::DictionaryValue
& message
) override
;
35 class SmsDetailedView
;
37 class SmsNotificationView
;
39 // Gets the most recent message. Returns false if no messages or unable to
40 // retrieve the numebr and text from the message.
41 bool GetLatestMessage(size_t* index
, std::string
* number
, std::string
* text
);
43 // Removes message at |index| from message list.
44 void RemoveMessage(size_t index
);
46 // Called when sms messages have changed (through
47 // chromeos::NetworkSmsHandler::Observer).
48 void Update(bool notify
);
50 base::ListValue
& messages() { return messages_
; }
53 SmsDefaultView
* default_
;
54 SmsDetailedView
* detailed_
;
55 SmsNotificationView
* notification_
;
56 base::ListValue messages_
;
58 DISALLOW_COPY_AND_ASSIGN(TraySms
);
63 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H