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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_writing.h

Issue 10827068: gdata: Fix "save as pdf" to work on Google Drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split from GDataFileSystem, add test. Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_writing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_WRITING_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_WRITING_H_
7
8 #include "base/bind.h"
9 #include "base/file_path.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
12 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h"
13
14 namespace gdata {
15
16 // This class provides higher level operations for writing to GData files over
17 // GDataFileSystemInterface.
18 class GDataFileWriting {
satorux1 2012/08/02 01:08:09 The class name looks rather unusual. Maybe somethi
kinaba 2012/08/02 04:57:31 Done.
19 public:
20 explicit GDataFileWriting(GDataFileSystemInterface* file_system);
21 ~GDataFileWriting();
22
23 // Prepares a local temporary file path and passes it to |callback| on the
24 // 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
26 // file is created.
27 //
28 // Can be called from UI/IO thread.
29 void PrepareWritableFileAndRun(const FilePath& path,
30 const OpenFileCallback& callback);
31
32 private:
33 // Part of PrepareWritableFilePathAndRun(). It forwards the task to the UI
34 // thread, tries CreateFile for the case file does not exist yet, does
35 // OpenFile to download and mark the file as dirty, runs |callback|, and
36 // finally calls CloseFile.
37 void PrepareWritableFileAndRunOnUIThread(
38 const FilePath& file_path,
39 const OpenFileCallback& callback);
40 void PrepareWritableFileAndRunAfterCreateFile(
41 const FilePath& file_path,
42 const OpenFileCallback& callback,
43 GDataFileError result);
44 void PrepareWritableFileAndRunAfterOpenFile(
45 const FilePath& file_path,
46 const OpenFileCallback& callback,
47 GDataFileError result,
48 const FilePath& local_cache_path);
49 void PrepareWritableFileAndRunAfterCallback(const FilePath& file_path);
50
51 // File system owned by GDataSystemService.
52 GDataFileSystemInterface* file_system_;
53
54 // WeakPtrFactory and WeakPtr bound to the UI thread.
55 base::WeakPtrFactory<GDataFileWriting> ui_weak_ptr_factory_;
satorux1 2012/08/02 01:08:09 weak_ptr_factory_
kinaba 2012/08/02 04:57:31 Done.
56 base::WeakPtr<GDataFileWriting> ui_weak_ptr_;
satorux1 2012/08/02 01:08:09 Please remove this. Please use GetWeakPtr()
kinaba 2012/08/02 04:57:31 Done.
57 };
58
59 } // namespace gdata
60
61 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_WRITING_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_writing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698