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

Unified Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 1383001: Hook up extension apps notification permission, take two (Closed)
Patch Set: pre commit Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/notifications/desktop_notification_service.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/desktop_notification_service.cc
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index d3518805dba98cf9d1524766ec9fdeb6aa178eef..aa769d389f7fdfa2090801c513624359fbf59d4e 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -194,11 +194,6 @@ DesktopNotificationService::DesktopNotificationService(Profile* profile,
: profile_(profile),
ui_manager_(ui_manager) {
InitPrefs();
-
- // Listen for new extension installations so we can cache permissions.
- notification_registrar_.Add(this,
- NotificationType::EXTENSION_LOADED,
- Source<Profile>(profile_));
}
DesktopNotificationService::~DesktopNotificationService() {
@@ -222,35 +217,9 @@ void DesktopNotificationService::InitPrefs() {
}
prefs_cache_ = new NotificationsPrefsCache(allowed_sites, denied_sites);
-
- ExtensionsService* ext_service = profile_->GetExtensionsService();
- if (ext_service) {
- const ExtensionList* extensions = ext_service->extensions();
- for (ExtensionList::const_iterator iter = extensions->begin();
- iter != extensions->end(); ++iter) {
- if ((*iter)->HasApiPermission(Extension::kNotificationPermission)) {
- prefs_cache_->CacheAllowedOrigin((*iter)->url());
- }
- }
- }
-
prefs_cache_->set_is_initialized(true);
}
-void DesktopNotificationService::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- if (type != NotificationType::EXTENSION_LOADED) {
- NOTREACHED();
- return;
- }
-
- Details<Extension> extension = static_cast<Details<Extension> >(details);
- if (extension->HasApiPermission(Extension::kNotificationPermission)) {
- GrantPermission(extension->url());
- }
-}
-
void DesktopNotificationService::GrantPermission(const GURL& origin) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
PersistPermissionChange(origin, true);
« no previous file with comments | « chrome/browser/notifications/desktop_notification_service.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698