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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/Notification.cpp

Issue 2258353002: Reland of Remove content::NotificationPermissionDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permissions_typemaps
Patch Set: Remove NotificationPermissionClient initialization from ChromeClientImpl. Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ExecutionContext.h" 38 #include "core/dom/ExecutionContext.h"
39 #include "core/dom/ExecutionContextTask.h" 39 #include "core/dom/ExecutionContextTask.h"
40 #include "core/dom/ScopedWindowFocusAllowedIndicator.h" 40 #include "core/dom/ScopedWindowFocusAllowedIndicator.h"
41 #include "core/events/Event.h" 41 #include "core/events/Event.h"
42 #include "core/frame/UseCounter.h" 42 #include "core/frame/UseCounter.h"
43 #include "modules/notifications/NotificationAction.h" 43 #include "modules/notifications/NotificationAction.h"
44 #include "modules/notifications/NotificationData.h" 44 #include "modules/notifications/NotificationData.h"
45 #include "modules/notifications/NotificationManager.h" 45 #include "modules/notifications/NotificationManager.h"
46 #include "modules/notifications/NotificationOptions.h" 46 #include "modules/notifications/NotificationOptions.h"
47 #include "modules/notifications/NotificationPermissionClient.h"
48 #include "modules/notifications/NotificationResourcesLoader.h" 47 #include "modules/notifications/NotificationResourcesLoader.h"
49 #include "platform/RuntimeEnabledFeatures.h" 48 #include "platform/RuntimeEnabledFeatures.h"
50 #include "platform/UserGestureIndicator.h" 49 #include "platform/UserGestureIndicator.h"
51 #include "public/platform/Platform.h" 50 #include "public/platform/Platform.h"
52 #include "public/platform/WebSecurityOrigin.h" 51 #include "public/platform/WebSecurityOrigin.h"
53 #include "public/platform/WebString.h"
54 #include "public/platform/modules/notifications/WebNotificationAction.h" 52 #include "public/platform/modules/notifications/WebNotificationAction.h"
55 #include "public/platform/modules/notifications/WebNotificationConstants.h" 53 #include "public/platform/modules/notifications/WebNotificationConstants.h"
56 #include "public/platform/modules/notifications/WebNotificationManager.h" 54 #include "public/platform/modules/notifications/WebNotificationManager.h"
57 #include "public/platform/modules/permissions/permission_status.mojom-blink.h"
58 #include "wtf/Assertions.h" 55 #include "wtf/Assertions.h"
59 #include "wtf/Functional.h" 56 #include "wtf/Functional.h"
60 57
61 namespace blink { 58 namespace blink {
62 namespace { 59 namespace {
63 60
64 const int64_t kInvalidPersistentId = -1; 61 const int64_t kInvalidPersistentId = -1;
65 62
66 WebNotificationManager* notificationManager() 63 WebNotificationManager* notificationManager()
67 { 64 {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return "denied"; 349 return "denied";
353 } 350 }
354 351
355 String Notification::permission(ExecutionContext* context) 352 String Notification::permission(ExecutionContext* context)
356 { 353 {
357 return permissionString(NotificationManager::from(context)->permissionStatus ()); 354 return permissionString(NotificationManager::from(context)->permissionStatus ());
358 } 355 }
359 356
360 ScriptPromise Notification::requestPermission(ScriptState* scriptState, Notifica tionPermissionCallback* deprecatedCallback) 357 ScriptPromise Notification::requestPermission(ScriptState* scriptState, Notifica tionPermissionCallback* deprecatedCallback)
361 { 358 {
362 ExecutionContext* context = scriptState->getExecutionContext(); 359 return NotificationManager::from(scriptState->getExecutionContext())->reques tPermission(scriptState, deprecatedCallback);
363 if (NotificationPermissionClient* permissionClient = NotificationPermissionC lient::from(context))
364 return permissionClient->requestPermission(scriptState, deprecatedCallba ck);
365
366 // The context has been detached. Return a promise that will never settle.
367 DCHECK(context->activeDOMObjectsAreStopped());
368
369 return ScriptPromise();
370 } 360 }
371 361
372 size_t Notification::maxActions() 362 size_t Notification::maxActions()
373 { 363 {
374 return kWebNotificationMaxActions; 364 return kWebNotificationMaxActions;
375 } 365 }
376 366
377 DispatchEventResult Notification::dispatchEventInternal(Event* event) 367 DispatchEventResult Notification::dispatchEventInternal(Event* event)
378 { 368 {
379 DCHECK(getExecutionContext()->isContextThread()); 369 DCHECK(getExecutionContext()->isContextThread());
(...skipping 24 matching lines...) Expand all
404 394
405 DEFINE_TRACE(Notification) 395 DEFINE_TRACE(Notification)
406 { 396 {
407 visitor->trace(m_prepareShowMethodRunner); 397 visitor->trace(m_prepareShowMethodRunner);
408 visitor->trace(m_loader); 398 visitor->trace(m_loader);
409 EventTargetWithInlineData::trace(visitor); 399 EventTargetWithInlineData::trace(visitor);
410 ActiveDOMObject::trace(visitor); 400 ActiveDOMObject::trace(visitor);
411 } 401 }
412 402
413 } // namespace blink 403 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698