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

Side by Side Diff: content/browser/fileapi/browser_file_system_helper.h

Issue 2830743004: Extracting and unittesting PrepareDropDataForChildProcess function. (Closed)
Patch Set: Self-review. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ 5 #ifndef CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_
6 #define CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ 6 #define CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "storage/browser/fileapi/file_system_context.h" 10 #include "storage/browser/fileapi/file_system_context.h"
11 11
12 namespace storage { 12 namespace storage {
13 class FileSystemContext; 13 class FileSystemContext;
14 class FileSystemURL; 14 class FileSystemURL;
15 } 15 }
16 16
17 namespace content { 17 namespace content {
18 18
19 class BrowserContext; 19 class BrowserContext;
20 class ChildProcessSecurityPolicyImpl;
21 struct DropData;
20 22
21 // Helper method that returns FileSystemContext constructed for 23 // Helper method that returns FileSystemContext constructed for
22 // the browser process. 24 // the browser process.
23 CONTENT_EXPORT scoped_refptr<storage::FileSystemContext> 25 CONTENT_EXPORT scoped_refptr<storage::FileSystemContext>
24 CreateFileSystemContext(BrowserContext* browser_context, 26 CreateFileSystemContext(BrowserContext* browser_context,
25 const base::FilePath& profile_path, 27 const base::FilePath& profile_path,
26 bool is_incognito, 28 bool is_incognito,
27 storage::QuotaManagerProxy* quota_manager_proxy); 29 storage::QuotaManagerProxy* quota_manager_proxy);
28 30
29 // Verifies that |url| is valid and has a registered backend in |context|. 31 // Verifies that |url| is valid and has a registered backend in |context|.
30 CONTENT_EXPORT bool FileSystemURLIsValid(storage::FileSystemContext* context, 32 CONTENT_EXPORT bool FileSystemURLIsValid(storage::FileSystemContext* context,
31 const storage::FileSystemURL& url); 33 const storage::FileSystemURL& url);
32 34
33 // Get the platform path from a file system URL. This needs to be called 35 // Get the platform path from a file system URL. This needs to be called
34 // on the FILE thread. 36 // on the FILE thread.
35 CONTENT_EXPORT void SyncGetPlatformPath(storage::FileSystemContext* context, 37 CONTENT_EXPORT void SyncGetPlatformPath(storage::FileSystemContext* context,
36 int process_id, 38 int process_id,
37 const GURL& path, 39 const GURL& path,
38 base::FilePath* platform_path); 40 base::FilePath* platform_path);
41
ncarter (slow) 2017/04/24 22:01:51 Maybe this as an intro sentence: // Make it possi
Łukasz Anforowicz 2017/04/24 22:18:10 Done.
42 // |drop_data| can include references to local files and filesystem files that
43 // were accessible to the child process that is the source of the drag and drop,
44 // but might not (yet) be accessible the child process that is the target of the
45 // drop. PrepareDropDataForChildProcess makes sure that |child_id| has access
46 // to files referred to by |drop_data| - this method will 1) mutate |drop_data|
47 // as needed (e.g. to refer to files in a new isolated filesystem, rather than
48 // the original filesystem files) and 2) use |security_policy| to grant
49 // |child_id| appropriate file access.
50 CONTENT_EXPORT void PrepareDropDataForChildProcess(
Łukasz Anforowicz 2017/04/24 21:30:24 TBH I don't understand why |CONTENT_EXPORT| is nee
ncarter (slow) 2017/04/24 22:01:51 In the component build, both render_widget_host_im
Łukasz Anforowicz 2017/04/24 22:18:10 Oh, ok - thanks for the explanation. I guess I sh
51 DropData* drop_data,
52 ChildProcessSecurityPolicyImpl* security_policy,
Łukasz Anforowicz 2017/04/24 21:30:23 This has to be CPSPImpl, because CPSP doesn't expo
ncarter (slow) 2017/04/24 22:01:51 That's fine.
53 int child_id,
54 const storage::FileSystemContext* file_system_context);
55
39 } // namespace content 56 } // namespace content
40 57
41 #endif // CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_ 58 #endif // CONTENT_BROWSER_FILEAPI_BROWSER_FILE_SYSTEM_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/fileapi/browser_file_system_helper.cc » ('j') | content/test/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698