| 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/accessibility/browser_accessibility_state.h" | 9 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 477 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
| 478 const GURL& source_url, | 478 const GURL& source_url, |
| 479 const content::ResourceContext& context) { | 479 const content::ResourceContext& context) { |
| 480 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 480 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 481 ProfileIOData* io_data = | 481 ProfileIOData* io_data = |
| 482 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 482 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 483 | 483 |
| 484 const Extension* extension = | 484 const Extension* extension = |
| 485 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); | 485 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); |
| 486 if (extension && | 486 if (extension && |
| 487 extension->HasApiPermission(Extension::kNotificationPermission)) { | 487 extension->HasAPIPermission(ExtensionAPIPermission::kNotification)) { |
| 488 return WebKit::WebNotificationPresenter::PermissionAllowed; | 488 return WebKit::WebNotificationPresenter::PermissionAllowed; |
| 489 } | 489 } |
| 490 | 490 |
| 491 // Fall back to the regular notification preferences, which works on an | 491 // Fall back to the regular notification preferences, which works on an |
| 492 // origin basis. | 492 // origin basis. |
| 493 return io_data->GetNotificationService() ? | 493 return io_data->GetNotificationService() ? |
| 494 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) : | 494 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) : |
| 495 WebKit::WebNotificationPresenter::PermissionNotAllowed; | 495 WebKit::WebNotificationPresenter::PermissionNotAllowed; |
| 496 } | 496 } |
| 497 | 497 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 const content::ResourceContext& context) { | 540 const content::ResourceContext& context) { |
| 541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 542 // If the opener is trying to create a background window but doesn't have | 542 // If the opener is trying to create a background window but doesn't have |
| 543 // the appropriate permission, fail the attempt. | 543 // the appropriate permission, fail the attempt. |
| 544 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { | 544 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 545 ProfileIOData* io_data = | 545 ProfileIOData* io_data = |
| 546 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); | 546 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 547 const Extension* extension = | 547 const Extension* extension = |
| 548 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); | 548 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); |
| 549 return (extension && | 549 return (extension && |
| 550 extension->HasApiPermission(Extension::kBackgroundPermission)); | 550 extension->HasAPIPermission(ExtensionAPIPermission::kBackground)); |
| 551 } | 551 } |
| 552 return true; | 552 return true; |
| 553 } | 553 } |
| 554 | 554 |
| 555 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( | 555 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( |
| 556 const GURL& url, const content::ResourceContext& context) { | 556 const GURL& url, const content::ResourceContext& context) { |
| 557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 558 // Check if it's an extension-created worker, in which case we want to use | 558 // Check if it's an extension-created worker, in which case we want to use |
| 559 // the name of the extension. | 559 // the name of the extension. |
| 560 ProfileIOData* io_data = | 560 ProfileIOData* io_data = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 #if defined(USE_NSS) | 595 #if defined(USE_NSS) |
| 596 crypto::CryptoModuleBlockingPasswordDelegate* | 596 crypto::CryptoModuleBlockingPasswordDelegate* |
| 597 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 597 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 598 const GURL& url) { | 598 const GURL& url) { |
| 599 return browser::NewCryptoModuleBlockingDialogDelegate( | 599 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 600 browser::kCryptoModulePasswordKeygen, url.host()); | 600 browser::kCryptoModulePasswordKeygen, url.host()); |
| 601 } | 601 } |
| 602 #endif | 602 #endif |
| 603 | 603 |
| 604 } // namespace chrome | 604 } // namespace chrome |
| OLD | NEW |