| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 public: | 67 public: |
| 68 // Called whenever the state of the bridge has changed. | 68 // Called whenever the state of the bridge has changed. |
| 69 virtual void OnStateChanged(State state) {} | 69 virtual void OnStateChanged(State state) {} |
| 70 | 70 |
| 71 // Called when the instance has reached a boot phase | 71 // Called when the instance has reached a boot phase |
| 72 virtual void OnInstanceBootPhase(InstanceBootPhase phase) {} | 72 virtual void OnInstanceBootPhase(InstanceBootPhase phase) {} |
| 73 | 73 |
| 74 // Called whenever ARC's availability has changed for this system. | 74 // Called whenever ARC's availability has changed for this system. |
| 75 virtual void OnAvailableChanged(bool available) {} | 75 virtual void OnAvailableChanged(bool available) {} |
| 76 | 76 |
| 77 // Called whenever ARC sends information about available apps. |
| 78 virtual void OnAppsRefreshed(const std::vector<AppInfo>& apps) {} |
| 79 |
| 80 // Called whenever ARC sends app icon data for specific scale factor. |
| 81 virtual void OnAppIcon(const std::string& package, |
| 82 const std::string& activity, |
| 83 int scale_factor, |
| 84 const std::vector<uint8_t>& icon_png_data) {} |
| 85 |
| 77 protected: | 86 protected: |
| 78 virtual ~Observer() {} | 87 virtual ~Observer() {} |
| 79 }; | 88 }; |
| 80 | 89 |
| 81 ArcBridgeService(); | 90 ArcBridgeService(); |
| 82 virtual ~ArcBridgeService(); | 91 virtual ~ArcBridgeService(); |
| 83 | 92 |
| 84 // Create instance of |ArcBridgeService| for normal use. | 93 // Create instance of |ArcBridgeService| for normal use. |
| 85 static scoped_ptr<ArcBridgeService> Create( | 94 static scoped_ptr<ArcBridgeService> Create( |
| 86 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, | 95 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Requests registration of an input device on the ARC instance. | 127 // Requests registration of an input device on the ARC instance. |
| 119 // TODO(denniskempin): Make this interface more typesafe. | 128 // TODO(denniskempin): Make this interface more typesafe. |
| 120 // |name| should be the displayable name of the emulated device (e.g. "Chrome | 129 // |name| should be the displayable name of the emulated device (e.g. "Chrome |
| 121 // OS Keyboard"), |device_type| the name of the device type (e.g. "keyboard") | 130 // OS Keyboard"), |device_type| the name of the device type (e.g. "keyboard") |
| 122 // and |fd| a file descriptor that emulates the kernel events of the device. | 131 // and |fd| a file descriptor that emulates the kernel events of the device. |
| 123 // This can only be called on the thread that this class was created on. | 132 // This can only be called on the thread that this class was created on. |
| 124 virtual bool RegisterInputDevice(const std::string& name, | 133 virtual bool RegisterInputDevice(const std::string& name, |
| 125 const std::string& device_type, | 134 const std::string& device_type, |
| 126 base::ScopedFD fd) = 0; | 135 base::ScopedFD fd) = 0; |
| 127 | 136 |
| 137 // Requests to refresh an app list. |
| 138 virtual bool RefreshApps() = 0; |
| 139 |
| 140 // Requests to launch an app. |
| 141 virtual bool LaunchApp(const std::string& package, |
| 142 const std::string& activity) = 0; |
| 143 |
| 144 // Request to load icon of specific scale_factor. |
| 145 virtual bool RequestIcon(const std::string& package, |
| 146 const std::string& activity, |
| 147 int scale_factor) = 0; |
| 148 |
| 128 protected: | 149 protected: |
| 129 // Changes the current state and notifies all observers. | 150 // Changes the current state and notifies all observers. |
| 130 void SetState(State state); | 151 void SetState(State state); |
| 131 | 152 |
| 132 // Changes the current availability and notifies all observers. | 153 // Changes the current availability and notifies all observers. |
| 133 void SetAvailable(bool availability); | 154 void SetAvailable(bool availability); |
| 134 | 155 |
| 135 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; | 156 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; |
| 136 | 157 |
| 137 base::ObserverList<Observer> observer_list_; | 158 base::ObserverList<Observer> observer_list_; |
| 138 | 159 |
| 139 // If the ARC instance service is available. | 160 // If the ARC instance service is available. |
| 140 bool available_; | 161 bool available_; |
| 141 | 162 |
| 142 // The current state of the bridge. | 163 // The current state of the bridge. |
| 143 ArcBridgeService::State state_; | 164 ArcBridgeService::State state_; |
| 144 | 165 |
| 145 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 166 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
| 146 }; | 167 }; |
| 147 | 168 |
| 148 } // namespace arc | 169 } // namespace arc |
| 149 | 170 |
| 150 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 171 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| OLD | NEW |