Index: chrome/browser/chrome_content_browser_client.cc |
=================================================================== |
--- chrome/browser/chrome_content_browser_client.cc (revision 109446) |
+++ chrome/browser/chrome_content_browser_client.cc (working copy) |
@@ -14,7 +14,6 @@ |
#include "chrome/browser/chrome_benchmarking_message_filter.h" |
#include "chrome/browser/chrome_plugin_message_filter.h" |
#include "chrome/browser/chrome_quota_permission_context.h" |
-#include "chrome/browser/chrome_worker_message_filter.h" |
#include "chrome/browser/content_settings/cookie_settings.h" |
#include "chrome/browser/content_settings/tab_specific_content_settings.h" |
#include "chrome/browser/download/download_util.h" |
@@ -328,11 +327,6 @@ |
host->AddFilter(new ChromePluginMessageFilter(host)); |
} |
-void ChromeContentBrowserClient::WorkerProcessHostCreated( |
- WorkerProcessHost* host) { |
- host->AddFilter(new ChromeWorkerMessageFilter(host)); |
-} |
- |
content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { |
return ChromeWebUIFactory::GetInstance(); |
} |
@@ -719,6 +713,76 @@ |
return !io_data->clear_local_state_on_exit()->GetValue(); |
} |
+bool ChromeContentBrowserClient::AllowWorkerDatabase( |
+ int worker_route_id, |
+ const GURL& url, |
+ const string16& name, |
+ const string16& display_name, |
+ unsigned long estimated_size, |
+ WorkerProcessHost* worker_process_host) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>( |
+ worker_process_host->resource_context()->GetUserData(NULL)); |
+ CookieSettings* cookie_settings = io_data->GetCookieSettings(); |
+ bool allow = cookie_settings->IsSettingCookieAllowed(url, url); |
+ |
+ // Record access to database for potential display in UI: Find the worker |
+ // instance and forward the message to all attached documents. |
+ WorkerProcessHost::Instances::const_iterator i; |
+ for (i = worker_process_host->instances().begin(); |
+ i != worker_process_host->instances().end(); ++i) { |
+ if (i->worker_route_id() != worker_route_id) |
+ continue; |
+ const WorkerDocumentSet::DocumentInfoSet& documents = |
+ i->worker_document_set()->documents(); |
+ for (WorkerDocumentSet::DocumentInfoSet::const_iterator doc = |
+ documents.begin(); doc != documents.end(); ++doc) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind( |
+ &TabSpecificContentSettings::WebDatabaseAccessed, |
+ doc->render_process_id(), doc->render_view_id(), |
+ url, name, display_name, !allow)); |
+ } |
+ break; |
+ } |
+ |
+ return allow; |
+} |
+ |
+bool ChromeContentBrowserClient::AllowWorkerFileSystem( |
+ int worker_route_id, |
+ const GURL& url, |
+ WorkerProcessHost* worker_process_host) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>( |
+ worker_process_host->resource_context()->GetUserData(NULL)); |
+ CookieSettings* cookie_settings = io_data->GetCookieSettings(); |
+ bool allow = cookie_settings->IsSettingCookieAllowed(url, url); |
+ |
+ // Record access to file system for potential display in UI: Find the worker |
+ // instance and forward the message to all attached documents. |
+ WorkerProcessHost::Instances::const_iterator i; |
+ for (i = worker_process_host->instances().begin(); |
+ i != worker_process_host->instances().end(); ++i) { |
+ if (i->worker_route_id() != worker_route_id) |
+ continue; |
+ const WorkerDocumentSet::DocumentInfoSet& documents = |
+ i->worker_document_set()->documents(); |
+ for (WorkerDocumentSet::DocumentInfoSet::const_iterator doc = |
+ documents.begin(); doc != documents.end(); ++doc) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind( |
+ &TabSpecificContentSettings::FileSystemAccessed, |
+ doc->render_process_id(), doc->render_view_id(), url, !allow)); |
+ } |
+ break; |
+ } |
+ |
+ return allow; |
+} |
+ |
net::URLRequestContext* |
ChromeContentBrowserClient::OverrideRequestContextForURL( |
const GURL& url, const content::ResourceContext& context) { |