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

Side by Side Diff: chrome/browser/chromeos/file_manager/filesystem_api_util.cc

Issue 300063006: Files.app: Let Files.app pass mutliple files to file handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/chromeos/file_manager/filesystem_api_util.h" 5 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/drive/file_errors.h" 10 #include "chrome/browser/chromeos/drive/file_errors.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const base::FilePath& local_path) { 42 const base::FilePath& local_path) {
43 // This is called on the IO-allowed blocking pool. Call back to UI. 43 // This is called on the IO-allowed blocking pool. Call back to UI.
44 content::BrowserThread::PostTask( 44 content::BrowserThread::PostTask(
45 content::BrowserThread::UI, 45 content::BrowserThread::UI,
46 FROM_HERE, 46 FROM_HERE,
47 base::Bind(callback, error == drive::FILE_ERROR_OK)); 47 base::Bind(callback, error == drive::FILE_ERROR_OK));
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 bool IsUnderSpecialPath(Profile* profile, 52 bool IsUnderSpecialPath(Profile* profile, const base::FilePath& path) {
53 const base::FilePath& path) {
54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
55 54
56 // TODO(kinaba): support other types of volumes besides Drive. 55 // TODO(kinaba): support other types of volumes besides Drive.
57 return drive::util::IsUnderDriveMountPoint(path); 56 return drive::util::IsUnderDriveMountPoint(path);
58 } 57 }
59 58
60 void GetSpecialPathMimeType( 59 void GetSpecialPathMimeType(
61 Profile* profile, 60 Profile* profile,
62 const base::FilePath& path, 61 const base::FilePath& path,
63 const base::Callback<void(bool, const std::string&)>& callback) { 62 const base::Callback<void(bool, const std::string&)>& callback) {
64 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
65 64
66 // TODO(kinaba): support other types of volumes besides Drive. 65 // TODO(kinaba): support other types of volumes besides Drive.
67 drive::FileSystemInterface* file_system = 66 drive::FileSystemInterface* file_system =
68 drive::util::GetFileSystemByProfile(profile); 67 drive::util::GetFileSystemByProfile(profile);
69 if (!file_system) { 68 if (!file_system) {
70 content::BrowserThread::PostTask( 69 content::BrowserThread::PostTask(
71 content::BrowserThread::UI, 70 content::BrowserThread::UI,
72 FROM_HERE, 71 FROM_HERE,
73 base::Bind(callback, false, std::string())); 72 base::Bind(callback, false, std::string()));
74 return; 73 return;
75 } 74 }
76 75
77 file_system->GetResourceEntry( 76 file_system->GetResourceEntry(
78 drive::util::ExtractDrivePath(path), 77 drive::util::ExtractDrivePath(path),
79 base::Bind(&GetMimeTypeAfterGetResourceEntry, callback)); 78 base::Bind(&GetMimeTypeAfterGetResourceEntry, callback));
80 } 79 }
81 80
82 void IsSpecialPathDirectory( 81 void IsSpecialPathDirectory(Profile* profile,
83 Profile* profile, 82 const base::FilePath& path,
84 const base::FilePath& path, 83 const base::Callback<void(bool)>& callback) {
85 const base::Callback<void(bool)>& callback) {
86 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 84 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
87 85
88 // TODO(kinaba): support other types of volumes besides Drive. 86 // TODO(kinaba): support other types of volumes besides Drive.
89 drive::util::CheckDirectoryExists( 87 drive::util::CheckDirectoryExists(
90 profile, 88 profile, path, base::Bind(&CheckDirectoryAfterDriveCheck, callback));
91 path,
92 base::Bind(&CheckDirectoryAfterDriveCheck, callback));
93 } 89 }
94 90
95 void PrepareSpecialPathWritableFile( 91 void PrepareSpecialPathWritableFile(
96 Profile* profile, 92 Profile* profile,
97 const base::FilePath& path, 93 const base::FilePath& path,
98 const base::Callback<void(bool)>& callback) { 94 const base::Callback<void(bool)>& callback) {
99 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 95 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
100 96
101 // TODO(kinaba): support other types of volumes besides Drive. 97 // TODO(kinaba): support other types of volumes besides Drive.
102 drive::util::PrepareWritableFileAndRun( 98 drive::util::PrepareWritableFileAndRun(
103 profile, 99 profile, path, base::Bind(&CheckWritableAfterDriveCheck, callback));
104 path,
105 base::Bind(&CheckWritableAfterDriveCheck, callback));
106 } 100 }
107 101
108 } // namespace util 102 } // namespace util
109 } // namespace file_manager 103 } // namespace file_manager
OLDNEW
« apps/launcher.cc ('K') | « chrome/browser/chromeos/file_manager/filesystem_api_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698