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

Unified Diff: chrome/renderer/render_view.cc

Issue 3394003: Add Worker support for FileSystem API. (Closed)
Patch Set: '' Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/worker/websharedworker_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 9666b67c7cb525e751f66135a5b4a4c6676b40e0..8de46f47f317c5823c7b4632f56c7c5568ea4af9 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -31,6 +31,8 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/file_system/file_system_dispatcher.h"
+#include "chrome/common/file_system/webfilesystem_callback_dispatcher.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/page_zoom.h"
@@ -408,17 +410,6 @@ static std::string DetermineTextLanguage(const string16& text) {
return language;
}
-// Holds pending openFileSystem callbacks.
-struct RenderView::PendingOpenFileSystem {
- explicit PendingOpenFileSystem(WebFileSystemCallbacks* c) : callbacks(c) {
- }
- ~PendingOpenFileSystem() {
- if (callbacks)
- callbacks->didFail(WebKit::WebFileErrorAbort);
- }
- WebFileSystemCallbacks* callbacks;
-};
-
///////////////////////////////////////////////////////////////////////////////
int32 RenderView::next_page_id_ = 1;
@@ -810,8 +801,6 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
OnAccessibilityDoDefaultAction)
IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK,
OnAccessibilityNotificationsAck)
- IPC_MESSAGE_HANDLER(ViewMsg_OpenFileSystemRequest_Complete,
- OnOpenFileSystemRequestComplete)
IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened)
// Have the super handle all other messages.
@@ -3506,21 +3495,18 @@ void RenderView::openFileSystem(
WebFileSystem::Type type,
long long size,
WebFileSystemCallbacks* callbacks) {
- scoped_ptr<PendingOpenFileSystem> request(
- new PendingOpenFileSystem(callbacks));
+ DCHECK(callbacks);
WebSecurityOrigin origin = frame->securityOrigin();
- if (origin.isEmpty())
- return; // Uninitialized document?
-
- ViewHostMsg_OpenFileSystemRequest_Params params;
- params.routing_id = routing_id_;
- params.request_id = pending_file_system_requests_.Add(request.release());
- params.origin_url = GURL(origin.toString());
- params.type = type;
- params.requested_size = size;
+ if (origin.isEmpty()) {
+ // Uninitialized document?
+ callbacks->didFail(WebKit::WebFileErrorAbort);
+ return;
+ }
- Send(new ViewHostMsg_OpenFileSystemRequest(params));
+ ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
+ GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
+ size, new WebFileSystemCallbackDispatcher(callbacks));
}
// webkit_glue::WebPluginPageDelegate -----------------------------------------
@@ -5813,20 +5799,6 @@ bool RenderView::IsNonLocalTopLevelNavigation(
return false;
}
-void RenderView::OnOpenFileSystemRequestComplete(
- int request_id, bool accepted, const string16& name,
- const string16& root_path) {
- PendingOpenFileSystem* request = pending_file_system_requests_.Lookup(
- request_id);
- DCHECK(request);
- if (accepted)
- request->callbacks->didOpenFileSystem(name, root_path);
- else
- request->callbacks->didFail(WebKit::WebFileErrorSecurity);
- request->callbacks = NULL;
- pending_file_system_requests_.Remove(request_id);
-}
-
void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code,
IPC::PlatformFileForTransit file_for_transit,
int message_id) {
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/worker/websharedworker_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698