Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/app/breakpad_mac.h" | 8 #include "chrome/app/breakpad_mac.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/character_encoding.h" | 10 #include "chrome/browser/character_encoding.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "chrome/browser/spellcheck_message_filter.h" | 30 #include "chrome/browser/spellcheck_message_filter.h" |
| 31 #include "chrome/browser/ssl/ssl_add_cert_handler.h" | 31 #include "chrome/browser/ssl/ssl_add_cert_handler.h" |
| 32 #include "chrome/browser/ssl/ssl_blocking_page.h" | 32 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 33 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 33 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 34 #include "chrome/browser/tab_contents/tab_util.h" | 34 #include "chrome/browser/tab_contents/tab_util.h" |
| 35 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 35 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 36 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 36 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
| 37 #include "chrome/common/child_process_logging.h" | 37 #include "chrome/common/child_process_logging.h" |
| 38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/extensions/extension_messages.h" | 39 #include "chrome/common/extensions/extension_messages.h" |
| 40 #include "chrome/common/extensions/user_script.h" | |
| 40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/common/render_messages.h" | 42 #include "chrome/common/render_messages.h" |
| 42 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 43 #include "content/browser/browsing_instance.h" | 44 #include "content/browser/browsing_instance.h" |
| 44 #include "content/browser/child_process_security_policy.h" | 45 #include "content/browser/child_process_security_policy.h" |
| 45 #include "content/browser/plugin_process_host.h" | 46 #include "content/browser/plugin_process_host.h" |
| 46 #include "content/browser/renderer_host/browser_render_process_host.h" | 47 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 47 #include "content/browser/renderer_host/render_view_host.h" | 48 #include "content/browser/renderer_host/render_view_host.h" |
| 48 #include "content/browser/resource_context.h" | 49 #include "content/browser/resource_context.h" |
| 49 #include "content/browser/site_instance.h" | 50 #include "content/browser/site_instance.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 | 357 |
| 357 void ChromeContentBrowserClient::AddNewCertificate( | 358 void ChromeContentBrowserClient::AddNewCertificate( |
| 358 net::URLRequest* request, | 359 net::URLRequest* request, |
| 359 net::X509Certificate* cert, | 360 net::X509Certificate* cert, |
| 360 int render_process_id, | 361 int render_process_id, |
| 361 int render_view_id) { | 362 int render_view_id) { |
| 362 // The handler will run the UI and delete itself when it's finished. | 363 // The handler will run the UI and delete itself when it's finished. |
| 363 new SSLAddCertHandler(request, cert, render_process_id, render_view_id); | 364 new SSLAddCertHandler(request, cert, render_process_id, render_view_id); |
| 364 } | 365 } |
| 365 | 366 |
| 367 bool ChromeContentBrowserClient::CheckBackgroundPermission( | |
| 368 const GURL& source_url, const content::ResourceContext& context) { | |
| 369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 370 ProfileIOData* io_data = | |
| 371 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | |
| 372 | |
| 373 const Extension* extension = | |
| 374 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); | |
| 375 return (extension && | |
| 376 extension->HasApiPermission(Extension::kBackgroundPermission)); | |
| 377 } | |
| 378 | |
| 379 std::string ChromeContentBrowserClient::GetProcessHostTitle( | |
| 380 const GURL& url, const content::ResourceContext& context) { | |
| 381 // Check if it's an extension-created worker, in which case we want to use | |
| 382 // the name of the extension. | |
| 383 ProfileIOData* io_data = | |
| 384 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | |
| 385 const Extension* extension = | |
| 386 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.
| |
| 387 return extension ? extension->name() : std::string(); | |
| 388 } | |
| 389 | |
| 390 bool ChromeContentBrowserClient::ShouldForceDownloadResource( | |
| 391 const GURL& url, const std::string& mime_type) { | |
| 392 // Special-case user scripts to get downloaded instead of viewed. | |
| 393 return UserScript::IsURLUserScript(request_->url(), mime_type); | |
| 394 } | |
| 395 | |
| 366 #if defined(OS_LINUX) | 396 #if defined(OS_LINUX) |
| 367 int ChromeContentBrowserClient::GetCrashSignalFD( | 397 int ChromeContentBrowserClient::GetCrashSignalFD( |
| 368 const std::string& process_type) { | 398 const std::string& process_type) { |
| 369 if (process_type == switches::kRendererProcess) | 399 if (process_type == switches::kRendererProcess) |
| 370 return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 400 return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 371 | 401 |
| 372 if (process_type == switches::kPluginProcess) | 402 if (process_type == switches::kPluginProcess) |
| 373 return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 403 return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 374 | 404 |
| 375 if (process_type == switches::kPpapiPluginProcess) | 405 if (process_type == switches::kPpapiPluginProcess) |
| 376 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 406 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 377 | 407 |
| 378 if (process_type == switches::kGpuProcess) | 408 if (process_type == switches::kGpuProcess) |
| 379 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 409 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 380 | 410 |
| 381 return -1; | 411 return -1; |
| 382 } | 412 } |
| 383 #endif | 413 #endif |
| 384 | 414 |
| 385 } // namespace chrome | 415 } // namespace chrome |
| OLD | NEW |