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

Side by Side Diff: content/common/fileapi/webfilesystem_callback_dispatcher.cc

Issue 14796018: Cleanup: Deprecate FileSystemCallbackDispatcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
(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 #include "content/common/fileapi/webfilesystem_callback_dispatcher.h"
6
7 #include <string>
8 #include <vector>
9
10 #include "base/files/file_util_proxy.h"
11 #include "base/logging.h"
12 #include "base/utf_string_conversions.h"
13 #include "googleurl/src/gurl.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h"
18 #include "webkit/base/file_path_string_conversions.h"
19 #include "webkit/fileapi/file_system_util.h"
20 #include "webkit/glue/webkit_glue.h"
21
22 using WebKit::WebFileInfo;
23 using WebKit::WebFileSystemCallbacks;
24 using WebKit::WebFileSystemEntry;
25 using WebKit::WebString;
26 using WebKit::WebVector;
27
28 namespace content {
29
30 WebFileSystemCallbackDispatcher::WebFileSystemCallbackDispatcher(
31 WebFileSystemCallbacks* callbacks)
32 : callbacks_(callbacks) {
33 DCHECK(callbacks_);
34 }
35
36 void WebFileSystemCallbackDispatcher::DidSucceed() {
37 callbacks_->didSucceed();
38 }
39
40 void WebFileSystemCallbackDispatcher::DidReadMetadata(
41 const base::PlatformFileInfo& file_info,
42 const base::FilePath& platform_path) {
43 WebFileInfo web_file_info;
44 webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
45 web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path);
46 callbacks_->didReadMetadata(web_file_info);
47 }
48
49 void WebFileSystemCallbackDispatcher::DidCreateSnapshotFile(
50 const base::PlatformFileInfo& file_info,
51 const base::FilePath& platform_path) {
52 WebFileInfo web_file_info;
53 webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
54 web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path);
55 callbacks_->didCreateSnapshotFile(web_file_info);
56 }
57
58 void WebFileSystemCallbackDispatcher::DidReadDirectory(
59 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
60 WebVector<WebFileSystemEntry> file_system_entries(entries.size());
61 for (size_t i = 0; i < entries.size(); i++) {
62 file_system_entries[i].name =
63 webkit_base::FilePathStringToWebString(entries[i].name);
64 file_system_entries[i].isDirectory = entries[i].is_directory;
65 }
66 callbacks_->didReadDirectory(file_system_entries, has_more);
67 }
68
69 void WebFileSystemCallbackDispatcher::DidOpenFileSystem(
70 const std::string& name, const GURL& root) {
71 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root);
72 }
73
74 void WebFileSystemCallbackDispatcher::DidFail(
75 base::PlatformFileError error_code) {
76 callbacks_->didFail(
77 fileapi::PlatformFileErrorToWebFileError(error_code));
78 }
79
80 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) {
81 NOTREACHED();
82 }
83
84 } // namespace content
OLDNEW
« no previous file with comments | « content/common/fileapi/webfilesystem_callback_dispatcher.h ('k') | content/common/fileapi/webfilesystem_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698