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

Side by Side Diff: chrome/browser/file_system/file_system_dispatcher_host.cc

Issue 3208007: Add final part of IPC plumbing for FileSystem API (Closed)
Patch Set: fixing 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/file_system/file_system_dispatcher_host.h" 5 #include "chrome/browser/file_system/file_system_dispatcher_host.h"
6 6
7 #include "base/thread.h" 7 #include "base/thread.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 bool FileSystemDispatcherHost::OnMessageReceived( 41 bool FileSystemDispatcherHost::OnMessageReceived(
42 const IPC::Message& message, bool* message_was_ok) { 42 const IPC::Message& message, bool* message_was_ok) {
43 DCHECK(!shutdown_); 43 DCHECK(!shutdown_);
44 *message_was_ok = true; 44 *message_was_ok = true;
45 bool handled = true; 45 bool handled = true;
46 IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok) 46 IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok)
47 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenFileSystemRequest, OnOpenFileSystem) 47 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenFileSystemRequest, OnOpenFileSystem)
48 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Move, OnMove) 48 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Move, OnMove)
49 // TODO(kinuko): add more. 49 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Copy, OnCopy)
50 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Remove, OnRemove)
51 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_ReadMetadata, OnReadMetadata)
52 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Create, OnCreate)
53 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Exists, OnExists)
54 IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_ReadDirectory, OnReadDirectory)
50 IPC_MESSAGE_UNHANDLED(handled = false) 55 IPC_MESSAGE_UNHANDLED(handled = false)
51 IPC_END_MESSAGE_MAP_EX() 56 IPC_END_MESSAGE_MAP_EX()
52 return handled; 57 return handled;
53 } 58 }
54 59
55 void FileSystemDispatcherHost::OnOpenFileSystem( 60 void FileSystemDispatcherHost::OnOpenFileSystem(
56 const ViewHostMsg_OpenFileSystemRequest_Params& params) { 61 const ViewHostMsg_OpenFileSystemRequest_Params& params) {
57 string16 name; 62 string16 name;
58 string16 root_path; 63 string16 root_path;
59 64
60 // TODO(kinuko): not implemented yet. 65 // TODO(kinuko): not implemented yet.
61 66
62 Send(new ViewMsg_OpenFileSystemRequest_Complete( 67 Send(new ViewMsg_OpenFileSystemRequest_Complete(
63 params.routing_id, 68 params.routing_id,
64 params.request_id, 69 params.request_id,
65 false, 70 false,
66 name, root_path)); 71 name, root_path));
67 } 72 }
68 73
69 void FileSystemDispatcherHost::OnMove( 74 void FileSystemDispatcherHost::OnMove(
70 int request_id, const string16& src_path, const string16& dest_path) { 75 int request_id, const string16& src_path, const string16& dest_path) {
71 // TODO(kinuko): not implemented yet. 76 // TODO(kinuko): not implemented yet.
72 77 Send(new ViewMsg_FileSystem_DidFail(
73 Send(new ViewMsg_FileSystem_Failed(
74 request_id, WebKit::WebFileErrorAbort)); 78 request_id, WebKit::WebFileErrorAbort));
75 } 79 }
76 80
81 void FileSystemDispatcherHost::OnCopy(
82 int request_id,
83 const string16& src_path,
84 const string16& dest_path) {
85 // TODO(kinuko): not implemented yet.
86 Send(new ViewMsg_FileSystem_DidFail(
87 request_id, WebKit::WebFileErrorAbort));
88 }
89
90 void FileSystemDispatcherHost::OnRemove(
91 int request_id,
92 const string16& path) {
93 // TODO(kinuko): not implemented yet.
94 Send(new ViewMsg_FileSystem_DidFail(
95 request_id, WebKit::WebFileErrorAbort));
96 }
97
98 void FileSystemDispatcherHost::OnReadMetadata(
99 int request_id,
100 const string16& path) {
101 // TODO(kinuko): not implemented yet.
102 Send(new ViewMsg_FileSystem_DidFail(
103 request_id, WebKit::WebFileErrorAbort));
104 }
105
106 void FileSystemDispatcherHost::OnCreate(
107 int request_id,
108 const string16& path,
109 bool exclusive,
110 bool is_directory) {
111 // TODO(kinuko): not implemented yet.
112 Send(new ViewMsg_FileSystem_DidFail(
113 request_id, WebKit::WebFileErrorAbort));
114 }
115
116 void FileSystemDispatcherHost::OnExists(
117 int request_id,
118 const string16& path,
119 bool is_directory) {
120 // TODO(kinuko): not implemented yet.
121 Send(new ViewMsg_FileSystem_DidFail(
122 request_id, WebKit::WebFileErrorAbort));
123 }
124
125 void FileSystemDispatcherHost::OnReadDirectory(
126 int request_id,
127 const string16& path) {
128 // TODO(kinuko): not implemented yet.
129 Send(new ViewMsg_FileSystem_DidFail(
130 request_id, WebKit::WebFileErrorAbort));
131 }
132
77 void FileSystemDispatcherHost::Send(IPC::Message* message) { 133 void FileSystemDispatcherHost::Send(IPC::Message* message) {
78 if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) { 134 if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) {
79 if (!ChromeThread::PostTask( 135 if (!ChromeThread::PostTask(
80 ChromeThread::IO, FROM_HERE, 136 ChromeThread::IO, FROM_HERE,
81 NewRunnableMethod(this, 137 NewRunnableMethod(this,
82 &FileSystemDispatcherHost::Send, 138 &FileSystemDispatcherHost::Send,
83 message))) 139 message)))
84 delete message; 140 delete message;
85 return; 141 return;
86 } 142 }
87 143
88 if (!shutdown_ && message_sender_) 144 if (!shutdown_ && message_sender_)
89 message_sender_->Send(message); 145 message_sender_->Send(message);
90 else 146 else
91 delete message; 147 delete message;
92 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698