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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2811533002: Exclude files from FileSelectChooser if they can't convert to WebStrings. (Closed)
Patch Set: Created 3 years, 8 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 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
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
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
OLDNEW
« chrome/browser/file_select_helper.cc ('K') | « chrome/browser/file_select_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698