Update V8 to version 4.6.54.
[chromium-blink-merge.git] / chromeos / network / network_activation_handler.h
blobf15c73d1f23dec1dac7a70fce3c2783219ef0518
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.
5 #ifndef CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_
6 #define CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_
8 #include <string>
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"
15 namespace chromeos {
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[];
28 virtual ~NetworkActivationHandler();
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);
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);
51 private:
52 friend class NetworkHandler;
54 NetworkActivationHandler();
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);
62 // Calls Shill.Service.CompleteCellularActivation asynchronously.
63 void CallShillCompleteActivation(
64 const std::string& service_path,
65 const base::Closure& success_callback,
66 const network_handler::ErrorCallback& error_callback);
68 // Handle success from Shill.Service.ActivateCellularModem or
69 // Shill.Service.CompleteCellularActivation.
70 void HandleShillSuccess(const std::string& service_path,
71 const base::Closure& success_callback);
73 DISALLOW_COPY_AND_ASSIGN(NetworkActivationHandler);
76 } // namespace chromeos
78 #endif // CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_