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

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

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: Use GetDriveMountPointPath() 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 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 5 #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/chromeos/drive/file_write_helper.h" 26 #include "chrome/browser/chromeos/drive/file_write_helper.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_finder.h" 29 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/common/chrome_version_info.h" 30 #include "chrome/common/chrome_version_info.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
33 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
34 #include "net/base/escape.h" 34 #include "net/base/escape.h"
35 #include "net/base/network_change_notifier.h" 35 #include "net/base/network_change_notifier.h"
36 #include "webkit/fileapi/file_system_url.h"
36 37
37 using content::BrowserThread; 38 using content::BrowserThread;
38 39
39 namespace drive { 40 namespace drive {
40 namespace util { 41 namespace util {
41 42
42 namespace { 43 namespace {
43 44
44 const char kDriveSpecialRootPath[] = "/special"; 45 const char kDriveSpecialRootPath[] = "/special";
45 46
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 272
272 // -1 to include 'drive'. 273 // -1 to include 'drive'.
273 base::FilePath extracted; 274 base::FilePath extracted;
274 for (size_t i = arraysize(kDriveMountPointPathComponents) - 1; 275 for (size_t i = arraysize(kDriveMountPointPathComponents) - 1;
275 i < components.size(); ++i) { 276 i < components.size(); ++i) {
276 extracted = extracted.Append(components[i]); 277 extracted = extracted.Append(components[i]);
277 } 278 }
278 return extracted; 279 return extracted;
279 } 280 }
280 281
282 base::FilePath ExtractDrivePathFromFileSystemUrl(
283 const fileapi::FileSystemURL& url) {
284 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive)
285 return base::FilePath();
286 return ExtractDrivePath(url.path());
287 }
288
281 std::string EscapeCacheFileName(const std::string& filename) { 289 std::string EscapeCacheFileName(const std::string& filename) {
282 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape 290 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape
283 std::string escaped; 291 std::string escaped;
284 for (size_t i = 0; i < filename.size(); ++i) { 292 for (size_t i = 0; i < filename.size(); ++i) {
285 char c = filename[i]; 293 char c = filename[i];
286 if (c == '%' || c == '.' || c == '/') { 294 if (c == '%' || c == '.' || c == '/') {
287 base::StringAppendF(&escaped, "%%%02X", c); 295 base::StringAppendF(&escaped, "%%%02X", c);
288 } else { 296 } else {
289 escaped.push_back(c); 297 escaped.push_back(c);
290 } 298 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 proto->set_last_modified(file_info.last_modified.ToInternalValue()); 444 proto->set_last_modified(file_info.last_modified.ToInternalValue());
437 proto->set_last_accessed(file_info.last_accessed.ToInternalValue()); 445 proto->set_last_accessed(file_info.last_accessed.ToInternalValue());
438 proto->set_creation_time(file_info.creation_time.ToInternalValue()); 446 proto->set_creation_time(file_info.creation_time.ToInternalValue());
439 } 447 }
440 448
441 void EmptyFileOperationCallback(DriveFileError error) { 449 void EmptyFileOperationCallback(DriveFileError error) {
442 } 450 }
443 451
444 } // namespace util 452 } // namespace util
445 } // namespace drive 453 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698