OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_WEBRTC_DEVTOOLS_BRIDGE_INSTANCES_REQUEST_
H_ | |
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_WEBRTC_DEVTOOLS_BRIDGE_INSTANCES_REQUEST_
H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "chrome/browser/devtools/device/android_device_manager.h" | |
10 #include "chrome/browser/local_discovery/gcd_api_flow.h" | |
11 | |
12 class DevToolsBridgeInstancesRequest | |
13 : public local_discovery::GCDApiFlowRequest { | |
14 public: | |
15 struct Instance { | |
16 std::string id; | |
17 std::string display_name; | |
18 | |
19 ~Instance(); | |
20 }; | |
21 | |
22 using InstanceList = std::vector<Instance>; | |
23 | |
24 class Delegate { | |
25 public: | |
26 virtual void OnDevToolsBridgeInstancesRequestSucceeded( | |
27 const InstanceList& result) = 0; | |
28 virtual void OnDevToolsBridgeInstancesRequestFailed() = 0; | |
29 | |
30 protected: | |
31 ~Delegate() {} | |
32 }; | |
33 | |
34 explicit DevToolsBridgeInstancesRequest(Delegate* delegate); | |
35 ~DevToolsBridgeInstancesRequest() override; | |
36 | |
37 // Implementation of GCDApiFlowRequest. | |
38 void OnGCDAPIFlowError(local_discovery::GCDApiFlow::Status status) override; | |
39 void OnGCDAPIFlowComplete(const base::DictionaryValue& value) override; | |
40 GURL GetURL() override; | |
41 | |
42 private: | |
43 void TryAddInstance(const base::DictionaryValue& device_value); | |
44 | |
45 Delegate* const delegate_; | |
46 InstanceList result_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(DevToolsBridgeInstancesRequest); | |
49 }; | |
50 | |
51 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_WEBRTC_DEVTOOLS_BRIDGE_INSTANCES_REQUE
ST_H_ | |
OLD | NEW |