Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| index 4f445c117e729c9d62f51ff6398c3ae43c6d3b5d..b84c746454fff3f7073519a482a6d6203e080718 100644 |
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| @@ -5,8 +5,7 @@ |
| #include "config.h" |
| #include "modules/bluetooth/BluetoothSupplement.h" |
| -#include "core/frame/LocalDOMWindow.h" |
| -#include "public/platform/Platform.h" |
| +#include "core/dom/Document.h" |
| namespace blink { |
| @@ -26,15 +25,22 @@ void BluetoothSupplement::provideTo(LocalFrame& frame, WebBluetooth* bluetooth) |
| WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), bluetoothSupplement.release()); |
| }; |
| -WebBluetooth* BluetoothSupplement::from(ScriptState* scriptState) |
| +WebBluetooth* BluetoothSupplement::from(LocalFrame* frame) |
| { |
| - LocalDOMWindow* window = scriptState->domWindow(); |
| - if (window && window->frame()) { |
| - BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHeapSupplement<LocalFrame>::from(window->frame(), supplementName())); |
| - if (supplement && supplement->m_bluetooth) |
| - return supplement->m_bluetooth; |
| + BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName())); |
| + |
| + ASSERT(supplement); |
| + ASSERT(supplement->m_bluetooth); |
| + |
| + return supplement->m_bluetooth; |
| +} |
| + |
| +WebBluetooth* BluetoothSupplement::fromScriptState(ScriptState* scriptState) |
| +{ |
| + if (!scriptState->executionContext()->isDocument()) { |
| + return nullptr; |
| } |
| - return Platform::current()->bluetooth(); |
| + return BluetoothSupplement::from(static_cast<Document*>(scriptState->executionContext())->frame()); |
|
haraken
2015/10/13 02:05:09
After landing the other CL, you should replace the
ortuno
2015/10/13 15:40:29
This CL is meant to land first. The other CL chang
|
| } |
| DEFINE_TRACE(BluetoothSupplement) |