| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "android_webview/native/aw_dev_tools_server.h" | 5 #include "android_webview/native/aw_dev_tools_server.h" |
| 6 | 6 |
| 7 #include "android_webview/native/aw_contents.h" | 7 #include "android_webview/native/aw_contents.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 const int kBackLog = 10; | 36 const int kBackLog = 10; |
| 37 | 37 |
| 38 // Delegate implementation for the devtools http handler for WebView. A new | 38 // Delegate implementation for the devtools http handler for WebView. A new |
| 39 // instance of this gets created each time web debugging is enabled. | 39 // instance of this gets created each time web debugging is enabled. |
| 40 class AwDevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate { | 40 class AwDevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate { |
| 41 public: | 41 public: |
| 42 AwDevToolsServerDelegate() { | 42 AwDevToolsServerDelegate() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~AwDevToolsServerDelegate() {} | 45 ~AwDevToolsServerDelegate() override {} |
| 46 | 46 |
| 47 // DevToolsHttpProtocolHandler::Delegate overrides. | 47 // DevToolsHttpProtocolHandler::Delegate overrides. |
| 48 std::string GetDiscoveryPageHTML() override; | 48 std::string GetDiscoveryPageHTML() override; |
| 49 | 49 |
| 50 bool BundlesFrontendResources() override { | 50 bool BundlesFrontendResources() override { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 base::FilePath GetDebugFrontendDir() override { | 54 base::FilePath GetDebugFrontendDir() override { |
| 55 return base::FilePath(); | 55 return base::FilePath(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 class UnixDomainServerSocketFactory | 74 class UnixDomainServerSocketFactory |
| 75 : public content::DevToolsHttpHandler::ServerSocketFactory { | 75 : public content::DevToolsHttpHandler::ServerSocketFactory { |
| 76 public: | 76 public: |
| 77 explicit UnixDomainServerSocketFactory(const std::string& socket_name) | 77 explicit UnixDomainServerSocketFactory(const std::string& socket_name) |
| 78 : socket_name_(socket_name), | 78 : socket_name_(socket_name), |
| 79 last_tethering_socket_(0) { | 79 last_tethering_socket_(0) { |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // content::DevToolsHttpHandler::ServerSocketFactory. | 83 // content::DevToolsHttpHandler::ServerSocketFactory. |
| 84 virtual scoped_ptr<net::ServerSocket> CreateForHttpServer() override { | 84 scoped_ptr<net::ServerSocket> CreateForHttpServer() override { |
| 85 scoped_ptr<net::ServerSocket> socket( | 85 scoped_ptr<net::ServerSocket> socket( |
| 86 new net::UnixDomainServerSocket( | 86 new net::UnixDomainServerSocket( |
| 87 base::Bind(&content::CanUserConnectToDevTools), | 87 base::Bind(&content::CanUserConnectToDevTools), |
| 88 true /* use_abstract_namespace */)); | 88 true /* use_abstract_namespace */)); |
| 89 if (socket->ListenWithAddressAndPort(socket_name_, 0, kBackLog) != net::OK) | 89 if (socket->ListenWithAddressAndPort(socket_name_, 0, kBackLog) != net::OK) |
| 90 return scoped_ptr<net::ServerSocket>(); | 90 return scoped_ptr<net::ServerSocket>(); |
| 91 | 91 |
| 92 return socket; | 92 return socket; |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 AwDevToolsServer* devtools_server = | 164 AwDevToolsServer* devtools_server = |
| 165 reinterpret_cast<AwDevToolsServer*>(server); | 165 reinterpret_cast<AwDevToolsServer*>(server); |
| 166 if (enabled) { | 166 if (enabled) { |
| 167 devtools_server->Start(); | 167 devtools_server->Start(); |
| 168 } else { | 168 } else { |
| 169 devtools_server->Stop(); | 169 devtools_server->Stop(); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace android_webview | 173 } // namespace android_webview |
| OLD | NEW |