| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "headless/lib/browser/headless_devtools.h" | 5 #include "headless/lib/browser/headless_devtools.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "components/devtools_http_handler/devtools_http_handler.h" | 8 #include "components/devtools_http_handler/devtools_http_handler.h" |
| 9 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" | 9 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 #include "content/public/browser/devtools_frontend_host.h" | 11 #include "content/public/browser/devtools_frontend_host.h" |
| 12 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
| 13 #include "headless/grit/headless_lib_resources.h" |
| 13 #include "headless/lib/browser/headless_browser_context.h" | 14 #include "headless/lib/browser/headless_browser_context.h" |
| 14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 15 #include "net/socket/tcp_server_socket.h" | 16 #include "net/socket/tcp_server_socket.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 17 | 18 |
| 18 using devtools_http_handler::DevToolsHttpHandler; | 19 using devtools_http_handler::DevToolsHttpHandler; |
| 19 | 20 |
| 20 namespace headless { | 21 namespace headless { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(HeadlessDevToolsDelegate); | 64 DISALLOW_COPY_AND_ASSIGN(HeadlessDevToolsDelegate); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 HeadlessDevToolsDelegate::HeadlessDevToolsDelegate() {} | 67 HeadlessDevToolsDelegate::HeadlessDevToolsDelegate() {} |
| 67 | 68 |
| 68 HeadlessDevToolsDelegate::~HeadlessDevToolsDelegate() {} | 69 HeadlessDevToolsDelegate::~HeadlessDevToolsDelegate() {} |
| 69 | 70 |
| 70 std::string HeadlessDevToolsDelegate::GetDiscoveryPageHTML() { | 71 std::string HeadlessDevToolsDelegate::GetDiscoveryPageHTML() { |
| 71 return std::string(); | 72 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 73 IDR_HEADLESS_LIB_DEVTOOLS_DISCOVERY_PAGE).as_string(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 std::string HeadlessDevToolsDelegate::GetFrontendResource( | 76 std::string HeadlessDevToolsDelegate::GetFrontendResource( |
| 75 const std::string& path) { | 77 const std::string& path) { |
| 76 return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); | 78 return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 std::string HeadlessDevToolsDelegate::GetPageThumbnailData(const GURL& url) { | 81 std::string HeadlessDevToolsDelegate::GetPageThumbnailData(const GURL& url) { |
| 80 return std::string(); | 82 return std::string(); |
| 81 } | 83 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 93 browser_context->options().devtools_endpoint; | 95 browser_context->options().devtools_endpoint; |
| 94 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> socket_factory( | 96 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> socket_factory( |
| 95 new TCPServerSocketFactory(endpoint)); | 97 new TCPServerSocketFactory(endpoint)); |
| 96 return make_scoped_ptr(new DevToolsHttpHandler( | 98 return make_scoped_ptr(new DevToolsHttpHandler( |
| 97 std::move(socket_factory), std::string(), new HeadlessDevToolsDelegate(), | 99 std::move(socket_factory), std::string(), new HeadlessDevToolsDelegate(), |
| 98 browser_context->GetPath(), base::FilePath(), std::string(), | 100 browser_context->GetPath(), base::FilePath(), std::string(), |
| 99 browser_context->options().user_agent)); | 101 browser_context->options().user_agent)); |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace headless | 104 } // namespace headless |
| OLD | NEW |