| 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 ProfileIdentityProvider; |
| 41 class SigninManagerBase; |
| 42 class ProfileOAuth2TokenService; |
| 39 | 43 |
| 40 class DevToolsAndroidBridge : public KeyedService { | 44 class DevToolsAndroidBridge : public KeyedService { |
| 41 public: | 45 public: |
| 42 class Factory : public BrowserContextKeyedServiceFactory { | 46 class Factory : public BrowserContextKeyedServiceFactory { |
| 43 public: | 47 public: |
| 44 // Returns singleton instance of DevToolsAndroidBridge. | 48 // Returns singleton instance of DevToolsAndroidBridge. |
| 45 static Factory* GetInstance(); | 49 static Factory* GetInstance(); |
| 46 | 50 |
| 47 // Returns DevToolsAndroidBridge associated with |profile|. | 51 // Returns DevToolsAndroidBridge associated with |profile|. |
| 48 static DevToolsAndroidBridge* GetForProfile(Profile* profile); | 52 static DevToolsAndroidBridge* GetForProfile(Profile* profile); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 155 |
| 152 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; | 156 typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; |
| 153 | 157 |
| 154 class DeviceListListener { | 158 class DeviceListListener { |
| 155 public: | 159 public: |
| 156 virtual void DeviceListChanged(const RemoteDevices& devices) = 0; | 160 virtual void DeviceListChanged(const RemoteDevices& devices) = 0; |
| 157 protected: | 161 protected: |
| 158 virtual ~DeviceListListener() {} | 162 virtual ~DeviceListListener() {} |
| 159 }; | 163 }; |
| 160 | 164 |
| 161 explicit DevToolsAndroidBridge(Profile* profile); | 165 DevToolsAndroidBridge(Profile* profile, |
| 166 SigninManagerBase* signin_manager, |
| 167 ProfileOAuth2TokenService* token_service); |
| 162 void AddDeviceListListener(DeviceListListener* listener); | 168 void AddDeviceListListener(DeviceListListener* listener); |
| 163 void RemoveDeviceListListener(DeviceListListener* listener); | 169 void RemoveDeviceListListener(DeviceListListener* listener); |
| 164 | 170 |
| 165 class DeviceCountListener { | 171 class DeviceCountListener { |
| 166 public: | 172 public: |
| 167 virtual void DeviceCountChanged(int count) = 0; | 173 virtual void DeviceCountChanged(int count) = 0; |
| 168 protected: | 174 protected: |
| 169 virtual ~DeviceCountListener() {} | 175 virtual ~DeviceCountListener() {} |
| 170 }; | 176 }; |
| 171 | 177 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Creates new target instance owned by caller. | 213 // Creates new target instance owned by caller. |
| 208 DevToolsTargetImpl* CreatePageTarget(scoped_refptr<RemotePage> browser); | 214 DevToolsTargetImpl* CreatePageTarget(scoped_refptr<RemotePage> browser); |
| 209 | 215 |
| 210 typedef base::Callback<void(scoped_refptr<RemotePage>)> RemotePageCallback; | 216 typedef base::Callback<void(scoped_refptr<RemotePage>)> RemotePageCallback; |
| 211 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, | 217 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, |
| 212 const std::string& url, | 218 const std::string& url, |
| 213 const RemotePageCallback& callback); | 219 const RemotePageCallback& callback); |
| 214 | 220 |
| 215 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( | 221 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( |
| 216 scoped_refptr<RemoteBrowser> browser); | 222 scoped_refptr<RemoteBrowser> browser); |
| 223 |
| 217 private: | 224 private: |
| 218 friend struct content::BrowserThread::DeleteOnThread< | 225 friend struct content::BrowserThread::DeleteOnThread< |
| 219 content::BrowserThread::UI>; | 226 content::BrowserThread::UI>; |
| 220 friend class base::DeleteHelper<DevToolsAndroidBridge>; | 227 friend class base::DeleteHelper<DevToolsAndroidBridge>; |
| 221 | 228 |
| 222 friend class PortForwardingController; | 229 friend class PortForwardingController; |
| 223 | 230 |
| 224 class AgentHostDelegate; | 231 class AgentHostDelegate; |
| 225 class DiscoveryRequest; | 232 class DiscoveryRequest; |
| 226 class RemotePageTarget; | 233 class RemotePageTarget; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 void RespondToOpenOnUIThread(scoped_refptr<RemoteBrowser> browser, | 283 void RespondToOpenOnUIThread(scoped_refptr<RemoteBrowser> browser, |
| 277 const RemotePageCallback& callback, | 284 const RemotePageCallback& callback, |
| 278 int result, | 285 int result, |
| 279 const std::string& response); | 286 const std::string& response); |
| 280 | 287 |
| 281 base::WeakPtr<DevToolsAndroidBridge> AsWeakPtr() { | 288 base::WeakPtr<DevToolsAndroidBridge> AsWeakPtr() { |
| 282 return weak_factory_.GetWeakPtr(); | 289 return weak_factory_.GetWeakPtr(); |
| 283 } | 290 } |
| 284 | 291 |
| 285 Profile* profile_; | 292 Profile* profile_; |
| 293 scoped_ptr<ProfileIdentityProvider> identity_provider_; |
| 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 |