OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/bluetooth/BluetoothSupplement.h" | 6 #include "modules/bluetooth/BluetoothSupplement.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 19 matching lines...) Expand all Loading... |
30 BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHe
apSupplement<LocalFrame>::from(frame, supplementName())); | 30 BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHe
apSupplement<LocalFrame>::from(frame, supplementName())); |
31 | 31 |
32 ASSERT(supplement); | 32 ASSERT(supplement); |
33 ASSERT(supplement->m_bluetooth); | 33 ASSERT(supplement->m_bluetooth); |
34 | 34 |
35 return supplement->m_bluetooth; | 35 return supplement->m_bluetooth; |
36 } | 36 } |
37 | 37 |
38 WebBluetooth* BluetoothSupplement::fromScriptState(ScriptState* scriptState) | 38 WebBluetooth* BluetoothSupplement::fromScriptState(ScriptState* scriptState) |
39 { | 39 { |
40 if (!scriptState->executionContext()->isDocument()) { | 40 return fromExecutionContext(scriptState->executionContext()); |
| 41 } |
| 42 |
| 43 WebBluetooth* BluetoothSupplement::fromExecutionContext(ExecutionContext* execut
ionContext) |
| 44 { |
| 45 if (!executionContext->isDocument()) { |
41 return nullptr; | 46 return nullptr; |
42 } | 47 } |
43 return BluetoothSupplement::from(static_cast<Document*>(scriptState->executi
onContext())->frame()); | 48 return BluetoothSupplement::from(static_cast<Document*>(executionContext)->f
rame()); |
44 } | 49 } |
45 | 50 |
46 DEFINE_TRACE(BluetoothSupplement) | 51 DEFINE_TRACE(BluetoothSupplement) |
47 { | 52 { |
48 WillBeHeapSupplement<LocalFrame>::trace(visitor); | 53 WillBeHeapSupplement<LocalFrame>::trace(visitor); |
49 } | 54 } |
50 | 55 |
51 }; // blink | 56 }; // blink |
OLD | NEW |