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

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_system_util.h

Issue 13767002: Use ExtractDrivePath(path()) instead of virtual_path() for getting Drive path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "chrome/browser/chromeos/drive/drive_file_error.h" 12 #include "chrome/browser/chromeos/drive/drive_file_error.h"
13 #include "chrome/browser/google_apis/gdata_errorcode.h" 13 #include "chrome/browser/google_apis/gdata_errorcode.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "webkit/fileapi/file_system_url.h"
15 16
16 class Profile; 17 class Profile;
17 18
18 namespace base { 19 namespace base {
19 class FilePath; 20 class FilePath;
20 } 21 }
21 22
22 namespace drive { 23 namespace drive {
23 24
24 class PlatformFileInfoProto; 25 class PlatformFileInfoProto;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // migrated to the new namespace. http://crbug.com/174233. 106 // migrated to the new namespace. http://crbug.com/174233.
106 bool NeedsNamespaceMigration(const base::FilePath& path); 107 bool NeedsNamespaceMigration(const base::FilePath& path);
107 108
108 // Returns new FilePath with a namespace "root" inserted at the 3rd component. 109 // Returns new FilePath with a namespace "root" inserted at the 3rd component.
109 // e.g. "/special/drive/root/dir" for "/special/drive/dir". 110 // e.g. "/special/drive/root/dir" for "/special/drive/dir".
110 // NeedsNamespaceMigration(path) should be true (after the TODOs are resolved). 111 // NeedsNamespaceMigration(path) should be true (after the TODOs are resolved).
111 base::FilePath ConvertToMyDriveNamespace(const base::FilePath& path); 112 base::FilePath ConvertToMyDriveNamespace(const base::FilePath& path);
112 113
113 // Extracts the Drive path from the given path located under the Drive mount 114 // Extracts the Drive path from the given path located under the Drive mount
114 // point. Returns an empty path if |path| is not under the Drive mount point. 115 // point. Returns an empty path if |path| is not under the Drive mount point.
115 // Examples: ExtractGDatPath("/special/drive/foo.txt") => "drive/foo.txt" 116 // Examples: ExtractDrivePath("/special/drive/foo.txt") => "drive/foo.txt"
116 base::FilePath ExtractDrivePath(const base::FilePath& path); 117 base::FilePath ExtractDrivePath(const base::FilePath& path);
117 118
119 // Extracts the Drive path (e.g., "drive/foo.txt") from the filesystem URL.
120 // Returns an empty path if |url| does not point under Drive mount point.
121 base::FilePath ExtractDrivePathFromFileSystemUrl(
122 const fileapi::FileSystemURL& url);
123
118 // Escapes a file name in Drive cache. 124 // Escapes a file name in Drive cache.
119 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex) 125 // Replaces percent ('%'), period ('.') and slash ('/') with %XX (hex)
120 std::string EscapeCacheFileName(const std::string& filename); 126 std::string EscapeCacheFileName(const std::string& filename);
121 127
122 // Unescapes a file path in Drive cache. 128 // Unescapes a file path in Drive cache.
123 // This is the inverse of EscapeCacheFileName. 129 // This is the inverse of EscapeCacheFileName.
124 std::string UnescapeCacheFileName(const std::string& filename); 130 std::string UnescapeCacheFileName(const std::string& filename);
125 131
126 // Escapes forward slashes from file names with magic unicode character 132 // Escapes forward slashes from file names with magic unicode character
127 // \u2215 pretty much looks the same in UI. 133 // \u2215 pretty much looks the same in UI.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void operator()(T* object) const { 201 void operator()(T* object) const {
196 if (object) 202 if (object)
197 object->Destroy(); 203 object->Destroy();
198 } 204 }
199 }; 205 };
200 206
201 } // namespace util 207 } // namespace util
202 } // namespace drive 208 } // namespace drive
203 209
204 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_ 210 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698