OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/file_system/webfilesystem_callback_dispatcher.h" | 5 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util_proxy.h" | 10 #include "base/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/WebKit/chromium/public/WebFileInfo.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
18 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" |
19 | 20 |
20 using WebKit::WebFileInfo; | 21 using WebKit::WebFileInfo; |
21 using WebKit::WebFileSystemCallbacks; | 22 using WebKit::WebFileSystemCallbacks; |
22 using WebKit::WebFileSystemEntry; | 23 using WebKit::WebFileSystemEntry; |
23 using WebKit::WebString; | 24 using WebKit::WebString; |
| 25 using WebKit::WebURL; |
24 using WebKit::WebVector; | 26 using WebKit::WebVector; |
25 | 27 |
26 WebFileSystemCallbackDispatcher::WebFileSystemCallbackDispatcher( | 28 WebFileSystemCallbackDispatcher::WebFileSystemCallbackDispatcher( |
27 WebFileSystemCallbacks* callbacks) | 29 WebFileSystemCallbacks* callbacks) |
28 : callbacks_(callbacks) { | 30 : callbacks_(callbacks) { |
29 DCHECK(callbacks_); | 31 DCHECK(callbacks_); |
30 } | 32 } |
31 | 33 |
32 void WebFileSystemCallbackDispatcher::DidSucceed() { | 34 void WebFileSystemCallbackDispatcher::DidSucceed() { |
33 callbacks_->didSucceed(); | 35 callbacks_->didSucceed(); |
(...skipping 19 matching lines...) Expand all Loading... |
53 for (size_t i = 0; i < entries.size(); i++) { | 55 for (size_t i = 0; i < entries.size(); i++) { |
54 file_system_entries[i].name = | 56 file_system_entries[i].name = |
55 webkit_glue::FilePathStringToWebString(entries[i].name); | 57 webkit_glue::FilePathStringToWebString(entries[i].name); |
56 file_system_entries[i].isDirectory = entries[i].is_directory; | 58 file_system_entries[i].isDirectory = entries[i].is_directory; |
57 } | 59 } |
58 callbacks_->didReadDirectory(file_system_entries, has_more); | 60 callbacks_->didReadDirectory(file_system_entries, has_more); |
59 } | 61 } |
60 | 62 |
61 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( | 63 void WebFileSystemCallbackDispatcher::DidOpenFileSystem( |
62 const std::string& name, const GURL& root) { | 64 const std::string& name, const GURL& root) { |
63 callbacks_->didOpenFileSystem( | 65 // Temporary hack to ease a 4-phase Chromium/WebKit commit. |
64 UTF8ToUTF16(name), UTF8ToUTF16(root.spec())); | 66 #ifdef WEBFILESYSTEMCALLBACKS_USE_URL_NOT_STRING |
| 67 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root); |
| 68 #else |
| 69 callbacks_->didOpenFileSystem(UTF8ToUTF16(name), UTF8ToUTF16(root.spec())); |
| 70 #endif |
65 } | 71 } |
66 | 72 |
67 void WebFileSystemCallbackDispatcher::DidFail( | 73 void WebFileSystemCallbackDispatcher::DidFail( |
68 base::PlatformFileError error_code) { | 74 base::PlatformFileError error_code) { |
69 callbacks_->didFail( | 75 callbacks_->didFail( |
70 webkit_glue::PlatformFileErrorToWebFileError(error_code)); | 76 webkit_glue::PlatformFileErrorToWebFileError(error_code)); |
71 } | 77 } |
72 | 78 |
73 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { | 79 void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) { |
74 NOTREACHED(); | 80 NOTREACHED(); |
75 } | 81 } |
OLD | NEW |