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

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

Issue 14884015: drive: Remove DriveFileType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 (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/file_system_proxy.h" 5 #include "chrome/browser/chromeos/drive/file_system_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 // Helper function to run OpenFileCallback from 52 // Helper function to run OpenFileCallback from
53 // FileSystemProxy::OpenFile(). 53 // FileSystemProxy::OpenFile().
54 void OnGetFileByPathForOpen( 54 void OnGetFileByPathForOpen(
55 const OpenFileCallback& callback, 55 const OpenFileCallback& callback,
56 int file_flags, 56 int file_flags,
57 base::ProcessHandle peer_handle, 57 base::ProcessHandle peer_handle,
58 FileError file_error, 58 FileError file_error,
59 const base::FilePath& local_path, 59 const base::FilePath& local_path,
60 const std::string& unused_mime_type, 60 scoped_ptr<ResourceEntry> entry) {
61 DriveFileType file_type) {
62 base::PlatformFileError error = 61 base::PlatformFileError error =
63 FileErrorToPlatformError(file_error); 62 FileErrorToPlatformError(file_error);
64 if (error != base::PLATFORM_FILE_OK) { 63 if (error != base::PLATFORM_FILE_OK) {
65 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle); 64 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle);
66 return; 65 return;
67 } 66 }
68 67
69 base::PlatformFileError* open_error = 68 base::PlatformFileError* open_error =
70 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED); 69 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
71 base::PostTaskAndReplyWithResult( 70 base::PostTaskAndReplyWithResult(
(...skipping 10 matching lines...) Expand all
82 base::Owned(open_error))); 81 base::Owned(open_error)));
83 } 82 }
84 83
85 // Helper function to run SnapshotFileCallback from 84 // Helper function to run SnapshotFileCallback from
86 // FileSystemProxy::CreateSnapshotFile(). 85 // FileSystemProxy::CreateSnapshotFile().
87 void CallSnapshotFileCallback( 86 void CallSnapshotFileCallback(
88 const FileSystemOperation::SnapshotFileCallback& callback, 87 const FileSystemOperation::SnapshotFileCallback& callback,
89 const base::PlatformFileInfo& file_info, 88 const base::PlatformFileInfo& file_info,
90 FileError file_error, 89 FileError file_error,
91 const base::FilePath& local_path, 90 const base::FilePath& local_path,
92 const std::string& unused_mime_type, 91 scoped_ptr<ResourceEntry> entry) {
93 DriveFileType file_type) {
94 scoped_refptr<ShareableFileReference> file_ref; 92 scoped_refptr<ShareableFileReference> file_ref;
95 base::PlatformFileError error = 93 base::PlatformFileError error =
96 FileErrorToPlatformError(file_error); 94 FileErrorToPlatformError(file_error);
97 95
98 // If the file is a hosted document, a temporary JSON file is created to 96 // If the file is a hosted document, a temporary JSON file is created to
99 // represent the document. The JSON file is not cached and its lifetime 97 // represent the document. The JSON file is not cached and its lifetime
100 // is managed by ShareableFileReference. 98 // is managed by ShareableFileReference.
101 if (error == base::PLATFORM_FILE_OK && file_type == HOSTED_DOCUMENT) { 99 if (error == base::PLATFORM_FILE_OK &&
100 entry && entry->file_specific_info().is_hosted_document()) {
102 file_ref = ShareableFileReference::GetOrCreate( 101 file_ref = ShareableFileReference::GetOrCreate(
103 local_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, 102 local_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
104 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 103 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
105 } 104 }
106 105
107 // When reading file, last modified time specified in file info will be 106 // When reading file, last modified time specified in file info will be
108 // compared to the last modified time of the local version of the drive file. 107 // compared to the last modified time of the local version of the drive file.
109 // Since those two values don't generally match (last modification time on the 108 // Since those two values don't generally match (last modification time on the
110 // drive server vs. last modification time of the local, downloaded file), so 109 // drive server vs. last modification time of the local, downloaded file), so
111 // we have to opt out from this check. We do this by unsetting last_modified 110 // we have to opt out from this check. We do this by unsetting last_modified
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 CallFileSystemMethodOnUIThread( 842 CallFileSystemMethodOnUIThread(
844 base::Bind(&FileSystemInterface::CloseFile, 843 base::Bind(&FileSystemInterface::CloseFile,
845 base::Unretained(file_system_), 844 base::Unretained(file_system_),
846 virtual_path, 845 virtual_path,
847 google_apis::CreateRelayCallback( 846 google_apis::CreateRelayCallback(
848 base::Bind(&EmitDebugLogForCloseFile, 847 base::Bind(&EmitDebugLogForCloseFile,
849 virtual_path)))); 848 virtual_path))));
850 } 849 }
851 850
852 } // namespace drive 851 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_interface.h ('k') | chrome/browser/chromeos/drive/file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698