Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: ash/system/network/tray_sms.h

Issue 10582028: Re-factor TraySms to use ash::SmsObserver instead of NetoworkSmsHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/network/sms_observer.h ('k') | ash/system/network/tray_sms.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 9 #include <string>
10 10
11 #include "ash/system/network/sms_observer.h"
11 #include "ash/system/tray/system_tray_item.h" 12 #include "ash/system/tray/system_tray_item.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/values.h"
13 14
14 namespace ash { 15 namespace ash {
15 namespace internal { 16 namespace internal {
16 17
17 class TraySms : public SystemTrayItem { 18 class TraySms : public SystemTrayItem,
19 public SmsObserver {
18 public: 20 public:
19 TraySms(); 21 TraySms();
20 virtual ~TraySms(); 22 virtual ~TraySms();
21 23
22 // Overridden from SystemTrayItem. 24 // Overridden from SystemTrayItem.
23 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; 25 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
24 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; 26 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
25 virtual views::View* CreateNotificationView( 27 virtual views::View* CreateNotificationView(
26 user::LoginStatus status) OVERRIDE; 28 user::LoginStatus status) OVERRIDE;
27 virtual void DestroyDefaultView() OVERRIDE; 29 virtual void DestroyDefaultView() OVERRIDE;
28 virtual void DestroyDetailedView() OVERRIDE; 30 virtual void DestroyDetailedView() OVERRIDE;
29 virtual void DestroyNotificationView() OVERRIDE; 31 virtual void DestroyNotificationView() OVERRIDE;
30 32
33 // Overridden from SmsObserver.
34 virtual void AddMessage(const base::DictionaryValue& message) OVERRIDE;
35
31 protected: 36 protected:
32 class SmsDefaultView; 37 class SmsDefaultView;
33 class SmsDetailedView; 38 class SmsDetailedView;
34 class SmsMessageView; 39 class SmsMessageView;
35 class SmsNotificationView; 40 class SmsNotificationView;
36 class SmsObserver;
37 41
38 // Gets the most recent message. Returns false if no messages or unable to 42 // Gets the most recent message. Returns false if no messages or unable to
39 // retrieve the numebr and text from the message. 43 // retrieve the numebr and text from the message.
40 bool GetLatestMessage(size_t* index, std::string* number, std::string* text); 44 bool GetLatestMessage(size_t* index, std::string* number, std::string* text);
41 45
46 // Removes message at |index| from message list.
47 void RemoveMessage(size_t index);
48
42 // Called when sms messages have changed (by tray::SmsObserver). 49 // Called when sms messages have changed (by tray::SmsObserver).
43 void Update(bool notify); 50 void Update(bool notify);
44 51
45 SmsObserver* sms_observer() const { return sms_observer_.get(); } 52 base::ListValue& messages() { return messages_; }
46 53
47 private: 54 private:
48 SmsDefaultView* default_; 55 SmsDefaultView* default_;
49 SmsDetailedView* detailed_; 56 SmsDetailedView* detailed_;
50 SmsNotificationView* notification_; 57 SmsNotificationView* notification_;
51 scoped_ptr<SmsObserver> sms_observer_; 58 base::ListValue messages_;
52 59
53 DISALLOW_COPY_AND_ASSIGN(TraySms); 60 DISALLOW_COPY_AND_ASSIGN(TraySms);
54 }; 61 };
55 62
56 } // namespace internal 63 } // namespace internal
57 } // namespace ash 64 } // namespace ash
58 65
59 #endif // ASH_SYSTEM_NETWORK_TRAY_SMS_H 66 #endif // ASH_SYSTEM_NETWORK_TRAY_SMS_H
OLDNEW
« no previous file with comments | « ash/system/network/sms_observer.h ('k') | ash/system/network/tray_sms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698