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

Side by Side Diff: pdf/file_writer.h

Issue 317803005: Add function to document_loader to get PDF as pp::FileRef (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
Lei Zhang 2014/06/05 07:23:54 nit: no (c) in new code.
raymes 2014/06/06 01:57:14 Done.
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 PDF_FILE_WRITER_H_
6 #define PDF_FILE_WRITER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ppapi/cpp/file_io.h"
13 #include "ppapi/cpp/file_ref.h"
14 #include "ppapi/cpp/file_system.h"
15 #include "ppapi/cpp/instance_handle.h"
16 #include "ppapi/utility/completion_callback_factory.h"
17
18 namespace chrome_pdf {
19
20 class FileWriter {
21 public:
22 FileWriter(const pp::InstanceHandle& instance,
23 const std::string& filename,
24 const char* bytes,
25 size_t length);
26
27 void GetFile(pp::CompletionCallbackWithOutput<pp::FileRef> callback);
28
29 private:
30 void OnFileSystemOpen(int32_t result);
31 void OnWriteComplete(int32_t result);
32 void OnFlushComplete(int32_t result);
33
34 pp::InstanceHandle instance_;
35 std::string filename_;
36 const char* bytes_;
37 size_t length_;
38 scoped_ptr<pp::CompletionCallbackWithOutput<pp::FileRef> > callback_;
39
40 bool succeeded_;
41 size_t offset_;
42 pp::FileRef file_ref_;
43 pp::FileSystem fs_;
44 pp::FileIO io_;
45 pp::CompletionCallbackFactory<FileWriter> callback_factory_;
46 };
47
48 } // namespace chrome_pdf
49
50 #endif // PDF_FILE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698