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

Unified Diff: chrome/browser/file_system/file_system_dispatcher_host.cc

Issue 3107026: Add IPC plumbing code for FileSystem API's openFileSystem (Closed)
Patch Set: nits fix + rebase Created 10 years, 4 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..496a623cf07dd0cad65340f4649f49225a0bd05a
--- /dev/null
+++ b/chrome/browser/file_system/file_system_dispatcher_host.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/file_system/file_system_dispatcher_host.h"
+
+#include "base/thread.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_thread.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 "googleurl/src/gurl.h"
+
+FileSystemDispatcherHost::FileSystemDispatcherHost(
+ IPC::Message::Sender* sender,
+ HostContentSettingsMap* host_content_settings_map)
+ : message_sender_(sender),
+ process_handle_(0),
+ shutdown_(false),
+ host_content_settings_map_(host_content_settings_map) {
+ DCHECK(message_sender_);
+}
+
+void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ DCHECK(!shutdown_);
+ DCHECK(!process_handle_);
+ DCHECK(process_handle);
+ process_handle_ = process_handle;
+}
+
+void FileSystemDispatcherHost::Shutdown() {
+ message_sender_ = NULL;
+ shutdown_ = true;
+}
+
+bool FileSystemDispatcherHost::OnMessageReceived(
+ const IPC::Message& message, bool* message_was_ok) {
+ DCHECK(!shutdown_);
+ *message_was_ok = true;
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_OpenFileSystemRequest, OnOpenFileSystem)
+ // TODO(kinuko): add more.
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+ return handled;
+}
+
+void FileSystemDispatcherHost::OnOpenFileSystem(
+ const ViewHostMsg_OpenFileSystemRequest_Params& params) {
+ string16 name;
+ string16 root_path;
+
+ // TODO(kinuko): not implemented yet.
+
+ Send(new ViewMsg_OpenFileSystemRequest_Complete(
+ params.routing_id,
+ params.request_id,
+ false,
+ name, root_path));
+}
+
+void FileSystemDispatcherHost::Send(IPC::Message* message) {
+ if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) {
+ if (!ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableMethod(this,
+ &FileSystemDispatcherHost::Send,
+ message)))
+ delete message;
+ return;
+ }
+
+ if (!shutdown_ && message_sender_)
+ message_sender_->Send(message);
+ else
+ delete message;
+}
« no previous file with comments | « chrome/browser/file_system/file_system_dispatcher_host.h ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698