Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7003098: Start refractoring extension permissions into ExtensionPermissionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup and update ExtensionPermissionSet data model. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 474 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
475 const GURL& source_url, 475 const GURL& source_url,
476 const content::ResourceContext& context) { 476 const content::ResourceContext& context) {
477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
478 ProfileIOData* io_data = 478 ProfileIOData* io_data =
479 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 479 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
480 480
481 const Extension* extension = 481 const Extension* extension =
482 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); 482 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url);
483 if (extension && 483 if (extension &&
484 extension->HasApiPermission(Extension::kNotificationPermission)) { 484 extension->HasApiPermission(ExtensionAPIPermission::kNotification)) {
485 return WebKit::WebNotificationPresenter::PermissionAllowed; 485 return WebKit::WebNotificationPresenter::PermissionAllowed;
486 } 486 }
487 487
488 // Fall back to the regular notification preferences, which works on an 488 // Fall back to the regular notification preferences, which works on an
489 // origin basis. 489 // origin basis.
490 return io_data->GetNotificationService() ? 490 return io_data->GetNotificationService() ?
491 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) : 491 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) :
492 WebKit::WebNotificationPresenter::PermissionNotAllowed; 492 WebKit::WebNotificationPresenter::PermissionNotAllowed;
493 } 493 }
494 494
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 const content::ResourceContext& context) { 537 const content::ResourceContext& context) {
538 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 538 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
539 // If the opener is trying to create a background window but doesn't have 539 // If the opener is trying to create a background window but doesn't have
540 // the appropriate permission, fail the attempt. 540 // the appropriate permission, fail the attempt.
541 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 541 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
542 ProfileIOData* io_data = 542 ProfileIOData* io_data =
543 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 543 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
544 const Extension* extension = 544 const Extension* extension =
545 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); 545 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url);
546 return (extension && 546 return (extension &&
547 extension->HasApiPermission(Extension::kBackgroundPermission)); 547 extension->HasApiPermission(ExtensionAPIPermission::kBackground));
548 } 548 }
549 return true; 549 return true;
550 } 550 }
551 551
552 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( 552 std::string ChromeContentBrowserClient::GetWorkerProcessTitle(
553 const GURL& url, const content::ResourceContext& context) { 553 const GURL& url, const content::ResourceContext& context) {
554 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 554 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
555 // Check if it's an extension-created worker, in which case we want to use 555 // Check if it's an extension-created worker, in which case we want to use
556 // the name of the extension. 556 // the name of the extension.
557 ProfileIOData* io_data = 557 ProfileIOData* io_data =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 #if defined(USE_NSS) 592 #if defined(USE_NSS)
593 crypto::CryptoModuleBlockingPasswordDelegate* 593 crypto::CryptoModuleBlockingPasswordDelegate*
594 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 594 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
595 const GURL& url) { 595 const GURL& url) {
596 return browser::NewCryptoModuleBlockingDialogDelegate( 596 return browser::NewCryptoModuleBlockingDialogDelegate(
597 browser::kCryptoModulePasswordKeygen, url.host()); 597 browser::kCryptoModulePasswordKeygen, url.host());
598 } 598 }
599 #endif 599 #endif
600 600
601 } // namespace chrome 601 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698