| Index: chrome/browser/file_system/file_system_dispatcher_host.cc
|
| diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc
|
| index 3e23695a5a052eca7d05fac2adce1a3cc5806277..d8768081fdae5e61355afc5a06829c39a6990e7e 100644
|
| --- a/chrome/browser/file_system/file_system_dispatcher_host.cc
|
| +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc
|
| @@ -8,19 +8,23 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chrome_thread.h"
|
| +#include "chrome/browser/file_system/file_system_host_context.h"
|
| #include "chrome/browser/host_content_settings_map.h"
|
| #include "chrome/browser/renderer_host/browser_render_process_host.h"
|
| #include "chrome/common/render_messages.h"
|
| #include "chrome/common/render_messages_params.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h"
|
| +#include "webkit/glue/webkit_glue.h"
|
|
|
| FileSystemDispatcherHost::FileSystemDispatcherHost(
|
| IPC::Message::Sender* sender,
|
| + FileSystemHostContext* file_system_host_context,
|
| HostContentSettingsMap* host_content_settings_map)
|
| : message_sender_(sender),
|
| process_handle_(0),
|
| shutdown_(false),
|
| + context_(file_system_host_context),
|
| host_content_settings_map_(host_content_settings_map) {
|
| DCHECK(message_sender_);
|
| }
|
| @@ -54,20 +58,46 @@ bool FileSystemDispatcherHost::OnMessageReceived(
|
|
|
| void FileSystemDispatcherHost::OnOpenFileSystem(
|
| const ViewHostMsg_OpenFileSystemRequest_Params& params) {
|
| - string16 name;
|
| - string16 root_path;
|
|
|
| - // TODO(kinuko): not implemented yet.
|
| + // TODO(kinuko): hook up ContentSettings cookies type checks.
|
| +
|
| + FilePath root_path;
|
| + std::string name;
|
| +
|
| + if (!context_->GetFileSystemRootPath(params.origin_url,
|
| + params.type,
|
| + &root_path,
|
| + &name)) {
|
| + Send(new ViewMsg_OpenFileSystemRequest_Complete(
|
| + params.routing_id,
|
| + params.request_id,
|
| + false,
|
| + string16(),
|
| + string16()));
|
| + return;
|
| + }
|
| +
|
| + // TODO(kinuko): creates the root directory and if it succeeds.
|
|
|
| Send(new ViewMsg_OpenFileSystemRequest_Complete(
|
| params.routing_id,
|
| params.request_id,
|
| - false,
|
| - name, root_path));
|
| + true,
|
| + UTF8ToUTF16(name),
|
| + webkit_glue::FilePathToWebString(root_path)));
|
| }
|
|
|
| void FileSystemDispatcherHost::OnMove(
|
| int request_id, const string16& src_path, const string16& dest_path) {
|
| + if (!context_->CheckValidFileSystemPath(
|
| + webkit_glue::WebStringToFilePath(src_path)) ||
|
| + !context_->CheckValidFileSystemPath(
|
| + webkit_glue::WebStringToFilePath(dest_path))) {
|
| + Send(new ViewMsg_FileSystem_Failed(
|
| + request_id, WebKit::WebFileErrorSecurity));
|
| + return;
|
| + }
|
| +
|
| // TODO(kinuko): not implemented yet.
|
|
|
| Send(new ViewMsg_FileSystem_Failed(
|
|
|