[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / devtools / protocol / dom_handler.cc
blob0022c2ec8001134d38174a7fe13b051123cdfbe6
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/frame_host/render_frame_host_impl.h"
11 namespace content {
12 namespace devtools {
13 namespace dom {
15 typedef DevToolsProtocolClient::Response Response;
17 DOMHandler::DOMHandler() : host_(nullptr) {
20 DOMHandler::~DOMHandler() {
23 void DOMHandler::SetRenderFrameHost(RenderFrameHostImpl* host) {
24 host_ = host;
27 Response DOMHandler::SetFileInputFiles(NodeId node_id,
28 const std::vector<std::string>& files) {
29 if (host_) {
30 for (const auto& file : files) {
31 #if defined(OS_WIN)
32 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
33 host_->GetProcess()->GetID(),
34 base::FilePath(base::UTF8ToUTF16(file)));
35 #else
36 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
37 host_->GetProcess()->GetID(),
38 base::FilePath(file));
39 #endif // OS_WIN
42 return Response::FallThrough();
45 } // namespace dom
46 } // namespace devtools
47 } // namespace content