OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); | 180 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); |
181 }; | 181 }; |
182 | 182 |
183 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; | 183 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; |
184 | 184 |
185 class RemoteDevice : public base::RefCounted<RemoteDevice> { | 185 class RemoteDevice : public base::RefCounted<RemoteDevice> { |
186 public: | 186 public: |
187 explicit RemoteDevice(scoped_refptr<AndroidDevice> device); | 187 explicit RemoteDevice(scoped_refptr<AndroidDevice> device); |
188 | 188 |
| 189 std::string GetSerial(); |
| 190 std::string GetModel(); |
| 191 bool IsConnected(); |
| 192 void AddBrowser(scoped_refptr<RemoteBrowser> browser); |
| 193 |
189 scoped_refptr<AndroidDevice> device() { return device_; } | 194 scoped_refptr<AndroidDevice> device() { return device_; } |
190 std::string serial() { return device_->serial(); } | |
191 std::string model() { return device_->model(); } | |
192 | |
193 RemoteBrowsers& browsers() { return browsers_; } | 195 RemoteBrowsers& browsers() { return browsers_; } |
194 void AddBrowser(scoped_refptr<RemoteBrowser> browser) { | 196 gfx::Size screen_size() { return screen_size_; } |
195 browsers_.push_back(browser); | 197 void set_screen_size(const gfx::Size& size) { screen_size_ = size; } |
196 } | |
197 | |
198 gfx::Size GetScreenSize() { return screen_size_; } | |
199 void SetScreenSize(const gfx::Size& size) { screen_size_ = size; } | |
200 | 198 |
201 private: | 199 private: |
202 friend class base::RefCounted<RemoteDevice>; | 200 friend class base::RefCounted<RemoteDevice>; |
203 virtual ~RemoteDevice(); | 201 virtual ~RemoteDevice(); |
204 | 202 |
205 scoped_refptr<AndroidDevice> device_; | 203 scoped_refptr<AndroidDevice> device_; |
206 RemoteBrowsers browsers_; | 204 RemoteBrowsers browsers_; |
207 gfx::Size screen_size_; | 205 gfx::Size screen_size_; |
208 | 206 |
209 DISALLOW_COPY_AND_ASSIGN(RemoteDevice); | 207 DISALLOW_COPY_AND_ASSIGN(RemoteDevice); |
210 }; | 208 }; |
211 | 209 |
212 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; | 210 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; |
213 | 211 |
214 class AndroidDevice : public base::RefCounted<AndroidDevice> { | 212 class AndroidDevice : public base::RefCounted<AndroidDevice> { |
215 public: | 213 public: |
216 explicit AndroidDevice(const std::string& serial); | 214 explicit AndroidDevice(const std::string& serial); |
217 | 215 |
218 virtual void RunCommand(const std::string& command, | 216 virtual void RunCommand(const std::string& command, |
219 const CommandCallback& callback) = 0; | 217 const CommandCallback& callback) = 0; |
220 virtual void OpenSocket(const std::string& socket_name, | 218 virtual void OpenSocket(const std::string& socket_name, |
221 const SocketCallback& callback) = 0; | 219 const SocketCallback& callback) = 0; |
| 220 virtual bool IsConnected() = 0; |
222 void HttpQuery(const std::string& la_name, | 221 void HttpQuery(const std::string& la_name, |
223 const std::string& request, | 222 const std::string& request, |
224 const CommandCallback& callback); | 223 const CommandCallback& callback); |
225 void HttpUpgrade(const std::string& la_name, | 224 void HttpUpgrade(const std::string& la_name, |
226 const std::string& request, | 225 const std::string& request, |
227 const SocketCallback& callback); | 226 const SocketCallback& callback); |
228 | 227 |
229 std::string serial() { return serial_; } | 228 std::string serial() { return serial_; } |
230 | 229 |
231 std::string model() { return model_; } | 230 std::string model() { return model_; } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 scoped_refptr<RefCountedAdbThread> adb_thread_; | 297 scoped_refptr<RefCountedAdbThread> adb_thread_; |
299 bool has_message_loop_; | 298 bool has_message_loop_; |
300 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; | 299 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; |
301 typedef std::vector<Listener*> Listeners; | 300 typedef std::vector<Listener*> Listeners; |
302 Listeners listeners_; | 301 Listeners listeners_; |
303 bool discover_usb_devices_; | 302 bool discover_usb_devices_; |
304 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); | 303 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); |
305 }; | 304 }; |
306 | 305 |
307 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 306 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
OLD | NEW |