| OLD | NEW | 
|---|
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef CHROMEOS_ARC_BRIDGE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_ARC_BRIDGE_CLIENT_H_ | 
| 6 #define CHROMEOS_ARC_BRIDGE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_ARC_BRIDGE_CLIENT_H_ | 
| 7 | 7 | 
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" | 
| 9 #include "chromeos/chromeos_export.h" | 9 #include "chromeos/chromeos_export.h" | 
| 10 #include "chromeos/dbus/dbus_client.h" | 10 #include "chromeos/dbus/dbus_client.h" | 
| 11 #include "chromeos/dbus/dbus_method_call_status.h" | 11 #include "chromeos/dbus/dbus_method_call_status.h" | 
| 12 | 12 | 
| 13 namespace dbus { | 13 namespace dbus { | 
| 14 class ObjectPath; | 14 class ObjectPath; | 
| 15 } | 15 } | 
| 16 | 16 | 
| 17 namespace chromeos { | 17 namespace chromeos { | 
| 18 | 18 | 
| 19 // Client for the Arc Bridge Service | 19 // Client for the Arc Bridge Service | 
| 20 class CHROMEOS_EXPORT ArcBridgeClient : public DBusClient { | 20 class CHROMEOS_EXPORT ArcBridgeClient : public DBusClient { | 
| 21  public: | 21  public: | 
|  | 22   struct AppInfo { | 
|  | 23     AppInfo(); | 
|  | 24     ~AppInfo(); | 
|  | 25 | 
|  | 26     std::string name; | 
|  | 27     std::string description; | 
|  | 28     std::string package; | 
|  | 29     std::string activity; | 
|  | 30     std::vector<uint8> icon; | 
|  | 31   }; | 
|  | 32 | 
|  | 33   class AppObserver { | 
|  | 34    public: | 
|  | 35     virtual void OnAppReady(const AppInfo& app) = 0; | 
|  | 36     virtual void OnAppsRefreshed(const std::vector<AppInfo>& apps) = 0; | 
|  | 37 | 
|  | 38    protected: | 
|  | 39     virtual ~AppObserver() {} | 
|  | 40   }; | 
|  | 41 | 
| 22   ~ArcBridgeClient() override; | 42   ~ArcBridgeClient() override; | 
| 23 | 43 | 
| 24   // Factory function, creates a new instance and returns ownership. | 44   // Factory function, creates a new instance and returns ownership. | 
| 25   // For normal usage, access the singleton via DBusThreadManager::Get(). | 45   // For normal usage, access the singleton via DBusThreadManager::Get(). | 
| 26   static ArcBridgeClient* Create(); | 46   static ArcBridgeClient* Create(); | 
| 27 | 47 | 
| 28   // Calls Ping method.  |callback| is called after the method call succeeds. | 48   // Calls Ping method.  |callback| is called after the method call succeeds. | 
| 29   virtual void Ping(const VoidDBusMethodCallback& callback) = 0; | 49   virtual void Ping(const VoidDBusMethodCallback& callback) = 0; | 
| 30 | 50 | 
|  | 51   // Refreshs app list. | 
|  | 52   virtual void Refresh() = 0; | 
|  | 53 | 
|  | 54   // Launchs the given app. | 
|  | 55   virtual void LaunchApp(const std::string& package, | 
|  | 56                          const std::string& activity) = 0; | 
|  | 57 | 
|  | 58   // Adds the given observer. | 
|  | 59   virtual void AddAppObserver(AppObserver* observer) = 0; | 
|  | 60   // Removes the given observer if this object has the observer. | 
|  | 61   virtual void RemoveAppObserver(AppObserver* observer) = 0; | 
|  | 62 | 
| 31  protected: | 63  protected: | 
| 32   // Create() should be used instead. | 64   // Create() should be used instead. | 
| 33   ArcBridgeClient(); | 65   ArcBridgeClient(); | 
| 34 | 66 | 
| 35  private: | 67  private: | 
| 36   DISALLOW_COPY_AND_ASSIGN(ArcBridgeClient); | 68   DISALLOW_COPY_AND_ASSIGN(ArcBridgeClient); | 
| 37 }; | 69 }; | 
| 38 | 70 | 
| 39 }  // namespace chromeos | 71 }  // namespace chromeos | 
| 40 | 72 | 
| 41 #endif  // CHROMEOS_ARC_BRIDGE_CLIENT_H_ | 73 #endif  // CHROMEOS_DBUS_ARC_BRIDGE_CLIENT_H_ | 
| OLD | NEW | 
|---|