Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: chrome/browser/devtools/devtools_adb_bridge.h

Issue 23953002: DevTools: request usb permission on ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 class Listener { 260 class Listener {
261 public: 261 public:
262 virtual void RemoteDevicesChanged(RemoteDevices* devices) = 0; 262 virtual void RemoteDevicesChanged(RemoteDevices* devices) = 0;
263 protected: 263 protected:
264 virtual ~Listener() {} 264 virtual ~Listener() {}
265 }; 265 };
266 266
267 explicit DevToolsAdbBridge(Profile* profile); 267 explicit DevToolsAdbBridge(Profile* profile);
268 268
269 void EnumerateUsbDevices(const AndroidDevicesCallback& callback);
270 void EnumerateAdbDevices(const AndroidDevicesCallback& callback);
271
272 void AddListener(Listener* listener); 269 void AddListener(Listener* listener);
273 void RemoveListener(Listener* listener); 270 void RemoveListener(Listener* listener);
274 271
275 base::MessageLoop* GetAdbMessageLoop(); 272 base::MessageLoop* GetAdbMessageLoop();
276 273
277 private: 274 private:
278 friend struct content::BrowserThread::DeleteOnThread< 275 friend struct content::BrowserThread::DeleteOnThread<
279 content::BrowserThread::UI>; 276 content::BrowserThread::UI>;
280 friend class base::DeleteHelper<DevToolsAdbBridge>; 277 friend class base::DeleteHelper<DevToolsAdbBridge>;
281 278
282 class RefCountedAdbThread : public base::RefCounted<RefCountedAdbThread> { 279 class RefCountedAdbThread : public base::RefCounted<RefCountedAdbThread> {
283 public: 280 public:
284 static scoped_refptr<RefCountedAdbThread> GetInstance(); 281 static scoped_refptr<RefCountedAdbThread> GetInstance();
285 RefCountedAdbThread(); 282 RefCountedAdbThread();
286 base::MessageLoop* message_loop(); 283 base::MessageLoop* message_loop();
287 284
288 private: 285 private:
289 friend class base::RefCounted<RefCountedAdbThread>; 286 friend class base::RefCounted<RefCountedAdbThread>;
290 static DevToolsAdbBridge::RefCountedAdbThread* instance_; 287 static DevToolsAdbBridge::RefCountedAdbThread* instance_;
291 static void StopThread(base::Thread* thread); 288 static void StopThread(base::Thread* thread);
292 289
293 virtual ~RefCountedAdbThread(); 290 virtual ~RefCountedAdbThread();
294 base::Thread* thread_; 291 base::Thread* thread_;
295 }; 292 };
296 293
297 virtual ~DevToolsAdbBridge(); 294 virtual ~DevToolsAdbBridge();
298 void ReceivedUsbDevices(const AndroidDevicesCallback& callback,
299 const AndroidUsbDevices& usb_devices);
300 void ReceivedAdbDevices(const AndroidDevicesCallback& callback,
301 int result,
302 const std::string& response);
303 295
304 void RequestRemoteDevices(); 296 void RequestRemoteDevices();
305 void ReceivedRemoteDevices(RemoteDevices* devices); 297 void ReceivedRemoteDevices(RemoteDevices* devices);
306 298
307 Profile* profile_; 299 Profile* profile_;
308 scoped_refptr<RefCountedAdbThread> adb_thread_; 300 scoped_refptr<RefCountedAdbThread> adb_thread_;
309 bool has_message_loop_; 301 bool has_message_loop_;
310 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; 302 scoped_ptr<crypto::RSAPrivateKey> rsa_key_;
311 typedef std::vector<Listener*> Listeners; 303 typedef std::vector<Listener*> Listeners;
312 Listeners listeners_; 304 Listeners listeners_;
313 scoped_ptr<PortForwardingController> port_forwarding_controller_; 305 scoped_ptr<PortForwardingController> port_forwarding_controller_;
314 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); 306 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge);
315 }; 307 };
316 308
317 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ 309 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/devtools/adb/android_usb_device.cc ('k') | chrome/browser/devtools/devtools_adb_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698