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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 std::string global_id() { return global_id_; } |
99 | 99 |
100 void Inspect(Profile* profile); | 100 void Inspect(Profile* profile); |
| 101 void Close(); |
| 102 void Reload(); |
| 103 |
| 104 void SendDebuggerCommand(const std::string& method, |
| 105 const 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_; |
(...skipping 11 matching lines...) Expand all Loading... |
122 class RemoteBrowser : public base::RefCounted<RemoteBrowser> { | 127 class RemoteBrowser : public base::RefCounted<RemoteBrowser> { |
123 public: | 128 public: |
124 RemoteBrowser(scoped_refptr<DevToolsAdbBridge> bridge, | 129 RemoteBrowser(scoped_refptr<DevToolsAdbBridge> bridge, |
125 scoped_refptr<AndroidDevice> device, | 130 scoped_refptr<AndroidDevice> device, |
126 const std::string& socket, | 131 const std::string& socket, |
127 const std::string& name); | 132 const std::string& name); |
128 | 133 |
129 scoped_refptr<AndroidDevice> device() { return device_; } | 134 scoped_refptr<AndroidDevice> device() { return device_; } |
130 std::string socket() { return socket_; } | 135 std::string socket() { return socket_; } |
131 std::string name() { return name_; } | 136 std::string name() { return name_; } |
| 137 std::string global_id() { return global_id_; } |
132 | 138 |
133 RemotePages& pages() { return pages_; } | 139 RemotePages& pages() { return pages_; } |
134 void AddPage(scoped_refptr<RemotePage> page) { pages_.push_back(page); } | 140 void AddPage(scoped_refptr<RemotePage> page) { pages_.push_back(page); } |
135 | 141 |
| 142 void Open(const std::string& url); |
| 143 |
136 private: | 144 private: |
137 friend class base::RefCounted<RemoteBrowser>; | 145 friend class base::RefCounted<RemoteBrowser>; |
138 virtual ~RemoteBrowser(); | 146 virtual ~RemoteBrowser(); |
139 | 147 |
| 148 void PageCreatedOnHandlerThread( |
| 149 const std::string& url, int result, const std::string& response); |
| 150 |
| 151 void PageCreatedOnUIThread( |
| 152 const std::string& response, const std::string& url); |
| 153 |
140 scoped_refptr<DevToolsAdbBridge> bridge_; | 154 scoped_refptr<DevToolsAdbBridge> bridge_; |
141 scoped_refptr<AndroidDevice> device_; | 155 scoped_refptr<AndroidDevice> device_; |
142 const std::string socket_; | 156 const std::string socket_; |
143 const std::string name_; | 157 const std::string name_; |
| 158 std::string global_id_; |
144 RemotePages pages_; | 159 RemotePages pages_; |
145 | 160 |
146 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); | 161 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); |
147 }; | 162 }; |
148 | 163 |
149 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; | 164 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; |
150 | 165 |
151 class RemoteDevice : public base::RefCounted<RemoteDevice> { | 166 class RemoteDevice : public base::RefCounted<RemoteDevice> { |
152 public: | 167 public: |
153 explicit RemoteDevice(scoped_refptr<DevToolsAdbBridge> bridge, | 168 explicit RemoteDevice(scoped_refptr<DevToolsAdbBridge> bridge, |
154 scoped_refptr<AndroidDevice> device); | 169 scoped_refptr<AndroidDevice> device); |
155 | 170 |
156 scoped_refptr<AndroidDevice> device() { return device_; } | 171 scoped_refptr<AndroidDevice> device() { return device_; } |
157 std::string serial() { return device_->serial(); } | 172 std::string serial() { return device_->serial(); } |
158 std::string model() { return device_->model(); } | 173 std::string model() { return device_->model(); } |
| 174 std::string global_id() { return global_id_; } |
159 | 175 |
160 RemoteBrowsers& browsers() { return browsers_; } | 176 RemoteBrowsers& browsers() { return browsers_; } |
161 void AddBrowser(scoped_refptr<RemoteBrowser> browser) { | 177 void AddBrowser(scoped_refptr<RemoteBrowser> browser) { |
162 browsers_.push_back(browser); | 178 browsers_.push_back(browser); |
163 } | 179 } |
164 | 180 |
165 private: | 181 private: |
166 friend class base::RefCounted<RemoteDevice>; | 182 friend class base::RefCounted<RemoteDevice>; |
167 virtual ~RemoteDevice(); | 183 virtual ~RemoteDevice(); |
168 | 184 |
169 scoped_refptr<DevToolsAdbBridge> bridge_; | 185 scoped_refptr<DevToolsAdbBridge> bridge_; |
170 scoped_refptr<AndroidDevice> device_; | 186 scoped_refptr<AndroidDevice> device_; |
| 187 std::string global_id_; |
171 RemoteBrowsers browsers_; | 188 RemoteBrowsers browsers_; |
172 | 189 |
173 DISALLOW_COPY_AND_ASSIGN(RemoteDevice); | 190 DISALLOW_COPY_AND_ASSIGN(RemoteDevice); |
174 }; | 191 }; |
175 | 192 |
176 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; | 193 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; |
177 | 194 |
178 class AndroidDevice : public base::RefCounted<AndroidDevice> { | 195 class AndroidDevice : public base::RefCounted<AndroidDevice> { |
179 public: | 196 public: |
180 explicit AndroidDevice(const std::string& serial); | 197 explicit AndroidDevice(const std::string& serial); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 scoped_refptr<RefCountedAdbThread> adb_thread_; | 286 scoped_refptr<RefCountedAdbThread> adb_thread_; |
270 bool has_message_loop_; | 287 bool has_message_loop_; |
271 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; | 288 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; |
272 typedef std::vector<Listener*> Listeners; | 289 typedef std::vector<Listener*> Listeners; |
273 Listeners listeners_; | 290 Listeners listeners_; |
274 scoped_ptr<PortForwardingController> port_forwarding_controller_; | 291 scoped_ptr<PortForwardingController> port_forwarding_controller_; |
275 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); | 292 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); |
276 }; | 293 }; |
277 | 294 |
278 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 295 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
OLD | NEW |