diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-31 01:09:42 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-31 01:09:42 +0000 |
commit | 57a777f7584961290e87e6e4149c0ed042334425 (patch) | |
tree | 94ccff83d4ac08208da52890d4e4ae8e33a0f946 /chrome/browser/notifications | |
parent | 151793fa77c13c94709ab5525a8f3fd9a5301450 (diff) | |
download | chromium_src-57a777f7584961290e87e6e4149c0ed042334425.zip chromium_src-57a777f7584961290e87e6e4149c0ed042334425.tar.gz chromium_src-57a777f7584961290e87e6e4149c0ed042334425.tar.bz2 |
Hook up extension apps notification permission, take two
This is the chromium side of a change which will wait to land on the webkit side landing. (https://bugs.webkit.org/show_bug.cgi?id=36625)
It changes the NotificationPresenter to pass the sourceURL, rather than the SecurityOrigin in checking permission.
The full URL is required to match the app extent.
BUG=32361, 31024
TEST=NONE
Review URL: http://codereview.chromium.org/1383001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r-- | chrome/browser/notifications/desktop_notification_service.cc | 31 | ||||
-rw-r--r-- | chrome/browser/notifications/desktop_notification_service.h | 10 |
2 files changed, 1 insertions, 40 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index d351880..aa769d3 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); diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h index 6e9a6d8..8be6f85 100644 --- a/chrome/browser/notifications/desktop_notification_service.h +++ b/chrome/browser/notifications/desktop_notification_service.h @@ -21,7 +21,7 @@ class Task; // The DesktopNotificationService is an object, owned by the Profile, // which provides the creation of desktop "toasts" to web pages and workers. -class DesktopNotificationService : public NotificationObserver { +class DesktopNotificationService { public: enum DesktopNotificationSource { PageNotification, @@ -71,11 +71,6 @@ class DesktopNotificationService : public NotificationObserver { NotificationsPrefsCache* prefs_cache() { return prefs_cache_; } - // NotificationObserver interface. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - // Creates a data:xxxx URL which contains the full HTML for a notification // using supplied icon, title, and text, run through a template which contains // the standard formatting for notifications. @@ -103,9 +98,6 @@ class DesktopNotificationService : public NotificationObserver { // UI for desktop toasts. NotificationUIManager* ui_manager_; - // Connection to the service providing the other kind of notifications. - NotificationRegistrar notification_registrar_; - DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); }; |