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