OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 class Thread; | 29 class Thread; |
30 } | 30 } |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 class BrowserContext; | 33 class BrowserContext; |
34 } | 34 } |
35 | 35 |
36 class DevToolsTargetImpl; | 36 class DevToolsTargetImpl; |
37 class PortForwardingController; | 37 class PortForwardingController; |
38 class Profile; | 38 class Profile; |
| 39 class WebRTCDeviceProvider; |
| 40 class SigninManagerBase; |
| 41 class ProfileOAuth2TokenService; |
39 | 42 |
40 class DevToolsAndroidBridge : public KeyedService { | 43 class DevToolsAndroidBridge : public KeyedService { |
41 public: | 44 public: |
42 class Factory : public BrowserContextKeyedServiceFactory { | 45 class Factory : public BrowserContextKeyedServiceFactory { |
43 public: | 46 public: |
44 // Returns singleton instance of DevToolsAndroidBridge. | 47 // Returns singleton instance of DevToolsAndroidBridge. |
45 static Factory* GetInstance(); | 48 static Factory* GetInstance(); |
46 | 49 |
47 // Returns DevToolsAndroidBridge associated with |profile|. | 50 // Returns DevToolsAndroidBridge associated with |profile|. |
48 static DevToolsAndroidBridge* GetForProfile(Profile* profile); | 51 static DevToolsAndroidBridge* GetForProfile(Profile* profile); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 154 |
152 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; | 155 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; |
153 | 156 |
154 class DeviceListListener { | 157 class DeviceListListener { |
155 public: | 158 public: |
156 virtual void DeviceListChanged(const RemoteDevices& devices) = 0; | 159 virtual void DeviceListChanged(const RemoteDevices& devices) = 0; |
157 protected: | 160 protected: |
158 virtual ~DeviceListListener() {} | 161 virtual ~DeviceListListener() {} |
159 }; | 162 }; |
160 | 163 |
161 explicit DevToolsAndroidBridge(Profile* profile); | 164 DevToolsAndroidBridge(Profile* profile, |
| 165 SigninManagerBase* signin_manager, |
| 166 ProfileOAuth2TokenService* token_service); |
162 void AddDeviceListListener(DeviceListListener* listener); | 167 void AddDeviceListListener(DeviceListListener* listener); |
163 void RemoveDeviceListListener(DeviceListListener* listener); | 168 void RemoveDeviceListListener(DeviceListListener* listener); |
164 | 169 |
165 class DeviceCountListener { | 170 class DeviceCountListener { |
166 public: | 171 public: |
167 virtual void DeviceCountChanged(int count) = 0; | 172 virtual void DeviceCountChanged(int count) = 0; |
168 protected: | 173 protected: |
169 virtual ~DeviceCountListener() {} | 174 virtual ~DeviceCountListener() {} |
170 }; | 175 }; |
171 | 176 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Creates new target instance owned by caller. | 212 // Creates new target instance owned by caller. |
208 DevToolsTargetImpl* CreatePageTarget(scoped_refptr<RemotePage> browser); | 213 DevToolsTargetImpl* CreatePageTarget(scoped_refptr<RemotePage> browser); |
209 | 214 |
210 typedef base::Callback<void(scoped_refptr<RemotePage>)> RemotePageCallback; | 215 typedef base::Callback<void(scoped_refptr<RemotePage>)> RemotePageCallback; |
211 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, | 216 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, |
212 const std::string& url, | 217 const std::string& url, |
213 const RemotePageCallback& callback); | 218 const RemotePageCallback& callback); |
214 | 219 |
215 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( | 220 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( |
216 scoped_refptr<RemoteBrowser> browser); | 221 scoped_refptr<RemoteBrowser> browser); |
| 222 |
217 private: | 223 private: |
218 friend struct content::BrowserThread::DeleteOnThread< | 224 friend struct content::BrowserThread::DeleteOnThread< |
219 content::BrowserThread::UI>; | 225 content::BrowserThread::UI>; |
220 friend class base::DeleteHelper<DevToolsAndroidBridge>; | 226 friend class base::DeleteHelper<DevToolsAndroidBridge>; |
221 | 227 |
222 friend class PortForwardingController; | 228 friend class PortForwardingController; |
223 | 229 |
224 class AgentHostDelegate; | 230 class AgentHostDelegate; |
225 class DiscoveryRequest; | 231 class DiscoveryRequest; |
226 class RemotePageTarget; | 232 class RemotePageTarget; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 281 |
276 void RespondToOpenOnUIThread(scoped_refptr<RemoteBrowser> browser, | 282 void RespondToOpenOnUIThread(scoped_refptr<RemoteBrowser> browser, |
277 const RemotePageCallback& callback, | 283 const RemotePageCallback& callback, |
278 int result, | 284 int result, |
279 const std::string& response); | 285 const std::string& response); |
280 | 286 |
281 base::WeakPtr<DevToolsAndroidBridge> AsWeakPtr() { | 287 base::WeakPtr<DevToolsAndroidBridge> AsWeakPtr() { |
282 return weak_factory_.GetWeakPtr(); | 288 return weak_factory_.GetWeakPtr(); |
283 } | 289 } |
284 | 290 |
285 Profile* profile_; | 291 Profile* const profile_; |
| 292 SigninManagerBase* const signin_manager_; |
| 293 ProfileOAuth2TokenService* const token_service_; |
286 const scoped_ptr<AndroidDeviceManager> device_manager_; | 294 const scoped_ptr<AndroidDeviceManager> device_manager_; |
287 | 295 |
288 typedef std::map<std::string, scoped_refptr<AndroidDeviceManager::Device>> | 296 typedef std::map<std::string, scoped_refptr<AndroidDeviceManager::Device>> |
289 DeviceMap; | 297 DeviceMap; |
290 DeviceMap device_map_; | 298 DeviceMap device_map_; |
291 | 299 |
292 typedef std::map<std::string, AgentHostDelegate*> AgentHostDelegates; | 300 typedef std::map<std::string, AgentHostDelegate*> AgentHostDelegates; |
293 AgentHostDelegates host_delegates_; | 301 AgentHostDelegates host_delegates_; |
294 | 302 |
295 typedef std::vector<DeviceListListener*> DeviceListListeners; | 303 typedef std::vector<DeviceListListener*> DeviceListListeners; |
(...skipping 10 matching lines...) Expand all Loading... |
306 scoped_ptr<PortForwardingController> port_forwarding_controller_; | 314 scoped_ptr<PortForwardingController> port_forwarding_controller_; |
307 | 315 |
308 PrefChangeRegistrar pref_change_registrar_; | 316 PrefChangeRegistrar pref_change_registrar_; |
309 | 317 |
310 base::WeakPtrFactory<DevToolsAndroidBridge> weak_factory_; | 318 base::WeakPtrFactory<DevToolsAndroidBridge> weak_factory_; |
311 | 319 |
312 DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge); | 320 DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge); |
313 }; | 321 }; |
314 | 322 |
315 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ | 323 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
OLD | NEW |