1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/devtools/protocol/dom_handler.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/child_process_security_policy_impl.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h"
15 typedef DevToolsProtocolClient::Response Response;
17 DOMHandler::DOMHandler() : host_(nullptr) {
20 DOMHandler::~DOMHandler() {
23 void DOMHandler::SetRenderViewHost(RenderViewHostImpl* host) {
27 Response DOMHandler::SetFileInputFiles(NodeId node_id,
28 const std::vector<std::string>& files) {
30 for (const auto& file : files) {
32 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
33 host_->GetProcess()->GetID(),
34 base::FilePath(base::UTF8ToUTF16(file)));
36 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
37 host_->GetProcess()->GetID(),
38 base::FilePath(file));
42 return Response::FallThrough();
46 } // namespace devtools
47 } // namespace content