| 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 CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_ |
| 7 | 7 |
| 8 #include "ash/system/chromeos/network/network_tray_delegate.h" | |
| 9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 10 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 11 #include "chromeos/network/network_state_handler_observer.h" | 10 #include "chromeos/network/network_state_handler_observer.h" |
| 12 | 11 |
| 13 class PrefRegistrySimple; | 12 class PrefRegistrySimple; |
| 14 | 13 |
| 15 namespace ash { | |
| 16 class NetworkTrayDelegate; | |
| 17 } | |
| 18 | |
| 19 namespace views { | 14 namespace views { |
| 20 class View; | 15 class View; |
| 21 } | 16 } |
| 22 | 17 |
| 23 namespace chromeos { | 18 namespace chromeos { |
| 24 | 19 |
| 25 // This class is responsible for triggering cellular network related | 20 // This class is responsible for triggering cellular network related |
| 26 // notifications, specifically: | 21 // notifications, specifically: |
| 27 // * "Cellular Activated" when Cellular is activated and enabled for the | |
| 28 // first time. | |
| 29 // * "Chrome will use mobile data..." when Cellular is the Default network | 22 // * "Chrome will use mobile data..." when Cellular is the Default network |
| 30 // for the first time. | 23 // for the first time. |
| 31 // * Data Promotion notifications when available / appropriate. | 24 // * Data Promotion notifications when available / appropriate. |
| 32 class DataPromoNotification : public NetworkStateHandlerObserver, | 25 class DataPromoNotification : public NetworkStateHandlerObserver { |
| 33 public ash::NetworkTrayDelegate { | |
| 34 public: | 26 public: |
| 35 DataPromoNotification(); | 27 DataPromoNotification(); |
| 36 virtual ~DataPromoNotification(); | 28 virtual ~DataPromoNotification(); |
| 37 | 29 |
| 38 static void RegisterPrefs(PrefRegistrySimple* registry); | 30 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 39 | 31 |
| 40 private: | 32 private: |
| 41 // NetworkStateHandlerObserver | 33 // NetworkStateHandlerObserver |
| 42 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; | 34 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; |
| 43 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; | 35 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; |
| 44 | 36 |
| 45 // ash::NetworkTrayDelegate | |
| 46 virtual void NotificationLinkClicked( | |
| 47 ash::NetworkObserver::MessageType message_type, | |
| 48 size_t link_index) OVERRIDE; | |
| 49 | |
| 50 // Shows 3G promo notification if needed. | 37 // Shows 3G promo notification if needed. |
| 51 void ShowOptionalMobileDataPromoNotification(); | 38 void ShowOptionalMobileDataPromoNotification(); |
| 52 | 39 |
| 53 // Updates the cellular activating state and checks for notification trigger. | |
| 54 void UpdateCellularActivating(); | |
| 55 | |
| 56 // Closes message bubble. | |
| 57 void CloseNotification(); | |
| 58 | |
| 59 // True if check for promo needs to be done, otherwise ignore it for the | 40 // True if check for promo needs to be done, otherwise ignore it for the |
| 60 // current session. | 41 // current session. |
| 61 bool check_for_promo_; | 42 bool check_for_promo_; |
| 62 | 43 |
| 63 // Current carrier deal info URL. | |
| 64 std::string deal_info_url_; | |
| 65 | |
| 66 // Current carrier deal top-up URL. | |
| 67 std::string deal_topup_url_; | |
| 68 | |
| 69 // Internal state tracking. | |
| 70 bool cellular_activating_; | |
| 71 | |
| 72 // Factory for delaying showing promo notification. | 44 // Factory for delaying showing promo notification. |
| 73 base::WeakPtrFactory<DataPromoNotification> weak_ptr_factory_; | 45 base::WeakPtrFactory<DataPromoNotification> weak_ptr_factory_; |
| 74 | 46 |
| 75 DISALLOW_COPY_AND_ASSIGN(DataPromoNotification); | 47 DISALLOW_COPY_AND_ASSIGN(DataPromoNotification); |
| 76 }; | 48 }; |
| 77 | 49 |
| 78 } // namespace chromeos | 50 } // namespace chromeos |
| 79 | 51 |
| 80 #endif // CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_ | 52 #endif // CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_ |
| OLD | NEW |