Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: headless/lib/browser/headless_devtools_manager_delegate.cc

Issue 2263843002: DevTools: merge devtools target with devtools host, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 3 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/public/browser/devtools_agent_host.h"
11 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
12 #include "headless/lib/browser/headless_browser_context_impl.h" 13 #include "headless/lib/browser/headless_browser_context_impl.h"
13 #include "headless/lib/browser/headless_browser_impl.h" 14 #include "headless/lib/browser/headless_browser_impl.h"
14 #include "headless/lib/browser/headless_web_contents_impl.h" 15 #include "headless/lib/browser/headless_web_contents_impl.h"
15 #include "headless/public/domains/browser.h" 16 #include "headless/public/domains/browser.h"
16 17
17 namespace headless { 18 namespace headless {
18 19
19 HeadlessDevToolsManagerDelegate::HeadlessDevToolsManagerDelegate( 20 HeadlessDevToolsManagerDelegate::HeadlessDevToolsManagerDelegate(
20 base::WeakPtr<HeadlessBrowserImpl> browser) 21 base::WeakPtr<HeadlessBrowserImpl> browser)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 std::unique_ptr<base::Value> cmd_result(((this)->*command_fn_ptr)(params)); 55 std::unique_ptr<base::Value> cmd_result(((this)->*command_fn_ptr)(params));
55 if (!cmd_result) 56 if (!cmd_result)
56 return nullptr; 57 return nullptr;
57 58
58 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); 59 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
59 result->SetInteger("id", id); 60 result->SetInteger("id", id);
60 result->Set("result", std::move(cmd_result)); 61 result->Set("result", std::move(cmd_result));
61 return result.release(); 62 return result.release();
62 } 63 }
63 64
65 std::string HeadlessDevToolsManagerDelegate::GetTargetType(
66 content::RenderFrameHost* host) {
67 return content::DevToolsAgentHost::kTypePage;
68 }
69
70 std::string HeadlessDevToolsManagerDelegate::GetTargetTitle(
71 content::RenderFrameHost* host) {
72 return "";
73 }
74
64 std::unique_ptr<base::Value> HeadlessDevToolsManagerDelegate::CreateTarget( 75 std::unique_ptr<base::Value> HeadlessDevToolsManagerDelegate::CreateTarget(
65 const base::DictionaryValue* params) { 76 const base::DictionaryValue* params) {
66 std::string url; 77 std::string url;
67 std::string browser_context_id; 78 std::string browser_context_id;
68 int width = browser_->options()->window_size.width(); 79 int width = browser_->options()->window_size.width();
69 int height = browser_->options()->window_size.height(); 80 int height = browser_->options()->window_size.height();
70 params->GetString("url", &url); 81 params->GetString("url", &url);
71 params->GetString("browserContextId", &browser_context_id); 82 params->GetString("browserContextId", &browser_context_id);
72 params->GetInteger("width", &width); 83 params->GetInteger("width", &width);
73 params->GetInteger("height", &height); 84 params->GetInteger("height", &height);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 context->Close(); 155 context->Close();
145 } 156 }
146 157
147 return browser::DisposeBrowserContextResult::Builder() 158 return browser::DisposeBrowserContextResult::Builder()
148 .SetSuccess(success) 159 .SetSuccess(success)
149 .Build() 160 .Build()
150 ->Serialize(); 161 ->Serialize();
151 } 162 }
152 163
153 } // namespace headless 164 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698