| 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 | 8 |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 52 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
| 53 result->SetInteger("id", id); | 53 result->SetInteger("id", id); |
| 54 result->Set("result", std::move(cmd_result)); | 54 result->Set("result", std::move(cmd_result)); |
| 55 return result.release(); | 55 return result.release(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 std::unique_ptr<base::Value> HeadlessDevToolsManagerDelegate::CreateTarget( | 58 std::unique_ptr<base::Value> HeadlessDevToolsManagerDelegate::CreateTarget( |
| 59 const base::DictionaryValue* params) { | 59 const base::DictionaryValue* params) { |
| 60 std::string url; | 60 std::string url; |
| 61 std::string browser_context_id; | 61 std::string browser_context_id; |
| 62 int width = 800; | 62 int width = browser_->options()->window_size.width(); |
| 63 int height = 600; | 63 int height = browser_->options()->window_size.height(); |
| 64 params->GetString("url", &url); | 64 params->GetString("url", &url); |
| 65 params->GetString("browserContextId", &browser_context_id); | 65 params->GetString("browserContextId", &browser_context_id); |
| 66 params->GetInteger("width", &width); | 66 params->GetInteger("width", &width); |
| 67 params->GetInteger("height", &height); | 67 params->GetInteger("height", &height); |
| 68 HeadlessWebContentsImpl* web_contents_impl; | 68 HeadlessWebContentsImpl* web_contents_impl; |
| 69 auto find_it = browser_context_map_.find(browser_context_id); | 69 auto find_it = browser_context_map_.find(browser_context_id); |
| 70 if (find_it != browser_context_map_.end()) { | 70 if (find_it != browser_context_map_.end()) { |
| 71 web_contents_impl = HeadlessWebContentsImpl::From( | 71 web_contents_impl = HeadlessWebContentsImpl::From( |
| 72 browser_->CreateWebContentsBuilder() | 72 browser_->CreateWebContentsBuilder() |
| 73 .SetInitialURL(GURL(url)) | 73 .SetInitialURL(GURL(url)) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (success) | 145 if (success) |
| 146 browser_context_map_.erase(find_it); | 146 browser_context_map_.erase(find_it); |
| 147 } | 147 } |
| 148 return browser::DisposeBrowserContextResult::Builder() | 148 return browser::DisposeBrowserContextResult::Builder() |
| 149 .SetSuccess(success) | 149 .SetSuccess(success) |
| 150 .Build() | 150 .Build() |
| 151 ->Serialize(); | 151 ->Serialize(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace headless | 154 } // namespace headless |
| OLD | NEW |