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

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

Issue 2695433002: Add a UseCounter for notification permission requests from iframes (Closed)
Patch Set: rebase again Created 3 years, 10 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 359 }
360 360
361 ScriptPromise Notification::requestPermission( 361 ScriptPromise Notification::requestPermission(
362 ScriptState* scriptState, 362 ScriptState* scriptState,
363 NotificationPermissionCallback* deprecatedCallback) { 363 NotificationPermissionCallback* deprecatedCallback) {
364 ExecutionContext* context = scriptState->getExecutionContext(); 364 ExecutionContext* context = scriptState->getExecutionContext();
365 if (!context->isSecureContext()) { 365 if (!context->isSecureContext()) {
366 Deprecation::countDeprecation( 366 Deprecation::countDeprecation(
367 context, UseCounter::NotificationPermissionRequestedInsecureOrigin); 367 context, UseCounter::NotificationPermissionRequestedInsecureOrigin);
368 } 368 }
369 if (context->isDocument()) {
370 LocalFrame* frame = toDocument(context)->frame();
371 if (frame && !frame->isMainFrame()) {
372 UseCounter::count(context,
373 UseCounter::NotificationPermissionRequestedIframe);
374 }
375 }
376
369 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint( 377 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(
370 context, "Notification.requestPermission", true, true); 378 context, "Notification.requestPermission", true, true);
379
371 return NotificationManager::from(context)->requestPermission( 380 return NotificationManager::from(context)->requestPermission(
372 scriptState, deprecatedCallback); 381 scriptState, deprecatedCallback);
373 } 382 }
374 383
375 size_t Notification::maxActions() { 384 size_t Notification::maxActions() {
376 return kWebNotificationMaxActions; 385 return kWebNotificationMaxActions;
377 } 386 }
378 387
379 DispatchEventResult Notification::dispatchEventInternal(Event* event) { 388 DispatchEventResult Notification::dispatchEventInternal(Event* event) {
380 DCHECK(getExecutionContext()->isContextThread()); 389 DCHECK(getExecutionContext()->isContextThread());
(...skipping 26 matching lines...) Expand all
407 } 416 }
408 417
409 DEFINE_TRACE(Notification) { 418 DEFINE_TRACE(Notification) {
410 visitor->trace(m_prepareShowMethodRunner); 419 visitor->trace(m_prepareShowMethodRunner);
411 visitor->trace(m_loader); 420 visitor->trace(m_loader);
412 EventTargetWithInlineData::trace(visitor); 421 EventTargetWithInlineData::trace(visitor);
413 ContextLifecycleObserver::trace(visitor); 422 ContextLifecycleObserver::trace(visitor);
414 } 423 }
415 424
416 } // namespace blink 425 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698