Chromium Code Reviews| Index: 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 c61aa45614f4bb122dfbe4a791392a76ff672e0f..977215feefe3c247f54d0252a1ec965492013e22 100644 |
| --- a/chrome/browser/chrome_content_browser_client.cc |
| +++ b/chrome/browser/chrome_content_browser_client.cc |
| @@ -37,6 +37,7 @@ |
| #include "chrome/common/child_process_logging.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/extensions/extension_messages.h" |
| +#include "chrome/common/extensions/user_script.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/render_messages.h" |
| #include "chrome/common/url_constants.h" |
| @@ -363,6 +364,35 @@ void ChromeContentBrowserClient::AddNewCertificate( |
| new SSLAddCertHandler(request, cert, render_process_id, render_view_id); |
| } |
| +bool ChromeContentBrowserClient::CheckBackgroundPermission( |
| + const GURL& source_url, const content::ResourceContext& context) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + ProfileIOData* io_data = |
| + reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| + |
| + const Extension* extension = |
| + io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); |
| + return (extension && |
| + extension->HasApiPermission(Extension::kBackgroundPermission)); |
| +} |
| + |
| +std::string ChromeContentBrowserClient::GetProcessHostTitle( |
| + const GURL& url, const content::ResourceContext& context) { |
| + // Check if it's an extension-created worker, in which case we want to use |
| + // the name of the extension. |
| + ProfileIOData* io_data = |
| + reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| + const Extension* extension = |
| + io_data->GetExtensionInfoMap()->extensions().GetByID(url.host()); |
|
jam
2011/06/07 23:17:53
nit: spacing
Matt Perry
2011/06/07 23:58:10
Done.
|
| + return extension ? extension->name() : std::string(); |
| +} |
| + |
| +bool ChromeContentBrowserClient::ShouldForceDownloadResource( |
| + const GURL& url, const std::string& mime_type) { |
| + // Special-case user scripts to get downloaded instead of viewed. |
| + return UserScript::IsURLUserScript(request_->url(), mime_type); |
| +} |
| + |
| #if defined(OS_LINUX) |
| int ChromeContentBrowserClient::GetCrashSignalFD( |
| const std::string& process_type) { |