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

Unified Diff: chromeos/network/network_activation_handler.h

Issue 22611005: Switch over MobileActivator to use Network*Handler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ws 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
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/network/network_activation_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_activation_handler.h
diff --git a/chromeos/network/network_activation_handler.h b/chromeos/network/network_activation_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..f15c73d1f23dec1dac7a70fce3c2783219ef0518
--- /dev/null
+++ b/chromeos/network/network_activation_handler.h
@@ -0,0 +1,78 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_
+#define CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/network/network_handler_callbacks.h"
+
+namespace chromeos {
+
+// The NetworkActivationHandler class allows making service specific
+// calls required for activation on mobile networks.
+class CHROMEOS_EXPORT NetworkActivationHandler
+ : public base::SupportsWeakPtr<NetworkActivationHandler> {
+ public:
+ // Constants for |error_name| from |error_callback|.
+ // TODO(gauravsh): Merge various error constants from Network*Handlers into
+ // a single place. crbug.com/272554
+ static const char kErrorNotFound[];
+ static const char kErrorShillError[];
+
+ virtual ~NetworkActivationHandler();
+
+ // ActivateNetwork() will start an asynchronous activation attempt.
+ // |carrier| may be empty or may specify a carrier to activate.
+ // On success, |success_callback| will be called.
+ // On failure, |error_callback| will be called with |error_name| one of:
+ // kErrorNotFound if no network matching |service_path| is found.
+ // kErrorShillError if a DBus or Shill error occurred.
+ void Activate(const std::string& service_path,
+ const std::string& carrier,
+ const base::Closure& success_callback,
+ const network_handler::ErrorCallback& error_callback);
+
+ // CompleteActivation() will start an asynchronous activation completion
+ // attempt.
+ // On success, |success_callback| will be called.
+ // On failure, |error_callback| will be called with |error_name| one of:
+ // kErrorNotFound if no network matching |service_path| is found.
+ // kErrorShillError if a DBus or Shill error occurred.
+ void CompleteActivation(const std::string& service_path,
+ const base::Closure& success_callback,
+ const network_handler::ErrorCallback& error_callback);
+
+ private:
+ friend class NetworkHandler;
+
+ NetworkActivationHandler();
+
+ // Calls Shill.Service.ActivateCellularModem asynchronously.
+ void CallShillActivate(const std::string& service_path,
+ const std::string& carrier,
+ const base::Closure& success_callback,
+ const network_handler::ErrorCallback& error_callback);
+
+ // Calls Shill.Service.CompleteCellularActivation asynchronously.
+ void CallShillCompleteActivation(
+ const std::string& service_path,
+ const base::Closure& success_callback,
+ const network_handler::ErrorCallback& error_callback);
+
+ // Handle success from Shill.Service.ActivateCellularModem or
+ // Shill.Service.CompleteCellularActivation.
+ void HandleShillSuccess(const std::string& service_path,
+ const base::Closure& success_callback);
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkActivationHandler);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_NETWORK_NETWORK_ACTIVATION_HANDLER_H_
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/network/network_activation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698