OLD | NEW |
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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return "denied"; | 348 return "denied"; |
349 case mojom::blink::PermissionStatus::ASK: | 349 case mojom::blink::PermissionStatus::ASK: |
350 return "default"; | 350 return "default"; |
351 } | 351 } |
352 | 352 |
353 NOTREACHED(); | 353 NOTREACHED(); |
354 return "denied"; | 354 return "denied"; |
355 } | 355 } |
356 | 356 |
357 String Notification::permission(ScriptState* script_state) { | 357 String Notification::permission(ScriptState* script_state) { |
358 ExecutionContext* context = ExecutionContext::From(script_state); | 358 ExecutionContext* context = script_state->GetExecutionContext(); |
359 return PermissionString( | 359 return PermissionString( |
360 NotificationManager::From(context)->GetPermissionStatus(context)); | 360 NotificationManager::From(context)->GetPermissionStatus(context)); |
361 } | 361 } |
362 | 362 |
363 ScriptPromise Notification::requestPermission( | 363 ScriptPromise Notification::requestPermission( |
364 ScriptState* script_state, | 364 ScriptState* script_state, |
365 NotificationPermissionCallback* deprecated_callback) { | 365 NotificationPermissionCallback* deprecated_callback) { |
366 ExecutionContext* context = ExecutionContext::From(script_state); | 366 ExecutionContext* context = script_state->GetExecutionContext(); |
367 if (!context->IsSecureContext()) { | 367 if (!context->IsSecureContext()) { |
368 Deprecation::CountDeprecation( | 368 Deprecation::CountDeprecation( |
369 context, UseCounter::kNotificationPermissionRequestedInsecureOrigin); | 369 context, UseCounter::kNotificationPermissionRequestedInsecureOrigin); |
370 } | 370 } |
371 | 371 |
372 if (context->IsDocument()) { | 372 if (context->IsDocument()) { |
373 LocalFrame* frame = ToDocument(context)->GetFrame(); | 373 LocalFrame* frame = ToDocument(context)->GetFrame(); |
374 if (frame && !frame->IsMainFrame()) { | 374 if (frame && !frame->IsMainFrame()) { |
375 Deprecation::CountDeprecation( | 375 Deprecation::CountDeprecation( |
376 context, UseCounter::kNotificationPermissionRequestedIframe); | 376 context, UseCounter::kNotificationPermissionRequestedIframe); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 424 } |
425 | 425 |
426 DEFINE_TRACE(Notification) { | 426 DEFINE_TRACE(Notification) { |
427 visitor->Trace(prepare_show_method_runner_); | 427 visitor->Trace(prepare_show_method_runner_); |
428 visitor->Trace(loader_); | 428 visitor->Trace(loader_); |
429 EventTargetWithInlineData::Trace(visitor); | 429 EventTargetWithInlineData::Trace(visitor); |
430 ContextLifecycleObserver::Trace(visitor); | 430 ContextLifecycleObserver::Trace(visitor); |
431 } | 431 } |
432 | 432 |
433 } // namespace blink | 433 } // namespace blink |
OLD | NEW |