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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/file_system/file_system_dispatcher_host.h"
6
7 #include "base/thread.h"
8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_thread.h"
11 #include "chrome/browser/host_content_settings_map.h"
12 #include "chrome/browser/renderer_host/browser_render_process_host.h"
13 #include "chrome/common/render_messages.h"
14 #include "googleurl/src/gurl.h"
15
16 FileSystemDispatcherHost::FileSystemDispatcherHost(
17 IPC::Message::Sender* sender,
18 HostContentSettingsMap* host_content_settings_map)
19 : message_sender_(sender),
20 process_handle_(0),
21 shutdown_(false),
22 host_content_settings_map_(host_content_settings_map) {
23 DCHECK(message_sender_);
24 }
25
26 void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) {
27 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
28 DCHECK(!shutdown_);
29 DCHECK(!process_handle_);
30 DCHECK(process_handle);
31 process_handle_ = process_handle;
32 }
33
34 void FileSystemDispatcherHost::Shutdown() {
35 message_sender_ = NULL;
36 shutdown_ = true;
37 }
38
39 bool FileSystemDispatcherHost::OnMessageReceived(
40 const IPC::Message& message, bool* message_was_ok) {
41 DCHECK(!shutdown_);
42 *message_was_ok = true;
43 bool handled = true;
44 IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok)
45 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenFileSystemRequest, OnOpenFileSystem)
46 // TODO(kinuko): add more.
47 IPC_MESSAGE_UNHANDLED(handled = false)
48 IPC_END_MESSAGE_MAP_EX()
49 return handled;
50 }
51
52 void FileSystemDispatcherHost::OnOpenFileSystem(
53 const ViewHostMsg_OpenFileSystemRequest_Params& params) {
54 string16 name;
55 string16 root_path;
56
57 // TODO(kinuko): not implemented yet.
58
59 Send(new ViewMsg_OpenFileSystemRequest_Complete(
60 params.routing_id,
61 params.request_id,
62 false,
63 name, root_path));
64 }
65
66 void FileSystemDispatcherHost::Send(IPC::Message* message) {
67 if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) {
68 if (!ChromeThread::PostTask(
69 ChromeThread::IO, FROM_HERE,
70 NewRunnableMethod(this,
71 &FileSystemDispatcherHost::Send,
72 message)))
73 delete message;
74 return;
75 }
76
77 if (!shutdown_ && message_sender_)
78 message_sender_->Send(message);
79 else
80 delete message;
81 }
OLDNEW
« 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