| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_manager_delegate.h" | 5 #include "headless/lib/browser/headless_devtools_manager_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 std::unique_ptr<base::Value> cmd_result(((this)->*command_fn_ptr)(params)); | 54 std::unique_ptr<base::Value> cmd_result(((this)->*command_fn_ptr)(params)); |
| 55 if (!cmd_result) | 55 if (!cmd_result) |
| 56 return nullptr; | 56 return nullptr; |
| 57 | 57 |
| 58 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 58 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
| 59 result->SetInteger("id", id); | 59 result->SetInteger("id", id); |
| 60 result->Set("result", std::move(cmd_result)); | 60 result->Set("result", std::move(cmd_result)); |
| 61 return result.release(); | 61 return result.release(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 std::string HeadlessDevToolsManagerDelegate::GetTargetType( |
| 65 contents::RenderFrameHost* host) { |
| 66 return DevToolsAgentHost::kTypePage; |
| 67 } |
| 68 |
| 64 std::unique_ptr<base::Value> HeadlessDevToolsManagerDelegate::CreateTarget( | 69 std::unique_ptr<base::Value> HeadlessDevToolsManagerDelegate::CreateTarget( |
| 65 const base::DictionaryValue* params) { | 70 const base::DictionaryValue* params) { |
| 66 std::string url; | 71 std::string url; |
| 67 std::string browser_context_id; | 72 std::string browser_context_id; |
| 68 int width = browser_->options()->window_size.width(); | 73 int width = browser_->options()->window_size.width(); |
| 69 int height = browser_->options()->window_size.height(); | 74 int height = browser_->options()->window_size.height(); |
| 70 params->GetString("url", &url); | 75 params->GetString("url", &url); |
| 71 params->GetString("browserContextId", &browser_context_id); | 76 params->GetString("browserContextId", &browser_context_id); |
| 72 params->GetInteger("width", &width); | 77 params->GetInteger("width", &width); |
| 73 params->GetInteger("height", &height); | 78 params->GetInteger("height", &height); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 context->Close(); | 149 context->Close(); |
| 145 } | 150 } |
| 146 | 151 |
| 147 return browser::DisposeBrowserContextResult::Builder() | 152 return browser::DisposeBrowserContextResult::Builder() |
| 148 .SetSuccess(success) | 153 .SetSuccess(success) |
| 149 .Build() | 154 .Build() |
| 150 ->Serialize(); | 155 ->Serialize(); |
| 151 } | 156 } |
| 152 | 157 |
| 153 } // namespace headless | 158 } // namespace headless |
| OLD | NEW |