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

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: fix a bad merge 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/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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 391 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
392 const GURL& source_url, 392 const GURL& source_url,
393 const content::ResourceContext& context) { 393 const content::ResourceContext& context) {
394 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 394 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
395 ProfileIOData* io_data = 395 ProfileIOData* io_data =
396 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 396 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
397 397
398 const Extension* extension = 398 const Extension* extension =
399 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); 399 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url);
400 if (extension && 400 if (extension &&
401 extension->HasApiPermission(Extension::kNotificationPermission)) { 401 extension->HasApiPermission(ExtensionAPIPermission::Notification())) {
402 return WebKit::WebNotificationPresenter::PermissionAllowed; 402 return WebKit::WebNotificationPresenter::PermissionAllowed;
403 } 403 }
404 404
405 // Fall back to the regular notification preferences, which works on an 405 // Fall back to the regular notification preferences, which works on an
406 // origin basis. 406 // origin basis.
407 return io_data->GetNotificationService() ? 407 return io_data->GetNotificationService() ?
408 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) : 408 io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) :
409 WebKit::WebNotificationPresenter::PermissionNotAllowed; 409 WebKit::WebNotificationPresenter::PermissionNotAllowed;
410 } 410 }
411 411
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 const content::ResourceContext& context) { 454 const content::ResourceContext& context) {
455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 455 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
456 // If the opener is trying to create a background window but doesn't have 456 // If the opener is trying to create a background window but doesn't have
457 // the appropriate permission, fail the attempt. 457 // the appropriate permission, fail the attempt.
458 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 458 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
459 ProfileIOData* io_data = 459 ProfileIOData* io_data =
460 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); 460 reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
461 const Extension* extension = 461 const Extension* extension =
462 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); 462 io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url);
463 return (extension && 463 return (extension &&
464 extension->HasApiPermission(Extension::kBackgroundPermission)); 464 extension->HasApiPermission(ExtensionAPIPermission::Background()));
465 } 465 }
466 return true; 466 return true;
467 } 467 }
468 468
469 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( 469 std::string ChromeContentBrowserClient::GetWorkerProcessTitle(
470 const GURL& url, const content::ResourceContext& context) { 470 const GURL& url, const content::ResourceContext& context) {
471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
472 // Check if it's an extension-created worker, in which case we want to use 472 // Check if it's an extension-created worker, in which case we want to use
473 // the name of the extension. 473 // the name of the extension.
474 ProfileIOData* io_data = 474 ProfileIOData* io_data =
(...skipping 16 matching lines...) Expand all
491 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); 491 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
492 492
493 if (process_type == switches::kGpuProcess) 493 if (process_type == switches::kGpuProcess)
494 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); 494 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
495 495
496 return -1; 496 return -1;
497 } 497 }
498 #endif 498 #endif
499 499
500 } // namespace chrome 500 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698