From 5c5a88eb6550c82143afec70d114a68f2bd8635b Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Sat, 12 Nov 2011 00:45:35 +0000 Subject: Remove includes of worker_messages.h from chrome code, since that's an internal detail of content. BUG=98716 Review URL: http://codereview.chromium.org/8514004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109746 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chrome_content_browser_client.cc | 76 +++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 6 deletions(-) (limited to 'chrome/browser/chrome_content_browser_client.cc') diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index dcab99b..eef9057 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -17,7 +17,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" @@ -331,11 +330,6 @@ void ChromeContentBrowserClient::PluginProcessHostCreated( host->AddFilter(new ChromePluginMessageFilter(host)); } -void ChromeContentBrowserClient::WorkerProcessHostCreated( - WorkerProcessHost* host) { - host->AddFilter(new ChromeWorkerMessageFilter(host)); -} - content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { return ChromeWebUIFactory::GetInstance(); } @@ -722,6 +716,76 @@ bool ChromeContentBrowserClient::AllowSaveLocalState( 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( + 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( + 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) { -- cgit v1.1