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/renderer_host/resource_message_filter.h" | 5 #include "chrome/browser/renderer_host/resource_message_filter.h" |
6 | 6 |
7 #include "app/clipboard/clipboard.h" | 7 #include "app/clipboard/clipboard.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "chrome/browser/plugin_updater.h" | 47 #include "chrome/browser/plugin_updater.h" |
48 #include "chrome/browser/plugin_service.h" | 48 #include "chrome/browser/plugin_service.h" |
49 #include "chrome/browser/prefs/pref_service.h" | 49 #include "chrome/browser/prefs/pref_service.h" |
50 #include "chrome/browser/printing/print_job_manager.h" | 50 #include "chrome/browser/printing/print_job_manager.h" |
51 #include "chrome/browser/printing/printer_query.h" | 51 #include "chrome/browser/printing/printer_query.h" |
52 #include "chrome/browser/profile.h" | 52 #include "chrome/browser/profile.h" |
53 #include "chrome/browser/renderer_host/audio_renderer_host.h" | 53 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
54 #include "chrome/browser/renderer_host/blob_dispatcher_host.h" | 54 #include "chrome/browser/renderer_host/blob_dispatcher_host.h" |
55 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 55 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
56 #include "chrome/browser/renderer_host/database_dispatcher_host.h" | 56 #include "chrome/browser/renderer_host/database_dispatcher_host.h" |
| 57 #include "chrome/browser/renderer_host/file_utilities_dispatcher_host.h" |
57 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" | 58 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" |
58 #include "chrome/browser/renderer_host/render_widget_helper.h" | 59 #include "chrome/browser/renderer_host/render_widget_helper.h" |
59 #include "chrome/browser/search_engines/search_provider_install_state_dispatcher
_host.h" | 60 #include "chrome/browser/search_engines/search_provider_install_state_dispatcher
_host.h" |
60 #include "chrome/browser/speech/speech_input_dispatcher_host.h" | 61 #include "chrome/browser/speech/speech_input_dispatcher_host.h" |
61 #include "chrome/browser/spellchecker_platform_engine.h" | 62 #include "chrome/browser/spellchecker_platform_engine.h" |
62 #include "chrome/browser/task_manager/task_manager.h" | 63 #include "chrome/browser/task_manager/task_manager.h" |
63 #include "chrome/browser/ui_thread_helpers.h" | 64 #include "chrome/browser/ui_thread_helpers.h" |
64 #include "chrome/browser/worker_host/message_port_dispatcher.h" | 65 #include "chrome/browser/worker_host/message_port_dispatcher.h" |
65 #include "chrome/browser/worker_host/worker_service.h" | 66 #include "chrome/browser/worker_host/worker_service.h" |
66 #include "chrome/common/child_process_host.h" | 67 #include "chrome/common/child_process_host.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 ViewHostMsg_ClearCache::WriteReplyParams(reply_msg_, params.a); | 190 ViewHostMsg_ClearCache::WriteReplyParams(reply_msg_, params.a); |
190 filter_->Send(reply_msg_); | 191 filter_->Send(reply_msg_); |
191 delete this; | 192 delete this; |
192 } | 193 } |
193 | 194 |
194 private: | 195 private: |
195 IPC::Message* reply_msg_; | 196 IPC::Message* reply_msg_; |
196 scoped_refptr<ResourceMessageFilter> filter_; | 197 scoped_refptr<ResourceMessageFilter> filter_; |
197 }; | 198 }; |
198 | 199 |
199 void WriteFileSize(IPC::Message* reply_msg, | |
200 const base::PlatformFileInfo& file_info) { | |
201 ViewHostMsg_GetFileSize::WriteReplyParams(reply_msg, file_info.size); | |
202 } | |
203 | |
204 void WriteFileModificationTime(IPC::Message* reply_msg, | |
205 const base::PlatformFileInfo& file_info) { | |
206 ViewHostMsg_GetFileModificationTime::WriteReplyParams( | |
207 reply_msg, file_info.last_modified); | |
208 } | |
209 | |
210 } // namespace | 200 } // namespace |
211 | 201 |
212 ResourceMessageFilter::ResourceMessageFilter( | 202 ResourceMessageFilter::ResourceMessageFilter( |
213 ResourceDispatcherHost* resource_dispatcher_host, | 203 ResourceDispatcherHost* resource_dispatcher_host, |
214 int child_id, | 204 int child_id, |
215 AudioRendererHost* audio_renderer_host, | 205 AudioRendererHost* audio_renderer_host, |
216 PluginService* plugin_service, | 206 PluginService* plugin_service, |
217 printing::PrintJobManager* print_job_manager, | 207 printing::PrintJobManager* print_job_manager, |
218 Profile* profile, | 208 Profile* profile, |
219 RenderWidgetHelper* render_widget_helper) | 209 RenderWidgetHelper* render_widget_helper) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ALLOW_THIS_IN_INITIALIZER_LIST( | 241 ALLOW_THIS_IN_INITIALIZER_LIST( |
252 search_provider_install_state_dispatcher_host_( | 242 search_provider_install_state_dispatcher_host_( |
253 new SearchProviderInstallStateDispatcherHost(this, profile, | 243 new SearchProviderInstallStateDispatcherHost(this, profile, |
254 child_id))), | 244 child_id))), |
255 ALLOW_THIS_IN_INITIALIZER_LIST(device_orientation_dispatcher_host_( | 245 ALLOW_THIS_IN_INITIALIZER_LIST(device_orientation_dispatcher_host_( |
256 new device_orientation::DispatcherHost(this->id()))), | 246 new device_orientation::DispatcherHost(this->id()))), |
257 ALLOW_THIS_IN_INITIALIZER_LIST(file_system_dispatcher_host_( | 247 ALLOW_THIS_IN_INITIALIZER_LIST(file_system_dispatcher_host_( |
258 new FileSystemDispatcherHost(this, profile))), | 248 new FileSystemDispatcherHost(this, profile))), |
259 ALLOW_THIS_IN_INITIALIZER_LIST(blob_dispatcher_host_( | 249 ALLOW_THIS_IN_INITIALIZER_LIST(blob_dispatcher_host_( |
260 new BlobDispatcherHost( | 250 new BlobDispatcherHost( |
261 this->id(), profile->GetBlobStorageContext()))) { | 251 this->id(), profile->GetBlobStorageContext()))), |
| 252 ALLOW_THIS_IN_INITIALIZER_LIST(file_utilities_dispatcher_host_( |
| 253 new FileUtilitiesDispatcherHost(this, this->id()))) { |
262 request_context_ = profile_->GetRequestContext(); | 254 request_context_ = profile_->GetRequestContext(); |
263 DCHECK(request_context_); | 255 DCHECK(request_context_); |
264 DCHECK(media_request_context_); | 256 DCHECK(media_request_context_); |
265 DCHECK(audio_renderer_host_.get()); | 257 DCHECK(audio_renderer_host_.get()); |
266 DCHECK(appcache_dispatcher_host_.get()); | 258 DCHECK(appcache_dispatcher_host_.get()); |
267 DCHECK(dom_storage_dispatcher_host_.get()); | 259 DCHECK(dom_storage_dispatcher_host_.get()); |
268 | 260 |
269 render_widget_helper_->Init(id(), resource_dispatcher_host_); | 261 render_widget_helper_->Init(id(), resource_dispatcher_host_); |
270 #if defined(OS_CHROMEOS) | 262 #if defined(OS_CHROMEOS) |
271 cloud_print_enabled_ = true; | 263 cloud_print_enabled_ = true; |
(...skipping 15 matching lines...) Expand all Loading... |
287 | 279 |
288 // Shut down the database dispatcher host. | 280 // Shut down the database dispatcher host. |
289 db_dispatcher_host_->Shutdown(); | 281 db_dispatcher_host_->Shutdown(); |
290 | 282 |
291 // Shut down the async file_system dispatcher host. | 283 // Shut down the async file_system dispatcher host. |
292 file_system_dispatcher_host_->Shutdown(); | 284 file_system_dispatcher_host_->Shutdown(); |
293 | 285 |
294 // Shut down the blob dispatcher host. | 286 // Shut down the blob dispatcher host. |
295 blob_dispatcher_host_->Shutdown(); | 287 blob_dispatcher_host_->Shutdown(); |
296 | 288 |
| 289 // Shut down the async file_utilities dispatcher host. |
| 290 file_utilities_dispatcher_host_->Shutdown(); |
| 291 |
297 // Let interested observers know we are being deleted. | 292 // Let interested observers know we are being deleted. |
298 NotificationService::current()->Notify( | 293 NotificationService::current()->Notify( |
299 NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, | 294 NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, |
300 Source<ResourceMessageFilter>(this), | 295 Source<ResourceMessageFilter>(this), |
301 NotificationService::NoDetails()); | 296 NotificationService::NoDetails()); |
302 | 297 |
303 if (handle()) | 298 if (handle()) |
304 base::CloseProcessHandle(handle()); | 299 base::CloseProcessHandle(handle()); |
305 } | 300 } |
306 | 301 |
(...skipping 16 matching lines...) Expand all Loading... |
323 // Hook AudioRendererHost to this object after channel is connected so it can | 318 // Hook AudioRendererHost to this object after channel is connected so it can |
324 // this object for sending messages. | 319 // this object for sending messages. |
325 audio_renderer_host_->IPCChannelConnected(id(), handle(), this); | 320 audio_renderer_host_->IPCChannelConnected(id(), handle(), this); |
326 | 321 |
327 WorkerService::GetInstance()->Initialize(resource_dispatcher_host_); | 322 WorkerService::GetInstance()->Initialize(resource_dispatcher_host_); |
328 appcache_dispatcher_host_->Initialize(this); | 323 appcache_dispatcher_host_->Initialize(this); |
329 dom_storage_dispatcher_host_->Init(id(), handle()); | 324 dom_storage_dispatcher_host_->Init(id(), handle()); |
330 indexed_db_dispatcher_host_->Init(id(), handle()); | 325 indexed_db_dispatcher_host_->Init(id(), handle()); |
331 db_dispatcher_host_->Init(handle()); | 326 db_dispatcher_host_->Init(handle()); |
332 file_system_dispatcher_host_->Init(handle()); | 327 file_system_dispatcher_host_->Init(handle()); |
| 328 file_utilities_dispatcher_host_->Init(handle()); |
333 } | 329 } |
334 | 330 |
335 void ResourceMessageFilter::OnChannelError() { | 331 void ResourceMessageFilter::OnChannelError() { |
336 NotificationService::current()->Notify( | 332 NotificationService::current()->Notify( |
337 NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, | 333 NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, |
338 Source<ResourceMessageFilter>(this), | 334 Source<ResourceMessageFilter>(this), |
339 NotificationService::NoDetails()); | 335 NotificationService::NoDetails()); |
340 } | 336 } |
341 | 337 |
342 // Called on the IPC thread: | 338 // Called on the IPC thread: |
(...skipping 20 matching lines...) Expand all Loading... |
363 audio_renderer_host_->OnMessageReceived(msg, &msg_is_ok) || | 359 audio_renderer_host_->OnMessageReceived(msg, &msg_is_ok) || |
364 db_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || | 360 db_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || |
365 mp_dispatcher->OnMessageReceived( | 361 mp_dispatcher->OnMessageReceived( |
366 msg, this, next_route_id_callback(), &msg_is_ok) || | 362 msg, this, next_route_id_callback(), &msg_is_ok) || |
367 geolocation_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || | 363 geolocation_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || |
368 speech_input_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || | 364 speech_input_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || |
369 search_provider_install_state_dispatcher_host_->OnMessageReceived( | 365 search_provider_install_state_dispatcher_host_->OnMessageReceived( |
370 msg, &msg_is_ok) || | 366 msg, &msg_is_ok) || |
371 device_orientation_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || | 367 device_orientation_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || |
372 file_system_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || | 368 file_system_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || |
373 blob_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok); | 369 blob_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok) || |
| 370 file_utilities_dispatcher_host_->OnMessageReceived(msg, &msg_is_ok); |
374 | 371 |
375 if (!handled) { | 372 if (!handled) { |
376 DCHECK(msg_is_ok); // It should have been marked handled if it wasn't OK. | 373 DCHECK(msg_is_ok); // It should have been marked handled if it wasn't OK. |
377 handled = true; | 374 handled = true; |
378 IPC_BEGIN_MESSAGE_MAP_EX(ResourceMessageFilter, msg, msg_is_ok) | 375 IPC_BEGIN_MESSAGE_MAP_EX(ResourceMessageFilter, msg, msg_is_ok) |
379 // On Linux we need to dispatch these messages to the UI2 thread | 376 // On Linux we need to dispatch these messages to the UI2 thread |
380 // because we cannot make X calls from the IO thread. Mac | 377 // because we cannot make X calls from the IO thread. Mac |
381 // doesn't have windowed plug-ins so we handle the messages in | 378 // doesn't have windowed plug-ins so we handle the messages in |
382 // the UI thread. On Windows, we intercept the messages and | 379 // the UI thread. On Windows, we intercept the messages and |
383 // handle them directly. | 380 // handle them directly. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, | 500 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, |
504 OnOpenChannelToExtension) | 501 OnOpenChannelToExtension) |
505 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToTab, OnOpenChannelToTab) | 502 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToTab, OnOpenChannelToTab) |
506 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseCurrentConnections, | 503 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseCurrentConnections, |
507 OnCloseCurrentConnections) | 504 OnCloseCurrentConnections) |
508 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, OnSetCacheMode) | 505 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, OnSetCacheMode) |
509 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache) | 506 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache) |
510 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata, | 507 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata, |
511 OnCacheableMetadataAvailable) | 508 OnCacheableMetadataAvailable) |
512 IPC_MESSAGE_HANDLER(ViewHostMsg_EnableSpdy, OnEnableSpdy) | 509 IPC_MESSAGE_HANDLER(ViewHostMsg_EnableSpdy, OnEnableSpdy) |
513 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, OnGetFileSize) | |
514 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileModificationTime, | |
515 OnGetFileModificationTime) | |
516 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenFile, OnOpenFile) | |
517 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen) | 510 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen) |
518 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetExtensionMessageBundle, | 511 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetExtensionMessageBundle, |
519 OnGetExtensionMessageBundle) | 512 OnGetExtensionMessageBundle) |
520 #if defined(USE_TCMALLOC) | 513 #if defined(USE_TCMALLOC) |
521 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc) | 514 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc) |
522 #endif | 515 #endif |
523 IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel, | 516 IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel, |
524 OnEstablishGpuChannel) | 517 OnEstablishGpuChannel) |
525 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SynchronizeGpu, | 518 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SynchronizeGpu, |
526 OnSynchronizeGpu) | 519 OnSynchronizeGpu) |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 // TODO(lzheng): This only enables spdy over ssl. Enable spdy for http | 1474 // TODO(lzheng): This only enables spdy over ssl. Enable spdy for http |
1482 // when needed. | 1475 // when needed. |
1483 void ResourceMessageFilter::OnEnableSpdy(bool enable) { | 1476 void ResourceMessageFilter::OnEnableSpdy(bool enable) { |
1484 if (enable) { | 1477 if (enable) { |
1485 net::HttpNetworkLayer::EnableSpdy("npn,force-alt-protocols"); | 1478 net::HttpNetworkLayer::EnableSpdy("npn,force-alt-protocols"); |
1486 } else { | 1479 } else { |
1487 net::HttpNetworkLayer::EnableSpdy("npn-http"); | 1480 net::HttpNetworkLayer::EnableSpdy("npn-http"); |
1488 } | 1481 } |
1489 } | 1482 } |
1490 | 1483 |
1491 void ResourceMessageFilter::OnGetFileSize(const FilePath& path, | |
1492 IPC::Message* reply_msg) { | |
1493 // Get file size only when the child process has been granted permission to | |
1494 // upload the file. | |
1495 if (!ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) { | |
1496 ViewHostMsg_GetFileSize::WriteReplyParams( | |
1497 reply_msg, static_cast<int64>(-1)); | |
1498 Send(reply_msg); | |
1499 return; | |
1500 } | |
1501 | |
1502 // Getting file size could take long time if it lives on a network share, | |
1503 // so run it on FILE thread. | |
1504 BrowserThread::PostTask( | |
1505 BrowserThread::FILE, FROM_HERE, | |
1506 NewRunnableMethod( | |
1507 this, &ResourceMessageFilter::OnGetFileInfoOnFileThread, path, | |
1508 reply_msg, &WriteFileSize)); | |
1509 } | |
1510 | |
1511 void ResourceMessageFilter::OnGetFileModificationTime(const FilePath& path, | |
1512 IPC::Message* reply_msg) { | |
1513 // Get file modification time only when the child process has been granted | |
1514 // permission to upload the file. | |
1515 if (!ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) { | |
1516 ViewHostMsg_GetFileModificationTime::WriteReplyParams(reply_msg, | |
1517 base::Time()); | |
1518 Send(reply_msg); | |
1519 return; | |
1520 } | |
1521 | |
1522 // Getting file modification time could take a long time if it lives on a | |
1523 // network share, so run it on the FILE thread. | |
1524 BrowserThread::PostTask( | |
1525 BrowserThread::FILE, FROM_HERE, | |
1526 NewRunnableMethod( | |
1527 this, &ResourceMessageFilter::OnGetFileInfoOnFileThread, | |
1528 path, reply_msg, &WriteFileModificationTime)); | |
1529 } | |
1530 | |
1531 void ResourceMessageFilter::OnGetFileInfoOnFileThread( | |
1532 const FilePath& path, | |
1533 IPC::Message* reply_msg, | |
1534 FileInfoWriteFunc write_func) { | |
1535 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | |
1536 | |
1537 base::PlatformFileInfo file_info; | |
1538 file_info.size = 0; | |
1539 file_util::GetFileInfo(path, &file_info); | |
1540 | |
1541 (*write_func)(reply_msg, file_info); | |
1542 | |
1543 BrowserThread::PostTask( | |
1544 BrowserThread::IO, FROM_HERE, | |
1545 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); | |
1546 } | |
1547 | |
1548 void ResourceMessageFilter::OnOpenFile(const FilePath& path, | |
1549 int mode, | |
1550 IPC::Message* reply_msg) { | |
1551 // Open the file only when the child process has been granted permission to | |
1552 // upload the file. | |
1553 // TODO(jianli): Do we need separate permission to control opening the file? | |
1554 if (!ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) { | |
1555 ViewHostMsg_OpenFile::WriteReplyParams( | |
1556 reply_msg, | |
1557 #if defined(OS_WIN) | |
1558 base::kInvalidPlatformFileValue | |
1559 #elif defined(OS_POSIX) | |
1560 base::FileDescriptor(base::kInvalidPlatformFileValue, true) | |
1561 #endif | |
1562 ); | |
1563 Send(reply_msg); | |
1564 return; | |
1565 } | |
1566 | |
1567 // Opening the file could take a long time if it lives on a network share, | |
1568 // so run it on the FILE thread. | |
1569 BrowserThread::PostTask( | |
1570 BrowserThread::FILE, FROM_HERE, | |
1571 NewRunnableMethod( | |
1572 this, &ResourceMessageFilter::OnOpenFileOnFileThread, | |
1573 path, mode, reply_msg)); | |
1574 } | |
1575 | |
1576 void ResourceMessageFilter::OnOpenFileOnFileThread(const FilePath& path, | |
1577 int mode, | |
1578 IPC::Message* reply_msg) { | |
1579 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | |
1580 | |
1581 base::PlatformFile file_handle = base::CreatePlatformFile( | |
1582 path, | |
1583 (mode == 0) ? (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ) | |
1584 : (base::PLATFORM_FILE_CREATE_ALWAYS | | |
1585 base::PLATFORM_FILE_WRITE), | |
1586 NULL, NULL); | |
1587 | |
1588 base::PlatformFile target_file_handle; | |
1589 #if defined(OS_WIN) | |
1590 // Duplicate the file handle so that the renderer process can access the file. | |
1591 if (!DuplicateHandle(GetCurrentProcess(), file_handle, | |
1592 handle(), &target_file_handle, 0, false, | |
1593 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { | |
1594 // file_handle is closed whether or not DuplicateHandle succeeds. | |
1595 target_file_handle = INVALID_HANDLE_VALUE; | |
1596 } | |
1597 #else | |
1598 target_file_handle = file_handle; | |
1599 #endif | |
1600 | |
1601 ViewHostMsg_OpenFile::WriteReplyParams( | |
1602 reply_msg, | |
1603 #if defined(OS_WIN) | |
1604 target_file_handle | |
1605 #elif defined(OS_POSIX) | |
1606 base::FileDescriptor(target_file_handle, true) | |
1607 #endif | |
1608 ); | |
1609 | |
1610 BrowserThread::PostTask( | |
1611 BrowserThread::IO, FROM_HERE, | |
1612 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); | |
1613 } | |
1614 | |
1615 void ResourceMessageFilter::OnKeygen(uint32 key_size_index, | 1484 void ResourceMessageFilter::OnKeygen(uint32 key_size_index, |
1616 const std::string& challenge_string, | 1485 const std::string& challenge_string, |
1617 const GURL& url, | 1486 const GURL& url, |
1618 IPC::Message* reply_msg) { | 1487 IPC::Message* reply_msg) { |
1619 // Map displayed strings indicating level of keysecurity in the <keygen> | 1488 // Map displayed strings indicating level of keysecurity in the <keygen> |
1620 // menu to the key size in bits. (See SSLKeyGeneratorChromium.cpp in WebCore.) | 1489 // menu to the key size in bits. (See SSLKeyGeneratorChromium.cpp in WebCore.) |
1621 int key_size_in_bits; | 1490 int key_size_in_bits; |
1622 switch (key_size_index) { | 1491 switch (key_size_index) { |
1623 case 0: | 1492 case 0: |
1624 key_size_in_bits = 2048; | 1493 key_size_in_bits = 2048; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 | 1731 |
1863 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies); | 1732 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies); |
1864 filter_->Send(reply_msg_); | 1733 filter_->Send(reply_msg_); |
1865 delete this; | 1734 delete this; |
1866 } | 1735 } |
1867 } | 1736 } |
1868 | 1737 |
1869 void GetCookiesCompletion::set_cookie_store(CookieStore* cookie_store) { | 1738 void GetCookiesCompletion::set_cookie_store(CookieStore* cookie_store) { |
1870 cookie_store_ = cookie_store; | 1739 cookie_store_ = cookie_store; |
1871 } | 1740 } |
OLD | NEW |