| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 DCHECK_EQ(m_state, State::Loading); | 148 DCHECK_EQ(m_state, State::Loading); |
| 149 DCHECK(!m_prepareShowMethodRunner); | 149 DCHECK(!m_prepareShowMethodRunner); |
| 150 | 150 |
| 151 m_prepareShowMethodRunner = | 151 m_prepareShowMethodRunner = |
| 152 AsyncMethodRunner<Notification>::create(this, &Notification::prepareShow); | 152 AsyncMethodRunner<Notification>::create(this, &Notification::prepareShow); |
| 153 m_prepareShowMethodRunner->runAsync(); | 153 m_prepareShowMethodRunner->runAsync(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void Notification::prepareShow() { | 156 void Notification::prepareShow() { |
| 157 DCHECK_EQ(m_state, State::Loading); | 157 DCHECK_EQ(m_state, State::Loading); |
| 158 if (NotificationManager::from(getExecutionContext())->permissionStatus() != | 158 if (NotificationManager::from(getExecutionContext()) |
| 159 ->permissionStatus(getExecutionContext()) != |
| 159 mojom::blink::PermissionStatus::GRANTED) { | 160 mojom::blink::PermissionStatus::GRANTED) { |
| 160 dispatchErrorEvent(); | 161 dispatchErrorEvent(); |
| 161 return; | 162 return; |
| 162 } | 163 } |
| 163 | 164 |
| 164 m_loader = new NotificationResourcesLoader( | 165 m_loader = new NotificationResourcesLoader( |
| 165 WTF::bind(&Notification::didLoadResources, wrapWeakPersistent(this))); | 166 WTF::bind(&Notification::didLoadResources, wrapWeakPersistent(this))); |
| 166 m_loader->start(getExecutionContext(), m_data); | 167 m_loader->start(getExecutionContext(), m_data); |
| 167 } | 168 } |
| 168 | 169 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 case mojom::blink::PermissionStatus::ASK: | 349 case mojom::blink::PermissionStatus::ASK: |
| 349 return "default"; | 350 return "default"; |
| 350 } | 351 } |
| 351 | 352 |
| 352 NOTREACHED(); | 353 NOTREACHED(); |
| 353 return "denied"; | 354 return "denied"; |
| 354 } | 355 } |
| 355 | 356 |
| 356 String Notification::permission(ExecutionContext* context) { | 357 String Notification::permission(ExecutionContext* context) { |
| 357 return permissionString( | 358 return permissionString( |
| 358 NotificationManager::from(context)->permissionStatus()); | 359 NotificationManager::from(context)->permissionStatus(context)); |
| 359 } | 360 } |
| 360 | 361 |
| 361 ScriptPromise Notification::requestPermission( | 362 ScriptPromise Notification::requestPermission( |
| 362 ScriptState* scriptState, | 363 ScriptState* scriptState, |
| 363 NotificationPermissionCallback* deprecatedCallback) { | 364 NotificationPermissionCallback* deprecatedCallback) { |
| 364 return NotificationManager::from(scriptState->getExecutionContext()) | 365 return NotificationManager::from(scriptState->getExecutionContext()) |
| 365 ->requestPermission(scriptState, deprecatedCallback); | 366 ->requestPermission(scriptState, deprecatedCallback); |
| 366 } | 367 } |
| 367 | 368 |
| 368 size_t Notification::maxActions() { | 369 size_t Notification::maxActions() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 401 } |
| 401 | 402 |
| 402 DEFINE_TRACE(Notification) { | 403 DEFINE_TRACE(Notification) { |
| 403 visitor->trace(m_prepareShowMethodRunner); | 404 visitor->trace(m_prepareShowMethodRunner); |
| 404 visitor->trace(m_loader); | 405 visitor->trace(m_loader); |
| 405 EventTargetWithInlineData::trace(visitor); | 406 EventTargetWithInlineData::trace(visitor); |
| 406 ActiveDOMObject::trace(visitor); | 407 ActiveDOMObject::trace(visitor); |
| 407 } | 408 } |
| 408 | 409 |
| 409 } // namespace blink | 410 } // namespace blink |
| OLD | NEW |