Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/devtools/protocol/dom_handler.h" | 5 #include "content/browser/devtools/protocol/dom_handler.h" |
| 6 | 6 |
| 7 #include "content/browser/child_process_security_policy_impl.h" | |
| 8 #include "content/browser/renderer_host/render_view_host_impl.h" | |
| 9 | |
| 7 namespace content { | 10 namespace content { |
| 8 namespace devtools { | 11 namespace devtools { |
| 9 namespace dom { | 12 namespace dom { |
| 10 | 13 |
| 11 typedef DevToolsProtocolClient::Response Response; | 14 typedef DevToolsProtocolClient::Response Response; |
| 12 | 15 |
| 13 DOMHandler::DOMHandler() { | 16 DOMHandler::DOMHandler() : host_(nullptr) { |
| 14 } | 17 } |
| 15 | 18 |
| 16 DOMHandler::~DOMHandler() { | 19 DOMHandler::~DOMHandler() { |
| 17 } | 20 } |
| 18 | 21 |
| 22 void DOMHandler::SetRenderViewHost(RenderViewHostImpl* host) { | |
| 23 host_ = host; | |
| 24 } | |
| 25 | |
| 19 Response DOMHandler::SetFileInputFiles(NodeId node_id, | 26 Response DOMHandler::SetFileInputFiles(NodeId node_id, |
| 20 const std::vector<std::string>& files) { | 27 const std::vector<std::string>& files) { |
| 28 if (host_) { | |
| 29 for (const auto& file : files) { | |
| 30 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( | |
|
dgozman
2014/10/07 15:27:26
I wonder why we never revoke permissions...
| |
| 31 host_->GetProcess()->GetID(), base::FilePath(file)); | |
| 32 } | |
| 33 } | |
| 21 return Response::FallThrough(); | 34 return Response::FallThrough(); |
| 22 } | 35 } |
| 23 | 36 |
| 24 } // namespace dom | 37 } // namespace dom |
| 25 } // namespace devtools | 38 } // namespace devtools |
| 26 } // namespace content | 39 } // namespace content |
| OLD | NEW |