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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 102103005: Move c/c/e/extension_set to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move ExtensionSet to extensions namespace Created 7 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/prefs/scoped_user_pref_update.h" 8 #include "base/prefs/scoped_user_pref_update.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 base::string16 DesktopNotificationService::DisplayNameForOriginInProcessId( 507 base::string16 DesktopNotificationService::DisplayNameForOriginInProcessId(
508 const GURL& origin, int process_id) { 508 const GURL& origin, int process_id) {
509 // If the source is an extension, lookup the display name. 509 // If the source is an extension, lookup the display name.
510 // Message center prefers to use extension name if the notification 510 // Message center prefers to use extension name if the notification
511 // is allowed by an extension. 511 // is allowed by an extension.
512 if (NotificationUIManager::DelegatesToMessageCenter() || 512 if (NotificationUIManager::DelegatesToMessageCenter() ||
513 origin.SchemeIs(extensions::kExtensionScheme)) { 513 origin.SchemeIs(extensions::kExtensionScheme)) {
514 extensions::InfoMap* extension_info_map = 514 extensions::InfoMap* extension_info_map =
515 extensions::ExtensionSystem::Get(profile_)->info_map(); 515 extensions::ExtensionSystem::Get(profile_)->info_map();
516 if (extension_info_map) { 516 if (extension_info_map) {
517 ExtensionSet extensions; 517 extensions::ExtensionSet extensions;
518 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( 518 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin(
519 origin, process_id, extensions::APIPermission::kNotification, 519 origin, process_id, extensions::APIPermission::kNotification,
520 &extensions); 520 &extensions);
521 for (ExtensionSet::const_iterator iter = extensions.begin(); 521 for (extensions::ExtensionSet::const_iterator iter = extensions.begin();
522 iter != extensions.end(); ++iter) { 522 iter != extensions.end(); ++iter) {
523 NotifierId notifier_id(NotifierId::APPLICATION, (*iter)->id()); 523 NotifierId notifier_id(NotifierId::APPLICATION, (*iter)->id());
524 if (IsNotifierEnabled(notifier_id)) 524 if (IsNotifierEnabled(notifier_id))
525 return UTF8ToUTF16((*iter)->name()); 525 return UTF8ToUTF16((*iter)->name());
526 } 526 }
527 } 527 }
528 } 528 }
529 return UTF8ToUTF16(origin.host()); 529 return UTF8ToUTF16(origin.host());
530 } 530 }
531 531
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 // Tell the IO thread that this extension's permission for notifications 673 // Tell the IO thread that this extension's permission for notifications
674 // has changed. 674 // has changed.
675 extensions::InfoMap* extension_info_map = 675 extensions::InfoMap* extension_info_map =
676 extensions::ExtensionSystem::Get(profile_)->info_map(); 676 extensions::ExtensionSystem::Get(profile_)->info_map();
677 BrowserThread::PostTask( 677 BrowserThread::PostTask(
678 BrowserThread::IO, FROM_HERE, 678 BrowserThread::IO, FROM_HERE,
679 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 679 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
680 extension_info_map, notifier_id.id, !enabled)); 680 extension_info_map, notifier_id.id, !enabled));
681 681
682 } 682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698