OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_CASHEW_CLIENT_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_DBUS_CASHEW_CLIENT_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "base/callback.h" | |
14 #include "chrome/browser/chromeos/dbus/dbus_client_implementation_type.h" | |
15 | |
16 namespace base { | |
17 class ListValue; | |
18 } | |
19 | |
20 namespace dbus { | |
21 class Bus; | |
22 } | |
23 | |
24 namespace chromeos { | |
25 | |
26 // CashewClient is used to communicate with the Cashew service. | |
27 // All methods should be called from the origin thread (UI thread) which | |
28 // initializes the DBusThreadManager instance. | |
29 class CashewClient { | |
30 public: | |
31 // A callback to handle "DataPlansUpdate" signal. | |
32 // |service| is the D-Bus path of the cellular service. | |
33 // (e.g. /service/cellular_0271266ce2ce_310260467781434) | |
34 typedef base::Callback<void(const std::string& service, | |
35 const base::ListValue& data_plans)> | |
36 DataPlansUpdateHandler; | |
37 | |
38 virtual ~CashewClient(); | |
39 | |
40 // Factory function, creates a new instance and returns ownership. | |
41 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
42 static CashewClient* Create(DBusClientImplementationType type, | |
43 dbus::Bus* bus); | |
44 | |
45 // Sets DataPlansUpdate signal handler. | |
46 virtual void SetDataPlansUpdateHandler(DataPlansUpdateHandler handler) = 0; | |
47 | |
48 // Resets DataPlansUpdate signal handler. | |
49 virtual void ResetDataPlansUpdateHandler() = 0; | |
50 | |
51 // Calls RequestDataPlansUpdate method. | |
52 virtual void RequestDataPlansUpdate() = 0; | |
53 | |
54 protected: | |
55 // Create() should be used instead. | |
56 CashewClient(); | |
57 | |
58 private: | |
59 DISALLOW_COPY_AND_ASSIGN(CashewClient); | |
60 }; | |
61 | |
62 } // namespace chromeos | |
63 | |
64 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CASHEW_CLIENT_H_ | |
OLD | NEW |