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

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

Issue 9558006: Rename content/{common,browser}/file_system to fileapi and move blob stuff into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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) 2011 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/file_system/webfilesystem_callback_dispatcher.h"
6
7 #include <string>
8 #include <vector>
9
10 #include "base/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/WebKit/chromium/public/WebFileInfo.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
18 #include "webkit/glue/webkit_glue.h"
19
20 using WebKit::WebFileInfo;
21 using WebKit::WebFileSystemCallbacks;
22 using WebKit::WebFileSystemEntry;
23 using WebKit::WebString;
24 using WebKit::WebVector;
25
26 WebFileSystemCallbackDispatcher::WebFileSystemCallbackDispatcher(
27 WebFileSystemCallbacks* callbacks)
28 : callbacks_(callbacks) {
29 DCHECK(callbacks_);
30 }
31
32 void WebFileSystemCallbackDispatcher::DidSucceed() {
33 callbacks_->didSucceed();
34 }
35
36 void WebFileSystemCallbackDispatcher::DidReadMetadata(
37 const base::PlatformFileInfo& file_info, const FilePath& platform_path) {
38 WebFileInfo web_file_info;
39 web_file_info.modificationTime = file_info.last_modified.ToDoubleT();
40 web_file_info.length = file_info.size;
41 if (file_info.is_directory)
42 web_file_info.type = WebFileInfo::TypeDirectory;
43 else
44 web_file_info.type = WebFileInfo::TypeFile;
45 web_file_info.platformPath =
46 webkit_glue::FilePathToWebString(platform_path);
47 callbacks_->didReadMetadata(web_file_info);
48 }
49
50 void WebFileSystemCallbackDispatcher::DidReadDirectory(
51 const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
52 WebVector<WebFileSystemEntry> file_system_entries(entries.size());
53 for (size_t i = 0; i < entries.size(); i++) {
54 file_system_entries[i].name =
55 webkit_glue::FilePathStringToWebString(entries[i].name);
56 file_system_entries[i].isDirectory = entries[i].is_directory;
57 }
58 callbacks_->didReadDirectory(file_system_entries, has_more);
59 }
60
61 void WebFileSystemCallbackDispatcher::DidOpenFileSystem(
62 const std::string& name, const GURL& root) {
63 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root);
64 }
65
66 void WebFileSystemCallbackDispatcher::DidFail(
67 base::PlatformFileError error_code) {
68 callbacks_->didFail(
69 webkit_glue::PlatformFileErrorToWebFileError(error_code));
70 }
71
72 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) {
73 NOTREACHED();
74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698