| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3211 | 3211 |
| 3212 void RenderFrameHostImpl::FilesSelectedInChooser( | 3212 void RenderFrameHostImpl::FilesSelectedInChooser( |
| 3213 const std::vector<content::FileChooserFileInfo>& files, | 3213 const std::vector<content::FileChooserFileInfo>& files, |
| 3214 FileChooserParams::Mode permissions) { | 3214 FileChooserParams::Mode permissions) { |
| 3215 storage::FileSystemContext* const file_system_context = | 3215 storage::FileSystemContext* const file_system_context = |
| 3216 BrowserContext::GetStoragePartition(GetProcess()->GetBrowserContext(), | 3216 BrowserContext::GetStoragePartition(GetProcess()->GetBrowserContext(), |
| 3217 GetSiteInstance()) | 3217 GetSiteInstance()) |
| 3218 ->GetFileSystemContext(); | 3218 ->GetFileSystemContext(); |
| 3219 // Grant the security access requested to the given files. | 3219 // Grant the security access requested to the given files. |
| 3220 for (const auto& file : files) { | 3220 for (const auto& file : files) { |
| 3221 // We shouldn't be given a FilePath that can't survive the conversion to a |
| 3222 // WebString, which we can approximate with AsUTF8Unsafe. Blink won't be |
| 3223 // able to handle it, and we would kill the renderer when it claims to have |
| 3224 // chosen an empty file path. |
| 3225 DCHECK(!file.file_path.AsUTF8Unsafe().empty()); |
| 3226 |
| 3221 if (permissions == FileChooserParams::Save) { | 3227 if (permissions == FileChooserParams::Save) { |
| 3222 ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile( | 3228 ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile( |
| 3223 GetProcess()->GetID(), file.file_path); | 3229 GetProcess()->GetID(), file.file_path); |
| 3224 } else { | 3230 } else { |
| 3225 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( | 3231 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( |
| 3226 GetProcess()->GetID(), file.file_path); | 3232 GetProcess()->GetID(), file.file_path); |
| 3227 } | 3233 } |
| 3228 if (file.file_system_url.is_valid()) { | 3234 if (file.file_system_url.is_valid()) { |
| 3229 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFileSystem( | 3235 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFileSystem( |
| 3230 GetProcess()->GetID(), | 3236 GetProcess()->GetID(), |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3697 } | 3703 } |
| 3698 | 3704 |
| 3699 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3705 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
| 3700 const std::string& interface_name, | 3706 const std::string& interface_name, |
| 3701 mojo::ScopedMessagePipeHandle pipe) { | 3707 mojo::ScopedMessagePipeHandle pipe) { |
| 3702 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 3708 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
| 3703 } | 3709 } |
| 3704 #endif | 3710 #endif |
| 3705 | 3711 |
| 3706 } // namespace content | 3712 } // namespace content |
| OLD | NEW |