| 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_MOBILE_MOBILE_ACTIVATOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_MOBILE_MOBILE_ACTIVATOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_MOBILE_MOBILE_ACTIVATOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_MOBILE_MOBILE_ACTIVATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "chrome/browser/chromeos/cros/network_library.h" | 15 #include "chrome/browser/chromeos/cros/network_library.h" |
| 16 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 | 18 |
| 18 namespace chromeos { | 19 namespace chromeos { |
| 19 | 20 |
| 20 class TestMobileActivator; | 21 class TestMobileActivator; |
| 21 | 22 |
| 22 // Cellular plan config document. | 23 // Cellular plan config document. |
| 23 class CellularConfigDocument | 24 class CellularConfigDocument |
| 24 : public base::RefCountedThreadSafe<CellularConfigDocument> { | 25 : public base::RefCountedThreadSafe<CellularConfigDocument> { |
| 25 public: | 26 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 std::string version_; | 43 std::string version_; |
| 43 ErrorMap error_map_; | 44 ErrorMap error_map_; |
| 44 base::Lock config_lock_; | 45 base::Lock config_lock_; |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(CellularConfigDocument); | 47 DISALLOW_COPY_AND_ASSIGN(CellularConfigDocument); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 // This class performs mobile plan activation process. | 50 // This class performs mobile plan activation process. |
| 50 class MobileActivator | 51 class MobileActivator |
| 51 : public NetworkLibrary::NetworkManagerObserver, | 52 : public ConnectivityStateHelperObserver, |
| 52 public NetworkLibrary::NetworkObserver, | 53 public NetworkLibrary::NetworkObserver, |
| 53 public base::SupportsWeakPtr<MobileActivator> { | 54 public base::SupportsWeakPtr<MobileActivator> { |
| 54 public: | 55 public: |
| 55 // Activation state. | 56 // Activation state. |
| 56 enum PlanActivationState { | 57 enum PlanActivationState { |
| 57 // Activation WebUI page is loading, activation not started. | 58 // Activation WebUI page is loading, activation not started. |
| 58 PLAN_ACTIVATION_PAGE_LOADING = -1, | 59 PLAN_ACTIVATION_PAGE_LOADING = -1, |
| 59 // Activation process started. | 60 // Activation process started. |
| 60 PLAN_ACTIVATION_START = 0, | 61 PLAN_ACTIVATION_START = 0, |
| 61 // Initial over the air activation attempt. | 62 // Initial over the air activation attempt. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 FRIEND_TEST_ALL_PREFIXES(MobileActivatorTest, OTASPScheduling); | 123 FRIEND_TEST_ALL_PREFIXES(MobileActivatorTest, OTASPScheduling); |
| 123 FRIEND_TEST_ALL_PREFIXES(MobileActivatorTest, | 124 FRIEND_TEST_ALL_PREFIXES(MobileActivatorTest, |
| 124 ReconnectOnDisconnectFromPaymentPortal); | 125 ReconnectOnDisconnectFromPaymentPortal); |
| 125 FRIEND_TEST_ALL_PREFIXES(MobileActivatorTest, StartAtStart); | 126 FRIEND_TEST_ALL_PREFIXES(MobileActivatorTest, StartAtStart); |
| 126 // We reach directly into the activator for testing purposes. | 127 // We reach directly into the activator for testing purposes. |
| 127 friend class MobileActivatorTest; | 128 friend class MobileActivatorTest; |
| 128 | 129 |
| 129 MobileActivator(); | 130 MobileActivator(); |
| 130 virtual ~MobileActivator(); | 131 virtual ~MobileActivator(); |
| 131 | 132 |
| 132 // NetworkLibrary::NetworkManagerObserver overrides. | 133 // ConnectivityStateHelperObserver overrides. |
| 133 virtual void OnNetworkManagerChanged(NetworkLibrary* obj) OVERRIDE; | 134 virtual void NetworkManagerChanged() OVERRIDE; |
| 134 // NetworkLibrary::NetworkObserver overrides. | 135 // NetworkLibrary::NetworkObserver overrides. |
| 135 virtual void OnNetworkChanged(NetworkLibrary* obj, | 136 virtual void OnNetworkChanged(NetworkLibrary* obj, |
| 136 const Network* network) OVERRIDE; | 137 const Network* network) OVERRIDE; |
| 137 | 138 |
| 138 // Continue activation after inital setup (config load). | 139 // Continue activation after inital setup (config load). |
| 139 void ContinueActivation(); | 140 void ContinueActivation(); |
| 140 // Handles the signal that the payment portal has finished loading. | 141 // Handles the signal that the payment portal has finished loading. |
| 141 void HandlePortalLoaded(bool success); | 142 void HandlePortalLoaded(bool success); |
| 142 // Handles the signal that the user has finished with the portal. | 143 // Handles the signal that the user has finished with the portal. |
| 143 void HandleSetTransactionStatus(bool success); | 144 void HandleSetTransactionStatus(bool success); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 250 |
| 250 | 251 |
| 251 ObserverList<Observer> observers_; | 252 ObserverList<Observer> observers_; |
| 252 | 253 |
| 253 DISALLOW_COPY_AND_ASSIGN(MobileActivator); | 254 DISALLOW_COPY_AND_ASSIGN(MobileActivator); |
| 254 }; | 255 }; |
| 255 | 256 |
| 256 } // namespace chromeos | 257 } // namespace chromeos |
| 257 | 258 |
| 258 #endif // CHROME_BROWSER_CHROMEOS_MOBILE_MOBILE_ACTIVATOR_H_ | 259 #endif // CHROME_BROWSER_CHROMEOS_MOBILE_MOBILE_ACTIVATOR_H_ |
| OLD | NEW |