OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/worker_host/worker_process_host.h" | 5 #include "content/browser/worker_host/worker_process_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 OnWorkerContextClosed) | 379 OnWorkerContextClosed) |
380 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed, | 380 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed, |
381 OnWorkerContextDestroyed) | 381 OnWorkerContextDestroyed) |
382 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded, | 382 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded, |
383 OnWorkerScriptLoaded) | 383 OnWorkerScriptLoaded) |
384 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed, | 384 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed, |
385 OnWorkerScriptLoadFailed) | 385 OnWorkerScriptLoadFailed) |
386 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected, | 386 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected, |
387 OnWorkerConnected) | 387 OnWorkerConnected) |
388 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) | 388 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) |
389 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_RequestFileSystemAccessSync, | 389 IPC_MESSAGE_HANDLER_DELAY_REPLY( |
390 OnRequestFileSystemAccessSync) | 390 WorkerProcessHostMsg_RequestFileSystemAccessSync, |
| 391 OnRequestFileSystemAccessSync) |
391 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) | 392 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
392 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_ForceKillWorker, | 393 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_ForceKillWorker, |
393 OnForceKillWorkerProcess) | 394 OnForceKillWorkerProcess) |
394 IPC_MESSAGE_UNHANDLED(handled = false) | 395 IPC_MESSAGE_UNHANDLED(handled = false) |
395 IPC_END_MESSAGE_MAP() | 396 IPC_END_MESSAGE_MAP() |
396 | 397 |
397 return handled; | 398 return handled; |
398 } | 399 } |
399 | 400 |
400 // Sent to notify the browser process when a worker context invokes close(), so | 401 // Sent to notify the browser process when a worker context invokes close(), so |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 const base::string16& display_name, | 469 const base::string16& display_name, |
469 unsigned long estimated_size, | 470 unsigned long estimated_size, |
470 bool* result) { | 471 bool* result) { |
471 *result = GetContentClient()->browser()->AllowWorkerDatabase( | 472 *result = GetContentClient()->browser()->AllowWorkerDatabase( |
472 url, name, display_name, estimated_size, resource_context_, | 473 url, name, display_name, estimated_size, resource_context_, |
473 GetRenderFrameIDsForWorker(worker_route_id)); | 474 GetRenderFrameIDsForWorker(worker_route_id)); |
474 } | 475 } |
475 | 476 |
476 void WorkerProcessHost::OnRequestFileSystemAccessSync(int worker_route_id, | 477 void WorkerProcessHost::OnRequestFileSystemAccessSync(int worker_route_id, |
477 const GURL& url, | 478 const GURL& url, |
478 bool* result) { | 479 IPC::Message* reply_msg) { |
479 *result = GetContentClient()->browser()->AllowWorkerFileSystem( | 480 GetContentClient()->browser()->RequestWorkerFileSystemAccessSync( |
480 url, resource_context_, GetRenderFrameIDsForWorker(worker_route_id)); | 481 url, |
| 482 resource_context_, |
| 483 GetRenderFrameIDsForWorker(worker_route_id), |
| 484 base::Bind(&WorkerProcessHost::OnRequestFileSystemAccessSyncResponse, |
| 485 base::Unretained(this), |
| 486 reply_msg)); |
| 487 } |
| 488 |
| 489 void WorkerProcessHost::OnRequestFileSystemAccessSyncResponse( |
| 490 IPC::Message* reply_msg, |
| 491 bool allowed) { |
| 492 WorkerProcessHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg, |
| 493 allowed); |
| 494 Send(reply_msg); |
481 } | 495 } |
482 | 496 |
483 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id, | 497 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id, |
484 const GURL& url, | 498 const GURL& url, |
485 const base::string16& name, | 499 const base::string16& name, |
486 bool* result) { | 500 bool* result) { |
487 *result = GetContentClient()->browser()->AllowWorkerIndexedDB( | 501 *result = GetContentClient()->browser()->AllowWorkerIndexedDB( |
488 url, name, resource_context_, | 502 url, name, resource_context_, |
489 GetRenderFrameIDsForWorker(worker_route_id)); | 503 GetRenderFrameIDsForWorker(worker_route_id)); |
490 } | 504 } |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 return false; | 835 return false; |
822 } | 836 } |
823 | 837 |
824 WorkerProcessHost::WorkerInstance::FilterInfo | 838 WorkerProcessHost::WorkerInstance::FilterInfo |
825 WorkerProcessHost::WorkerInstance::GetFilter() const { | 839 WorkerProcessHost::WorkerInstance::GetFilter() const { |
826 DCHECK(NumFilters() == 1); | 840 DCHECK(NumFilters() == 1); |
827 return *filters_.begin(); | 841 return *filters_.begin(); |
828 } | 842 } |
829 | 843 |
830 } // namespace content | 844 } // namespace content |
OLD | NEW |