OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_NETWORK_MESSAGE_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NETWORK_MESSAGE_OBSERVER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NETWORK_MESSAGE_OBSERVER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NETWORK_MESSAGE_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 "chrome/browser/chromeos/cros/network_library.h" | 13 #include "chrome/browser/chromeos/cros/network_library.h" |
14 #include "chrome/browser/chromeos/notifications/system_notification.h" | 14 #include "chrome/browser/chromeos/notifications/system_notification.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 namespace views { | 17 namespace views { |
18 class WindowDelegate; | 18 class WindowDelegate; |
19 } | 19 } |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 | 22 |
| 23 // We show nearing expiration notification when less than 30 minutes. |
| 24 static const int kDataNearingExpirationSecs = 30 * 60; |
| 25 |
| 26 // We show low data notification when less than 50MB. |
| 27 static const int kDataLowDataBytes = 50 * 1024; |
| 28 |
23 // The network message observer displays a system notification for network | 29 // The network message observer displays a system notification for network |
24 // messages. | 30 // messages. |
25 | 31 |
26 class NetworkMessageObserver : public NetworkLibrary::Observer { | 32 class NetworkMessageObserver : public NetworkLibrary::Observer { |
27 public: | 33 public: |
28 explicit NetworkMessageObserver(Profile* profile); | 34 explicit NetworkMessageObserver(Profile* profile); |
29 virtual ~NetworkMessageObserver(); | 35 virtual ~NetworkMessageObserver(); |
30 | 36 |
31 typedef std::map<std::string, WifiNetwork> ServicePathWifiMap; | 37 typedef std::map<std::string, WifiNetwork> ServicePathWifiMap; |
32 typedef std::map<std::string, CellularNetwork> ServicePathCellularMap; | 38 typedef std::map<std::string, CellularNetwork> ServicePathCellularMap; |
33 private: | 39 private: |
34 virtual void CreateModalPopup(views::WindowDelegate* view); | 40 virtual void CreateModalPopup(views::WindowDelegate* view); |
35 virtual void MobileSetup(const ListValue* args); | 41 virtual void MobileSetup(const ListValue* args); |
36 | 42 |
37 // NetworkLibrary::Observer implementation. | 43 // NetworkLibrary::Observer implementation. |
38 virtual void NetworkChanged(NetworkLibrary* obj); | 44 virtual void NetworkChanged(NetworkLibrary* obj); |
39 virtual void CellularDataPlanChanged(NetworkLibrary* obj); | 45 virtual void CellularDataPlanChanged(const std::string& service_path, |
| 46 const CellularDataPlanList& plans); |
40 | 47 |
41 bool initialized_; | 48 bool initialized_; |
42 // Wifi networks by service path. | 49 // Wifi networks by service path. |
43 ServicePathWifiMap wifi_networks_; | 50 ServicePathWifiMap wifi_networks_; |
44 // Cellular networks by service path. | 51 // Cellular networks by service path. |
45 ServicePathCellularMap cellular_networks_; | 52 ServicePathCellularMap cellular_networks_; |
46 | 53 |
47 // Current connect celluar service path. | 54 // Current connect celluar service path. |
48 std::string cellular_service_path_; | 55 std::string cellular_service_path_; |
49 // Last cellular data plan data. | 56 // Last cellular data plan data. |
50 CellularDataPlan cellular_data_plan_; | 57 CellularDataPlan cellular_data_plan_; |
51 | 58 |
52 // Notification for connection errors | 59 // Notification for connection errors |
53 SystemNotification notification_connection_error_; | 60 SystemNotification notification_connection_error_; |
54 // Notification for showing low data warning | 61 // Notification for showing low data warning |
55 SystemNotification notification_low_data_; | 62 SystemNotification notification_low_data_; |
56 // Notification for showing no data warning | 63 // Notification for showing no data warning |
57 SystemNotification notification_no_data_; | 64 SystemNotification notification_no_data_; |
58 | 65 |
59 DISALLOW_COPY_AND_ASSIGN(NetworkMessageObserver); | 66 DISALLOW_COPY_AND_ASSIGN(NetworkMessageObserver); |
60 }; | 67 }; |
61 | 68 |
62 } // namespace chromeos | 69 } // namespace chromeos |
63 | 70 |
64 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_MESSAGE_OBSERVER_H_ | 71 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_MESSAGE_OBSERVER_H_ |
65 | 72 |
OLD | NEW |