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

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

Issue 22277007: chrome://inspect: Add "open", "close" and "reload" actions to Devices tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Addressed comments" Created 7 years, 4 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::string global_id() { return global_id_; }
99 bool attached() { return debug_url_.empty(); }
99 100
100 void Inspect(Profile* profile); 101 void Inspect(Profile* profile);
102 void Close();
103 void Reload();
104
105 void SendProtocolCommand(const std::string& method,
106 base::DictionaryValue* params);
101 107
102 private: 108 private:
103 friend class base::RefCounted<RemotePage>; 109 friend class base::RefCounted<RemotePage>;
104 virtual ~RemotePage(); 110 virtual ~RemotePage();
105 111
106 scoped_refptr<DevToolsAdbBridge> bridge_; 112 scoped_refptr<DevToolsAdbBridge> bridge_;
107 scoped_refptr<AndroidDevice> device_; 113 scoped_refptr<AndroidDevice> device_;
108 std::string socket_; 114 std::string socket_;
109 std::string id_; 115 std::string id_;
110 std::string url_; 116 std::string url_;
(...skipping 11 matching lines...) Expand all
122 class RemoteBrowser : public base::RefCounted<RemoteBrowser> { 128 class RemoteBrowser : public base::RefCounted<RemoteBrowser> {
123 public: 129 public:
124 RemoteBrowser(scoped_refptr<DevToolsAdbBridge> bridge, 130 RemoteBrowser(scoped_refptr<DevToolsAdbBridge> bridge,
125 scoped_refptr<AndroidDevice> device, 131 scoped_refptr<AndroidDevice> device,
126 const std::string& socket, 132 const std::string& socket,
127 const std::string& name); 133 const std::string& name);
128 134
129 scoped_refptr<AndroidDevice> device() { return device_; } 135 scoped_refptr<AndroidDevice> device() { return device_; }
130 std::string socket() { return socket_; } 136 std::string socket() { return socket_; }
131 std::string name() { return name_; } 137 std::string name() { return name_; }
138 std::string global_id() { return global_id_; }
pfeldman 2013/08/07 09:48:12 It belongs to the client.
Vladislav Kaznacheev 2013/08/07 12:11:05 Done.
132 139
133 RemotePages& pages() { return pages_; } 140 RemotePages& pages() { return pages_; }
134 void AddPage(scoped_refptr<RemotePage> page) { pages_.push_back(page); } 141 void AddPage(scoped_refptr<RemotePage> page) { pages_.push_back(page); }
135 142
143 void Open(const std::string& url);
144
136 private: 145 private:
137 friend class base::RefCounted<RemoteBrowser>; 146 friend class base::RefCounted<RemoteBrowser>;
138 virtual ~RemoteBrowser(); 147 virtual ~RemoteBrowser();
139 148
149 void PageCreatedOnHandlerThread(
150 const std::string& url, int result, const std::string& response);
151
152 void PageCreatedOnUIThread(
153 const std::string& response, const std::string& url);
154
140 scoped_refptr<DevToolsAdbBridge> bridge_; 155 scoped_refptr<DevToolsAdbBridge> bridge_;
141 scoped_refptr<AndroidDevice> device_; 156 scoped_refptr<AndroidDevice> device_;
142 const std::string socket_; 157 const std::string socket_;
143 const std::string name_; 158 const std::string name_;
159 std::string global_id_;
144 RemotePages pages_; 160 RemotePages pages_;
145 161
146 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser); 162 DISALLOW_COPY_AND_ASSIGN(RemoteBrowser);
147 }; 163 };
148 164
149 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers; 165 typedef std::vector<scoped_refptr<RemoteBrowser> > RemoteBrowsers;
150 166
151 class RemoteDevice : public base::RefCounted<RemoteDevice> { 167 class RemoteDevice : public base::RefCounted<RemoteDevice> {
152 public: 168 public:
153 explicit RemoteDevice(scoped_refptr<DevToolsAdbBridge> bridge, 169 explicit RemoteDevice(scoped_refptr<DevToolsAdbBridge> bridge,
154 scoped_refptr<AndroidDevice> device); 170 scoped_refptr<AndroidDevice> device);
155 171
156 scoped_refptr<AndroidDevice> device() { return device_; } 172 scoped_refptr<AndroidDevice> device() { return device_; }
157 std::string serial() { return device_->serial(); } 173 std::string serial() { return device_->serial(); }
158 std::string model() { return device_->model(); } 174 std::string model() { return device_->model(); }
175 std::string global_id() { return global_id_; }
159 176
160 RemoteBrowsers& browsers() { return browsers_; } 177 RemoteBrowsers& browsers() { return browsers_; }
161 void AddBrowser(scoped_refptr<RemoteBrowser> browser) { 178 void AddBrowser(scoped_refptr<RemoteBrowser> browser) {
162 browsers_.push_back(browser); 179 browsers_.push_back(browser);
163 } 180 }
164 181
165 private: 182 private:
166 friend class base::RefCounted<RemoteDevice>; 183 friend class base::RefCounted<RemoteDevice>;
167 virtual ~RemoteDevice(); 184 virtual ~RemoteDevice();
168 185
169 scoped_refptr<DevToolsAdbBridge> bridge_; 186 scoped_refptr<DevToolsAdbBridge> bridge_;
170 scoped_refptr<AndroidDevice> device_; 187 scoped_refptr<AndroidDevice> device_;
188 std::string global_id_;
171 RemoteBrowsers browsers_; 189 RemoteBrowsers browsers_;
172 190
173 DISALLOW_COPY_AND_ASSIGN(RemoteDevice); 191 DISALLOW_COPY_AND_ASSIGN(RemoteDevice);
174 }; 192 };
175 193
176 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; 194 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices;
177 195
178 class AndroidDevice : public base::RefCounted<AndroidDevice> { 196 class AndroidDevice : public base::RefCounted<AndroidDevice> {
179 public: 197 public:
180 explicit AndroidDevice(const std::string& serial); 198 explicit AndroidDevice(const std::string& serial);
181 199
182 virtual void RunCommand(const std::string& command, 200 virtual void RunCommand(const std::string& command,
183 const CommandCallback& callback) = 0; 201 const CommandCallback& callback) = 0;
184 virtual void OpenSocket(const std::string& socket_name, 202 virtual void OpenSocket(const std::string& socket_name,
185 const SocketCallback& callback) = 0; 203 const SocketCallback& callback) = 0;
186 virtual void HttpQuery(const std::string& la_name, 204 void HttpQuery(const std::string& la_name,
187 const std::string& request, 205 const std::string& request,
188 const CommandCallback& callback); 206 const CommandCallback& callback);
189 virtual void HttpQuery(const std::string& la_name, 207 void HttpConnect(const std::string& la_name,
190 const std::string& request, 208 const std::string& request,
191 const SocketCallback& callback); 209 const SocketCallback& callback);
192 210
193 std::string serial() { return serial_; } 211 std::string serial() { return serial_; }
194 212
195 std::string model() { return model_; } 213 std::string model() { return model_; }
196 void set_model(const std::string& model) { model_ = model; } 214 void set_model(const std::string& model) { model_ = model; }
197 215
198 protected: 216 protected:
199 friend class base::RefCounted<AndroidDevice>; 217 friend class base::RefCounted<AndroidDevice>;
200 virtual ~AndroidDevice(); 218 virtual ~AndroidDevice();
201 219
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 scoped_refptr<RefCountedAdbThread> adb_thread_; 287 scoped_refptr<RefCountedAdbThread> adb_thread_;
270 bool has_message_loop_; 288 bool has_message_loop_;
271 scoped_ptr<crypto::RSAPrivateKey> rsa_key_; 289 scoped_ptr<crypto::RSAPrivateKey> rsa_key_;
272 typedef std::vector<Listener*> Listeners; 290 typedef std::vector<Listener*> Listeners;
273 Listeners listeners_; 291 Listeners listeners_;
274 scoped_ptr<PortForwardingController> port_forwarding_controller_; 292 scoped_ptr<PortForwardingController> port_forwarding_controller_;
275 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); 293 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge);
276 }; 294 };
277 295
278 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ 296 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698