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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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_FILE_WRITE_HELPER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_WRITE_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_WRITE_HELPER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_WRITE_HELPER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/chromeos/drive/drive_file_error.h" 9 #include "chrome/browser/chromeos/drive/drive_file_error.h"
10 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 10 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
11 11
12 namespace base {
12 class FilePath; 13 class FilePath;
14 }
13 15
14 namespace drive { 16 namespace drive {
15 17
16 // This class provides higher level operations for writing to Drive files over 18 // This class provides higher level operations for writing to Drive files over
17 // DriveFileSystemInterface. 19 // DriveFileSystemInterface.
18 class FileWriteHelper { 20 class FileWriteHelper {
19 public: 21 public:
20 explicit FileWriteHelper(DriveFileSystemInterface* file_system); 22 explicit FileWriteHelper(DriveFileSystemInterface* file_system);
21 ~FileWriteHelper(); 23 ~FileWriteHelper();
22 24
23 // Prepares a local temporary file path and passes it to |callback| on the 25 // Prepares a local temporary file path and passes it to |callback| on the
24 // blocking thread pool that allows file operations. The modification to 26 // blocking thread pool that allows file operations. The modification to
25 // the file is reflected to GData |path|. If |path| does not exist, a new 27 // the file is reflected to GData |path|. If |path| does not exist, a new
26 // file is created. 28 // file is created.
27 // 29 //
28 // Must be called from UI thread. 30 // Must be called from UI thread.
29 void PrepareWritableFileAndRun(const FilePath& path, 31 void PrepareWritableFileAndRun(const base::FilePath& path,
30 const OpenFileCallback& callback); 32 const OpenFileCallback& callback);
31 33
32 private: 34 private:
33 // Part of PrepareWritableFilePathAndRun(). It tries CreateFile for the case 35 // Part of PrepareWritableFilePathAndRun(). It tries CreateFile for the case
34 // file does not exist yet, does OpenFile to download and mark the file as 36 // file does not exist yet, does OpenFile to download and mark the file as
35 // dirty, runs |callback|, and finally calls CloseFile. 37 // dirty, runs |callback|, and finally calls CloseFile.
36 void PrepareWritableFileAndRunAfterCreateFile( 38 void PrepareWritableFileAndRunAfterCreateFile(
37 const FilePath& file_path, 39 const base::FilePath& file_path,
38 const OpenFileCallback& callback, 40 const OpenFileCallback& callback,
39 DriveFileError result); 41 DriveFileError result);
40 void PrepareWritableFileAndRunAfterOpenFile( 42 void PrepareWritableFileAndRunAfterOpenFile(
41 const FilePath& file_path, 43 const base::FilePath& file_path,
42 const OpenFileCallback& callback, 44 const OpenFileCallback& callback,
43 DriveFileError result, 45 DriveFileError result,
44 const FilePath& local_cache_path); 46 const base::FilePath& local_cache_path);
45 void PrepareWritableFileAndRunAfterCallback(const FilePath& file_path); 47 void PrepareWritableFileAndRunAfterCallback(const base::FilePath& file_path);
46 48
47 // File system owned by DriveSystemService. 49 // File system owned by DriveSystemService.
48 DriveFileSystemInterface* file_system_; 50 DriveFileSystemInterface* file_system_;
49 51
50 // WeakPtrFactory bound to the UI thread. 52 // WeakPtrFactory bound to the UI thread.
51 // Note: This should remain the last member so it'll be destroyed and 53 // Note: This should remain the last member so it'll be destroyed and
52 // invalidate its weak pointers before any other members are destroyed. 54 // invalidate its weak pointers before any other members are destroyed.
53 base::WeakPtrFactory<FileWriteHelper> weak_ptr_factory_; 55 base::WeakPtrFactory<FileWriteHelper> weak_ptr_factory_;
54 56
55 DISALLOW_COPY_AND_ASSIGN(FileWriteHelper); 57 DISALLOW_COPY_AND_ASSIGN(FileWriteHelper);
56 }; 58 };
57 59
58 } // namespace drive 60 } // namespace drive
59 61
60 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_WRITE_HELPER_H_ 62 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_WRITE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/update_operation.h ('k') | chrome/browser/chromeos/enterprise_extension_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698