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

Unified Diff: chrome/browser/chromeos/mobile/mobile_activator.h

Issue 22611005: Switch over MobileActivator to use Network*Handler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + remove NetworkManagerChanged Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/mobile/mobile_activator.h
diff --git a/chrome/browser/chromeos/mobile/mobile_activator.h b/chrome/browser/chromeos/mobile/mobile_activator.h
index 3ba0e86e38ff3fc715887c1285b4a35367c46dcb..81c7de305b71507a8e497d48b15983997194de60 100644
--- a/chrome/browser/chromeos/mobile/mobile_activator.h
+++ b/chrome/browser/chromeos/mobile/mobile_activator.h
@@ -9,14 +9,21 @@
#include <string>
#include "base/files/file_path.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "chrome/browser/chromeos/cros/network_library.h"
+#include "base/timer/timer.h"
+#include "chromeos/network/network_state_handler_observer.h"
#include "content/public/browser/browser_thread.h"
+namespace base {
+class DictionaryValue;
+}
+
namespace chromeos {
+class NetworkState;
class TestMobileActivator;
// Cellular plan config document.
@@ -48,9 +55,8 @@ class CellularConfigDocument
// This class performs mobile plan activation process.
class MobileActivator
- : public NetworkLibrary::NetworkManagerObserver,
- public NetworkLibrary::NetworkObserver,
- public base::SupportsWeakPtr<MobileActivator> {
+ : public base::SupportsWeakPtr<MobileActivator>,
+ public NetworkStateHandlerObserver {
public:
// Activation state.
enum PlanActivationState {
@@ -91,7 +97,7 @@ class MobileActivator
public:
// Signals activation |state| change for given |network|.
virtual void OnActivationStateChanged(
- CellularNetwork* network,
+ const NetworkState* network,
PlanActivationState state,
const std::string& error_description) = 0;
@@ -133,11 +139,9 @@ class MobileActivator
MobileActivator();
virtual ~MobileActivator();
- // NetworkLibrary::NetworkManagerObserver overrides.
- virtual void OnNetworkManagerChanged(NetworkLibrary* obj) OVERRIDE;
- // NetworkLibrary::NetworkObserver overrides.
- virtual void OnNetworkChanged(NetworkLibrary* obj,
- const Network* network) OVERRIDE;
+ // NetworkStateHandlerObserver overrides.
+ virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE;
+ virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE;
// Continue activation after inital setup (config load).
void ContinueActivation();
@@ -161,32 +165,45 @@ class MobileActivator
// Called when an OTASP attempt times out.
void HandleOTASPTimeout();
// Forces disconnect / reconnect when we detect portal connectivity issues.
- void ForceReconnect(CellularNetwork* network, PlanActivationState next_state);
+ void ForceReconnect(const NetworkState* network,
+ PlanActivationState next_state);
// Called when ForceReconnect takes too long to reconnect.
void ReconnectTimedOut();
+
+ // Called on default network changes to update cellular network activation
+ // state.
+ void RefreshCellularNetworks();
// Verify the state of cellular network and modify internal state.
- virtual void EvaluateCellularNetwork(CellularNetwork* network);
+ virtual void EvaluateCellularNetwork(const NetworkState* network);
// PickNextState selects the desired state based on the current state of the
// modem and the activator. It does not transition to this state however.
- PlanActivationState PickNextState(CellularNetwork* network,
+ PlanActivationState PickNextState(const NetworkState* network,
std::string* error_description) const;
// One of PickNext*State are called in PickNextState based on whether the
// modem is online or not.
- PlanActivationState PickNextOnlineState(CellularNetwork* network) const;
- PlanActivationState PickNextOfflineState(CellularNetwork* network) const;
+ PlanActivationState PickNextOnlineState(const NetworkState* network) const;
+ PlanActivationState PickNextOfflineState(const NetworkState* network) const;
// Check the current cellular network for error conditions.
- bool GotActivationError(CellularNetwork* network,
+ bool GotActivationError(const NetworkState* network,
std::string* error) const;
// Sends status updates to WebUI page.
- void UpdatePage(CellularNetwork* network,
+ void UpdatePage(const NetworkState* network,
const std::string& error_description);
+
+ // Callback used to handle an activation error.
+ void HandleActivationFailure(
+ const std::string& service_path,
+ PlanActivationState new_state,
+ const std::string& error_name,
+ scoped_ptr<base::DictionaryValue> error_data);
+
// Changes internal state.
- virtual void ChangeState(CellularNetwork* network,
+ virtual void ChangeState(const NetworkState* network,
PlanActivationState new_state,
const std::string& error_description);
// Resets network devices after cellular activation process.
// |network| should be NULL if the activation process failed.
- void CompleteActivation(CellularNetwork* network);
+ void CompleteActivation(const NetworkState* network);
// Disables SSL certificate revocation checking mechanism. In the case
// where captive portal connection is the only one present, such revocation
// checks could prevent payment portal page from loading.
@@ -197,8 +214,8 @@ class MobileActivator
std::string GetErrorMessage(const std::string& code) const;
// Converts the currently active CellularNetwork device into a JS object.
- static void GetDeviceInfo(CellularNetwork* network,
- DictionaryValue* value);
+ static void GetDeviceInfo(const NetworkState* network,
+ base::DictionaryValue* value);
static bool ShouldReportDeviceState(std::string* state, std::string* error);
// Performs activation state cellular device evaluation.
@@ -207,16 +224,17 @@ class MobileActivator
static bool EvaluateCellularDeviceState(bool* report_status,
std::string* state,
std::string* error);
- // Finds cellular network that matches |meid_| or |iccid_|, reattach network
- // change observer if |reattach_observer| flag is set.
- virtual CellularNetwork* FindMatchingCellularNetwork(bool reattach_observer);
// Starts the OTASP timeout timer. If the timer fires, we'll force a
// disconnect/reconnect cycle on this network.
virtual void StartOTASPTimer();
- static const char* GetStateDescription(PlanActivationState state);
+ // Records information that cellular plan payment has happened.
+ virtual void SignalCellularPlanPayment();
+
+ // Returns true if cellular plan payment has been recorded recently.
+ virtual bool HasRecentCellularPlanPayment() const;
- virtual NetworkLibrary* GetNetworkLibrary() const;
+ static const char* GetStateDescription(PlanActivationState state);
scoped_refptr<CellularConfigDocument> cellular_config_;
// Internal handler state.
@@ -250,7 +268,8 @@ class MobileActivator
base::RepeatingTimer<MobileActivator> continue_reconnect_timer_;
// Called when the reconnect attempt times out.
base::OneShotTimer<MobileActivator> reconnect_timeout_timer_;
-
+ // Cellular plan payment time.
+ base::Time cellular_plan_payment_time_;
ObserverList<Observer> observers_;

Powered by Google App Engine
This is Rietveld 408576698