Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_ | |
| 6 #define CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/network/network_handler_callbacks.h" | |
| 14 | |
| 15 namespace chromeos { | |
| 16 | |
| 17 // The NetworkActivationHandler class allows making service specific | |
| 18 // calls required for activation on mobile networks. | |
| 19 class CHROMEOS_EXPORT NetworkActivationHandler | |
| 20 : public base::SupportsWeakPtr<NetworkActivationHandler> { | |
| 21 public: | |
| 22 // Constants for |error_name| from |error_callback|. | |
| 23 // TODO(gauravsh): Merge various error constants from Network*Handlers into | |
| 24 // a single place. crbug.com/272554 | |
| 25 static const char kErrorNotFound[]; | |
| 26 static const char kErrorShillError[]; | |
| 27 | |
| 28 virtual ~NetworkActivationHandler(); | |
| 29 | |
| 30 // ActivateNetwork() will start an asynchronous activation attempt. | |
| 31 // |carrier| may be empty or may specify a carrier to activate. | |
| 32 // On success, |success_callback| will be called. | |
| 33 // On failure, |error_callback| will be called with |error_name| one of: | |
| 34 // kErrorNotFound if no network matching |service_path| is found. | |
| 35 // kErrorShillError if a DBus or Shill error occurred. | |
| 36 void Activate(const std::string& service_path, | |
| 37 const std::string& carrier, | |
| 38 const base::Closure& success_callback, | |
| 39 const network_handler::ErrorCallback& error_callback); | |
| 40 | |
| 41 // CompleteActivation() will start an asynchronous activation completion | |
| 42 // attempt. | |
| 43 // On success, |success_callback| will be called. | |
| 44 // On failure, |error_callback| will be called with |error_name| one of: | |
| 45 // kErrorNotFound if no network matching |service_path| is found. | |
| 46 // kErrorShillError if a DBus or Shill error occurred. | |
| 47 void CompleteActivation(const std::string& service_path, | |
| 48 const base::Closure& success_callback, | |
| 49 const network_handler::ErrorCallback& error_callback); | |
| 50 | |
| 51 private: | |
| 52 friend class NetworkHandler; | |
| 53 | |
| 54 NetworkActivationHandler(); | |
| 55 | |
| 56 // Calls Shill.Service.ActivateCellularModem asynchronously. | |
| 57 void CallShillActivate(const std::string& service_path, | |
| 58 const std::string& carrier, | |
| 59 const base::Closure& success_callback, | |
| 60 const network_handler::ErrorCallback& error_callback); | |
|
stevenjb
2013/08/14 02:28:31
nit: WS
gauravsh
2013/08/14 21:42:29
Done.
| |
| 61 // Calls Shill.Service.CompleteCellularActivation asynchronously. | |
| 62 void CallShillCompleteActivation( | |
| 63 const std::string& service_path, | |
| 64 const base::Closure& success_callback, | |
| 65 const network_handler::ErrorCallback& error_callback); | |
| 66 | |
| 67 // Handle success from Shill.Service.ActivateCellularModem or | |
| 68 // Shill.Service.CompleteCellularActivation. | |
| 69 void HandleShillSuccess(const std::string& service_path, | |
| 70 const base::Closure& success_callback); | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(NetworkActivationHandler); | |
| 73 }; | |
| 74 | |
| 75 } // namespace chromeos | |
| 76 | |
| 77 #endif // CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_ | |
| OLD | NEW |