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

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

Powered by Google App Engine
This is Rietveld 408576698