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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 RemotePage(scoped_refptr<DevToolsAdbBridge> bridge, | 88 RemotePage(scoped_refptr<DevToolsAdbBridge> bridge, |
89 scoped_refptr<AndroidDevice> device, | 89 scoped_refptr<AndroidDevice> device, |
90 const std::string& socket, | 90 const std::string& socket, |
91 const base::DictionaryValue& value); | 91 const base::DictionaryValue& value); |
92 | 92 |
93 std::string id() { return id_; } | 93 std::string id() { return id_; } |
94 std::string url() { return url_; } | 94 std::string url() { return url_; } |
95 std::string title() { return title_; } | 95 std::string title() { return title_; } |
96 std::string description() { return description_; } | 96 std::string description() { return description_; } |
97 std::string favicon_url() { return favicon_url_; } | 97 std::string favicon_url() { return favicon_url_; } |
98 std::string global_id() { return global_id_; } | 98 bool attached() { return debug_url_.empty(); } |
99 | 99 |
100 void Inspect(Profile* profile); | 100 void Inspect(Profile* profile); |
| 101 void Close(); |
| 102 void Reload(); |
| 103 |
| 104 void SendProtocolCommand(const std::string& method, |
| 105 base::DictionaryValue* params); |
101 | 106 |
102 private: | 107 private: |
103 friend class base::RefCounted<RemotePage>; | 108 friend class base::RefCounted<RemotePage>; |
104 virtual ~RemotePage(); | 109 virtual ~RemotePage(); |
105 | 110 |
106 scoped_refptr<DevToolsAdbBridge> bridge_; | 111 scoped_refptr<DevToolsAdbBridge> bridge_; |
107 scoped_refptr<AndroidDevice> device_; | 112 scoped_refptr<AndroidDevice> device_; |
108 std::string socket_; | 113 std::string socket_; |
109 std::string id_; | 114 std::string id_; |
110 std::string url_; | 115 std::string url_; |
111 std::string title_; | 116 std::string title_; |
112 std::string description_; | 117 std::string description_; |
113 std::string favicon_url_; | 118 std::string favicon_url_; |
114 std::string debug_url_; | 119 std::string debug_url_; |
115 std::string frontend_url_; | 120 std::string frontend_url_; |
116 std::string global_id_; | |
117 DISALLOW_COPY_AND_ASSIGN(RemotePage); | 121 DISALLOW_COPY_AND_ASSIGN(RemotePage); |
118 }; | 122 }; |
119 | 123 |
120 typedef std::vector<scoped_refptr<RemotePage> > RemotePages; | 124 typedef std::vector<scoped_refptr<RemotePage> > RemotePages; |
121 | 125 |
122 class RemoteBrowser : public base::RefCounted<RemoteBrowser> { | 126 class RemoteBrowser : public base::RefCounted<RemoteBrowser> { |
123 public: | 127 public: |
124 RemoteBrowser(scoped_refptr<DevToolsAdbBridge> bridge, | 128 RemoteBrowser(scoped_refptr<DevToolsAdbBridge> bridge, |
125 scoped_refptr<AndroidDevice> device, | 129 scoped_refptr<AndroidDevice> device, |
126 const std::string& socket, | 130 const std::string& socket, |
127 const std::string& name); | 131 const std::string& name); |
128 | 132 |
129 scoped_refptr<AndroidDevice> device() { return device_; } | 133 scoped_refptr<AndroidDevice> device() { return device_; } |
130 std::string socket() { return socket_; } | 134 std::string socket() { return socket_; } |
131 std::string name() { return name_; } | 135 std::string name() { return name_; } |
132 | 136 |
133 RemotePages& pages() { return pages_; } | 137 RemotePages& pages() { return pages_; } |
134 void AddPage(scoped_refptr<RemotePage> page) { pages_.push_back(page); } | 138 void AddPage(scoped_refptr<RemotePage> page) { pages_.push_back(page); } |
135 | 139 |
| 140 void Open(const std::string& url); |
| 141 |
136 private: | 142 private: |
137 friend class base::RefCounted<RemoteBrowser>; | 143 friend class base::RefCounted<RemoteBrowser>; |
138 virtual ~RemoteBrowser(); | 144 virtual ~RemoteBrowser(); |
139 | 145 |
| 146 void PageCreatedOnHandlerThread( |
| 147 const std::string& url, int result, const std::string& response); |
| 148 |
| 149 void PageCreatedOnUIThread( |
| 150 const std::string& response, const std::string& url); |
| 151 |
140 scoped_refptr<DevToolsAdbBridge> bridge_; | 152 scoped_refptr<DevToolsAdbBridge> bridge_; |
141 scoped_refptr<AndroidDevice> device_; | 153 scoped_refptr<AndroidDevice> device_; |
142 const std::string socket_; | 154 const std::string socket_; |
143 const std::string name_; | 155 const std::string name_; |
144 RemotePages pages_; | 156 RemotePages pages_; |
145 | 157 |
146 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); | 158 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); |
147 }; | 159 }; |
148 | 160 |
149 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; | 161 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; |
(...skipping 26 matching lines...) Expand all Loading... |
176 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; | 188 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; |
177 | 189 |
178 class AndroidDevice : public base::RefCounted<AndroidDevice> { | 190 class AndroidDevice : public base::RefCounted<AndroidDevice> { |
179 public: | 191 public: |
180 explicit AndroidDevice(const std::string& serial); | 192 explicit AndroidDevice(const std::string& serial); |
181 | 193 |
182 virtual void RunCommand(const std::string& command, | 194 virtual void RunCommand(const std::string& command, |
183 const CommandCallback& callback) = 0; | 195 const CommandCallback& callback) = 0; |
184 virtual void OpenSocket(const std::string& socket_name, | 196 virtual void OpenSocket(const std::string& socket_name, |
185 const SocketCallback& callback) = 0; | 197 const SocketCallback& callback) = 0; |
186 virtual void HttpQuery(const std::string& la_name, | 198 void HttpQuery(const std::string& la_name, |
187 const std::string& request, | 199 const std::string& request, |
188 const CommandCallback& callback); | 200 const CommandCallback& callback); |
189 virtual void HttpQuery(const std::string& la_name, | 201 void HttpUpgrade(const std::string& la_name, |
190 const std::string& request, | 202 const std::string& request, |
191 const SocketCallback& callback); | 203 const SocketCallback& callback); |
192 | 204 |
193 std::string serial() { return serial_; } | 205 std::string serial() { return serial_; } |
194 | 206 |
195 std::string model() { return model_; } | 207 std::string model() { return model_; } |
196 void set_model(const std::string& model) { model_ = model; } | 208 void set_model(const std::string& model) { model_ = model; } |
197 | 209 |
198 protected: | 210 protected: |
199 friend class base::RefCounted<AndroidDevice>; | 211 friend class base::RefCounted<AndroidDevice>; |
200 virtual ~AndroidDevice(); | 212 virtual ~AndroidDevice(); |
201 | 213 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 scoped_refptr<RefCountedAdbThread> adb_thread_; | 281 scoped_refptr<RefCountedAdbThread> adb_thread_; |
270 bool has_message_loop_; | 282 bool has_message_loop_; |
271 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; | 283 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; |
272 typedef std::vector<Listener*> Listeners; | 284 typedef std::vector<Listener*> Listeners; |
273 Listeners listeners_; | 285 Listeners listeners_; |
274 scoped_ptr<PortForwardingController> port_forwarding_controller_; | 286 scoped_ptr<PortForwardingController> port_forwarding_controller_; |
275 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); | 287 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); |
276 }; | 288 }; |
277 | 289 |
278 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 290 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
OLD | NEW |