| 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 COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ | 5 #ifndef COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ |
| 6 #define COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ | 6 #define COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 9 | 12 |
| 10 namespace content { | 13 namespace content { |
| 11 class BrowserContext; | 14 class BrowserContext; |
| 12 } | 15 } |
| 13 | 16 |
| 14 namespace devtools_bridge { | 17 namespace devtools_bridge { |
| 15 | 18 |
| 16 /** | 19 /** |
| 17 * Client for DevTools Bridge for desktop Chrome. Uses WebContents to host | 20 * Client for DevTools Bridge for desktop Chrome. Uses WebContents to host |
| 18 * JavaScript implementation (therefore lives on the UI thread and must be | 21 * JavaScript implementation (therefore lives on the UI thread and must be |
| 19 * destroyed before |context|). WebContents works as a sandbox for WebRTC | 22 * destroyed before |context|). WebContents works as a sandbox for WebRTC |
| 20 * related code. | 23 * related code. |
| 21 */ | 24 */ |
| 22 class WebClient { | 25 class WebClient { |
| 23 public: | 26 public: |
| 27 typedef base::Callback<void (const std::string& respose)> |
| 28 CommandSuccessCallback; |
| 29 typedef base::Closure CommandFailureCallback; |
| 30 |
| 24 class Delegate { | 31 class Delegate { |
| 25 public: | 32 public: |
| 26 | 33 |
| 27 // TODO(serya): implement | 34 virtual void SendCommand(const std::string& command, |
| 35 const CommandSuccessCallback& sucess_callback, |
| 36 const CommandFailureCallback& failure_callback) {} |
| 28 }; | 37 }; |
| 29 | 38 |
| 30 virtual ~WebClient() {} | 39 virtual ~WebClient() {} |
| 31 | 40 |
| 32 static scoped_ptr<WebClient> CreateInstance( | 41 static scoped_ptr<WebClient> CreateInstance( |
| 33 content::BrowserContext* context, Delegate* delegate); | 42 content::BrowserContext* context, Delegate* delegate); |
| 34 | 43 |
| 44 virtual void Connect(const std::string& device_id) = 0; |
| 45 virtual void Disconnect(const std::string& device_id) = 0; |
| 46 virtual void DisconnectAll() = 0; |
| 47 |
| 35 // TODO(serya): Implement. | 48 // TODO(serya): Implement. |
| 36 | 49 |
| 37 protected: | 50 protected: |
| 38 WebClient() {} | 51 WebClient() {} |
| 39 | 52 |
| 40 private: | 53 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(WebClient); | 54 DISALLOW_COPY_AND_ASSIGN(WebClient); |
| 42 }; | 55 }; |
| 43 | 56 |
| 44 } // namespace devtools_bridge | 57 } // namespace devtools_bridge |
| 45 | 58 |
| 46 #endif // COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ | 59 #endif // COMPONENTS_DEVTOOLS_BRIDGE_CLIENT_WEB_CLIENT_H_ |
| OLD | NEW |