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

Unified Diff: Source/modules/notifications/Notification.cpp

Issue 268353004: NotificationController::clientFrom() should return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 7 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 | « no previous file | Source/modules/notifications/NotificationController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/notifications/Notification.cpp
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
index 5114d8a625d39fef2f6226b9b7ae49de7b2052e3..c405fa4dfab36c39186d2459d810be611ea9accd 100644
--- a/Source/modules/notifications/Notification.cpp
+++ b/Source/modules/notifications/Notification.cpp
@@ -43,8 +43,8 @@ namespace WebCore {
Notification* Notification::create(ExecutionContext* context, const String& title, const Dictionary& options)
{
- NotificationClient* client = NotificationController::clientFrom(toDocument(context)->frame());
- Notification* notification = adoptRefCountedGarbageCollected(new Notification(title, context, client));
+ NotificationClient& client = NotificationController::clientFrom(toDocument(context)->frame());
+ Notification* notification = adoptRefCountedGarbageCollected(new Notification(title, context, &client));
String argument;
if (options.get("body", argument))
@@ -89,7 +89,7 @@ void Notification::show()
if (!toDocument(executionContext())->page())
return;
- if (NotificationController::from(toDocument(executionContext())->frame())->client()->checkPermission(executionContext()) != NotificationClient::PermissionAllowed) {
+ if (m_client->checkPermission(executionContext()) != NotificationClient::PermissionAllowed) {
dispatchErrorEvent();
return;
}
@@ -164,13 +164,13 @@ const String& Notification::permission(ExecutionContext* context)
ASSERT(toDocument(context)->page());
UseCounter::count(context, UseCounter::NotificationPermission);
- return permissionString(NotificationController::from(toDocument(context)->frame())->client()->checkPermission(context));
+ return permissionString(NotificationController::clientFrom(toDocument(context)->frame()).checkPermission(context));
}
void Notification::requestPermission(ExecutionContext* context, PassOwnPtr<NotificationPermissionCallback> callback)
{
ASSERT(toDocument(context)->page());
- NotificationController::from(toDocument(context)->frame())->client()->requestPermission(context, callback);
+ NotificationController::clientFrom(toDocument(context)->frame()).requestPermission(context, callback);
}
bool Notification::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
@@ -193,7 +193,7 @@ void Notification::stop()
if (m_asyncRunner)
m_asyncRunner->stop();
- m_client = 0;
+ m_client = nullptr;
haraken 2014/06/09 05:21:12 We use 0 for raw pointers. (We use nullptr for Ref
gyuyoung-inactive 2014/06/09 05:38:31 Ok, Fixed.
m_state = Closed;
}
« no previous file with comments | « no previous file | Source/modules/notifications/NotificationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698