OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_SMS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SMS_OBSERVER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SMS_OBSERVER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SMS_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" |
13 #include "chrome/browser/chromeos/cros/network_library.h" | 14 #include "chrome/browser/chromeos/cros/network_library.h" |
14 | 15 |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 struct SMS; | 20 struct SMS; |
20 class SMSHandler; | 21 class SMSHandler; |
21 | 22 |
22 // Performs monitoring of incoming SMS and shows system notifications. | 23 // Performs monitoring of incoming SMS and shows system notifications. |
23 class SmsObserver : public NetworkLibrary::NetworkManagerObserver { | 24 class SmsObserver : public NetworkLibrary::NetworkManagerObserver { |
24 public: | 25 public: |
25 explicit SmsObserver(Profile* profile); | 26 explicit SmsObserver(Profile* profile); |
26 virtual ~SmsObserver(); | 27 virtual ~SmsObserver(); |
27 | 28 |
28 private: | 29 private: |
29 typedef std::map<std::string, SMSHandler*> ObserversMap; | 30 typedef std::map<std::string, SMSHandler*> ObserversMap; |
30 | 31 |
31 // NetworkLibrary:NetworkManagerObserver implementation: | 32 // NetworkLibrary:NetworkManagerObserver implementation: |
32 virtual void OnNetworkManagerChanged(NetworkLibrary* obj); | 33 virtual void OnNetworkManagerChanged(NetworkLibrary* obj) OVERRIDE; |
33 | 34 |
34 static void StaticCallback(void* object, | 35 static void StaticCallback(void* object, |
35 const char* modem_device_path, | 36 const char* modem_device_path, |
36 const SMS* message); | 37 const SMS* message); |
37 | 38 |
38 void OnNewMessage(const char* modem_device_path, const SMS* message); | 39 void OnNewMessage(const char* modem_device_path, const SMS* message); |
39 | 40 |
40 void UpdateObservers(NetworkLibrary* library); | 41 void UpdateObservers(NetworkLibrary* library); |
41 void DisconnectAll(); | 42 void DisconnectAll(); |
42 | 43 |
43 Profile* profile_; | 44 Profile* profile_; |
44 ObserversMap observers_; | 45 ObserversMap observers_; |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(SmsObserver); | 47 DISALLOW_COPY_AND_ASSIGN(SmsObserver); |
47 }; | 48 }; |
48 | 49 |
49 } // namespace chromeos | 50 } // namespace chromeos |
50 | 51 |
51 #endif // CHROME_BROWSER_CHROMEOS_SMS_OBSERVER_H_ | 52 #endif // CHROME_BROWSER_CHROMEOS_SMS_OBSERVER_H_ |
OLD | NEW |