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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 return; | 440 return; |
441 } | 441 } |
442 | 442 |
443 RenderProcessHost* process = rvh->process(); | 443 RenderProcessHost* process = rvh->process(); |
444 DesktopNotificationService* service = | 444 DesktopNotificationService* service = |
445 DesktopNotificationServiceFactory::GetForProfile(process->profile()); | 445 DesktopNotificationServiceFactory::GetForProfile(process->profile()); |
446 service->CancelDesktopNotification( | 446 service->CancelDesktopNotification( |
447 render_process_id, render_view_id, notification_id); | 447 render_process_id, render_view_id, notification_id); |
448 } | 448 } |
449 | 449 |
| 450 bool ChromeContentBrowserClient::CanCreateWindow( |
| 451 const GURL& source_url, |
| 452 WindowContainerType container_type, |
| 453 const content::ResourceContext& context) { |
| 454 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 455 // If the opener is trying to create a background window but doesn't have |
| 456 // the appropriate permission, fail the attempt. |
| 457 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 458 ProfileIOData* io_data = |
| 459 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 460 const Extension* extension = |
| 461 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); |
| 462 return (extension && |
| 463 extension->HasApiPermission(Extension::kBackgroundPermission)); |
| 464 } |
| 465 return true; |
| 466 } |
| 467 |
| 468 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( |
| 469 const GURL& url, const content::ResourceContext& context) { |
| 470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 471 // Check if it's an extension-created worker, in which case we want to use |
| 472 // the name of the extension. |
| 473 ProfileIOData* io_data = |
| 474 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 475 const Extension* extension = |
| 476 io_data->GetExtensionInfoMap()->extensions().GetByID(url.host()); |
| 477 return extension ? extension->name() : std::string(); |
| 478 } |
| 479 |
450 #if defined(OS_LINUX) | 480 #if defined(OS_LINUX) |
451 int ChromeContentBrowserClient::GetCrashSignalFD( | 481 int ChromeContentBrowserClient::GetCrashSignalFD( |
452 const std::string& process_type) { | 482 const std::string& process_type) { |
453 if (process_type == switches::kRendererProcess) | 483 if (process_type == switches::kRendererProcess) |
454 return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 484 return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
455 | 485 |
456 if (process_type == switches::kPluginProcess) | 486 if (process_type == switches::kPluginProcess) |
457 return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 487 return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
458 | 488 |
459 if (process_type == switches::kPpapiPluginProcess) | 489 if (process_type == switches::kPpapiPluginProcess) |
460 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 490 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
461 | 491 |
462 if (process_type == switches::kGpuProcess) | 492 if (process_type == switches::kGpuProcess) |
463 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 493 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
464 | 494 |
465 return -1; | 495 return -1; |
466 } | 496 } |
467 #endif | 497 #endif |
468 | 498 |
469 } // namespace chrome | 499 } // namespace chrome |
OLD | NEW |