| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SYSTEM_NETWORK_TRAY_SMS_H | 5 #ifndef ASH_SYSTEM_NETWORK_TRAY_SMS_H |
| 6 #define ASH_SYSTEM_NETWORK_TRAY_SMS_H | 6 #define ASH_SYSTEM_NETWORK_TRAY_SMS_H |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/system/tray/tray_image_item.h" | 9 #include <string> |
| 10 |
| 11 #include "ash/system/tray/system_tray_item.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 | 13 |
| 12 namespace ash { | 14 namespace ash { |
| 13 namespace internal { | 15 namespace internal { |
| 14 | 16 |
| 15 class TraySms : public TrayImageItem { | 17 class TraySms : public SystemTrayItem { |
| 16 public: | 18 public: |
| 17 TraySms(); | 19 TraySms(); |
| 18 virtual ~TraySms(); | 20 virtual ~TraySms(); |
| 19 | 21 |
| 20 // Overridden from SystemTrayItem. | 22 // Overridden from SystemTrayItem. |
| 21 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 23 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
| 22 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; | 24 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; |
| 23 virtual views::View* CreateNotificationView( | 25 virtual views::View* CreateNotificationView( |
| 24 user::LoginStatus status) OVERRIDE; | 26 user::LoginStatus status) OVERRIDE; |
| 25 virtual void DestroyDefaultView() OVERRIDE; | 27 virtual void DestroyDefaultView() OVERRIDE; |
| 26 virtual void DestroyDetailedView() OVERRIDE; | 28 virtual void DestroyDetailedView() OVERRIDE; |
| 27 virtual void DestroyNotificationView() OVERRIDE; | 29 virtual void DestroyNotificationView() OVERRIDE; |
| 28 | 30 |
| 29 // Overridden from TrayImageItem. | |
| 30 virtual bool GetInitialVisibility() OVERRIDE; | |
| 31 | |
| 32 protected: | 31 protected: |
| 33 class SmsDefaultView; | 32 class SmsDefaultView; |
| 34 class SmsDetailedView; | 33 class SmsDetailedView; |
| 35 class SmsMessageView; | 34 class SmsMessageView; |
| 36 class SmsNotificationView; | 35 class SmsNotificationView; |
| 37 class SmsObserver; | 36 class SmsObserver; |
| 38 | 37 |
| 38 // Gets the most recent message. Returns false if no messages or unable to |
| 39 // retrieve the numebr and text from the message. |
| 40 bool GetLatestMessage(size_t* index, std::string* number, std::string* text); |
| 41 |
| 39 // Called when sms messages have changed (by tray::SmsObserver). | 42 // Called when sms messages have changed (by tray::SmsObserver). |
| 40 void Update(bool notify); | 43 void Update(bool notify); |
| 41 | 44 |
| 42 SmsObserver* sms_observer() const { return sms_observer_.get(); } | 45 SmsObserver* sms_observer() const { return sms_observer_.get(); } |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 SmsDefaultView* default_; | 48 SmsDefaultView* default_; |
| 46 SmsDetailedView* detailed_; | 49 SmsDetailedView* detailed_; |
| 47 SmsNotificationView* notification_; | 50 SmsNotificationView* notification_; |
| 48 scoped_ptr<SmsObserver> sms_observer_; | 51 scoped_ptr<SmsObserver> sms_observer_; |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(TraySms); | 53 DISALLOW_COPY_AND_ASSIGN(TraySms); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace internal | 56 } // namespace internal |
| 54 } // namespace ash | 57 } // namespace ash |
| 55 | 58 |
| 56 #endif // ASH_SYSTEM_NETWORK_TRAY_SMS_H | 59 #endif // ASH_SYSTEM_NETWORK_TRAY_SMS_H |
| OLD | NEW |