Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / system / chromeos / network / tray_sms.h
blob9796acf70ca0941f8cce828f36f2111d262fe6aa
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
8 #include <string>
10 #include "ash/system/tray/system_tray_item.h"
11 #include "base/values.h"
12 #include "chromeos/network/network_sms_handler.h"
14 namespace ash {
16 class TraySms : public SystemTrayItem,
17 public chromeos::NetworkSmsHandler::Observer {
18 public:
19 explicit TraySms(SystemTray* system_tray);
20 virtual ~TraySms();
22 // Overridden from SystemTrayItem.
23 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
24 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
25 virtual views::View* CreateNotificationView(
26 user::LoginStatus status) OVERRIDE;
27 virtual void DestroyDefaultView() OVERRIDE;
28 virtual void DestroyDetailedView() OVERRIDE;
29 virtual void DestroyNotificationView() OVERRIDE;
31 // Overridden from chromeos::NetworkSmsHandler::Observer.
32 virtual void MessageReceived(const base::DictionaryValue& message) OVERRIDE;
34 protected:
35 class SmsDefaultView;
36 class SmsDetailedView;
37 class SmsMessageView;
38 class SmsNotificationView;
40 // Gets the most recent message. Returns false if no messages or unable to
41 // retrieve the numebr and text from the message.
42 bool GetLatestMessage(size_t* index, std::string* number, std::string* text);
44 // Removes message at |index| from message list.
45 void RemoveMessage(size_t index);
47 // Called when sms messages have changed (through
48 // chromeos::NetworkSmsHandler::Observer).
49 void Update(bool notify);
51 base::ListValue& messages() { return messages_; }
53 private:
54 SmsDefaultView* default_;
55 SmsDetailedView* detailed_;
56 SmsNotificationView* notification_;
57 base::ListValue messages_;
59 DISALLOW_COPY_AND_ASSIGN(TraySms);
62 } // namespace ash
64 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_SMS_H