OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/thread.h" | 11 #include "base/thread.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
14 #include "chrome/browser/file_system/browser_file_system_context.h" | |
15 #include "chrome/browser/net/chrome_url_request_context.h" | 14 #include "chrome/browser/net/chrome_url_request_context.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 16 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
18 #include "chrome/common/net/url_request_context_getter.h" | 17 #include "chrome/common/net/url_request_context_getter.h" |
19 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
20 #include "chrome/common/render_messages_params.h" | 19 #include "chrome/common/render_messages_params.h" |
21 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
22 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
23 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 22 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
24 #include "webkit/fileapi/file_system_operation.h" | 23 #include "webkit/fileapi/file_system_operation.h" |
25 #include "webkit/fileapi/file_system_path_manager.h" | 24 #include "webkit/fileapi/file_system_path_manager.h" |
26 #include "webkit/fileapi/file_system_quota_manager.h" | 25 #include "webkit/fileapi/file_system_quota_manager.h" |
| 26 #include "webkit/fileapi/sandboxed_file_system_context.h" |
27 #include "webkit/fileapi/sandboxed_file_system_operation.h" | 27 #include "webkit/fileapi/sandboxed_file_system_operation.h" |
28 | 28 |
29 using fileapi::FileSystemCallbackDispatcher; | 29 using fileapi::FileSystemCallbackDispatcher; |
30 using fileapi::FileSystemQuotaManager; | 30 using fileapi::FileSystemQuotaManager; |
31 using fileapi::SandboxedFileSystemOperation; | 31 using fileapi::SandboxedFileSystemOperation; |
32 | 32 |
33 class BrowserFileSystemCallbackDispatcher | 33 class BrowserFileSystemCallbackDispatcher |
34 : public FileSystemCallbackDispatcher { | 34 : public FileSystemCallbackDispatcher { |
35 public: | 35 public: |
36 BrowserFileSystemCallbackDispatcher( | 36 BrowserFileSystemCallbackDispatcher( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 }; | 82 }; |
83 | 83 |
84 FileSystemDispatcherHost::FileSystemDispatcherHost(Profile* profile) | 84 FileSystemDispatcherHost::FileSystemDispatcherHost(Profile* profile) |
85 : context_(profile->GetFileSystemContext()), | 85 : context_(profile->GetFileSystemContext()), |
86 host_content_settings_map_(profile->GetHostContentSettingsMap()), | 86 host_content_settings_map_(profile->GetHostContentSettingsMap()), |
87 request_context_getter_(profile->GetRequestContext()) { | 87 request_context_getter_(profile->GetRequestContext()) { |
88 } | 88 } |
89 | 89 |
90 FileSystemDispatcherHost::FileSystemDispatcherHost( | 90 FileSystemDispatcherHost::FileSystemDispatcherHost( |
91 ChromeURLRequestContext* context) | 91 ChromeURLRequestContext* context) |
92 : context_(context->browser_file_system_context()), | 92 : context_(context->file_system_context()), |
93 host_content_settings_map_(context->host_content_settings_map()), | 93 host_content_settings_map_(context->host_content_settings_map()), |
94 request_context_(context) { | 94 request_context_(context) { |
95 } | 95 } |
96 | 96 |
97 FileSystemDispatcherHost::~FileSystemDispatcherHost() { | 97 FileSystemDispatcherHost::~FileSystemDispatcherHost() { |
98 } | 98 } |
99 | 99 |
100 void FileSystemDispatcherHost::OnChannelConnected(int32 peer_pid) { | 100 void FileSystemDispatcherHost::OnChannelConnected(int32 peer_pid) { |
101 BrowserMessageFilter::OnChannelConnected(peer_pid); | 101 BrowserMessageFilter::OnChannelConnected(peer_pid); |
102 | 102 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 SandboxedFileSystemOperation* FileSystemDispatcherHost::GetNewOperation( | 235 SandboxedFileSystemOperation* FileSystemDispatcherHost::GetNewOperation( |
236 int request_id) { | 236 int request_id) { |
237 BrowserFileSystemCallbackDispatcher* dispatcher = | 237 BrowserFileSystemCallbackDispatcher* dispatcher = |
238 new BrowserFileSystemCallbackDispatcher(this, request_id); | 238 new BrowserFileSystemCallbackDispatcher(this, request_id); |
239 SandboxedFileSystemOperation* operation = new SandboxedFileSystemOperation( | 239 SandboxedFileSystemOperation* operation = new SandboxedFileSystemOperation( |
240 dispatcher, | 240 dispatcher, |
241 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 241 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
242 context_.get()); | 242 context_); |
243 operations_.AddWithID(operation, request_id); | 243 operations_.AddWithID(operation, request_id); |
244 return operation; | 244 return operation; |
245 } | 245 } |
246 | 246 |
247 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { | 247 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { |
248 DCHECK(operations_.Lookup(request_id)); | 248 DCHECK(operations_.Lookup(request_id)); |
249 operations_.Remove(request_id); | 249 operations_.Remove(request_id); |
250 } | 250 } |
OLD | NEW |