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..cde18aa442c6f5acfbd266effe8dcd000d86d289 100644 |
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp |
| @@ -6,7 +6,6 @@ |
| #include "modules/bluetooth/BluetoothSupplement.h" |
| #include "core/frame/LocalDOMWindow.h" |
| -#include "public/platform/Platform.h" |
| namespace blink { |
| @@ -26,15 +25,21 @@ void BluetoothSupplement::provideTo(LocalFrame& frame, WebBluetooth* bluetooth) |
| WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), bluetoothSupplement.release()); |
| }; |
| -WebBluetooth* BluetoothSupplement::from(ScriptState* scriptState) |
| +WebBluetooth* BluetoothSupplement::from(LocalFrame* frame) |
| +{ |
| + BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName())); |
| + if (supplement && supplement->m_bluetooth) |
|
haraken
2015/10/10 14:09:57
If the supplement is 0, don't you need to create a
ortuno
2015/10/12 17:33:52
We provide the Supplement to the frame here:
http
|
| + return supplement->m_bluetooth; |
| + return nullptr; |
| +} |
| + |
| +WebBluetooth* BluetoothSupplement::getFromScriptState(ScriptState* scriptState) |
|
haraken
2015/10/10 14:09:57
getFromScriptState => fromScriptState (Blink doesn
ortuno
2015/10/12 17:33:52
Done.
|
| { |
| LocalDOMWindow* window = scriptState->domWindow(); |
| if (window && window->frame()) { |
|
haraken
2015/10/10 14:09:57
It is unsafe to use window->frame() directly. You
ortuno
2015/10/12 17:33:52
As suggested in the other CL I changed it to get t
Jeffrey Yasskin
2015/10/12 21:57:24
Thanks Kentaro for catching my mistakes in writing
haraken
2015/10/12 23:29:25
Sorry for not having a comment about it. We had to
|
| - BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(WillBeHeapSupplement<LocalFrame>::from(window->frame(), supplementName())); |
| - if (supplement && supplement->m_bluetooth) |
| - return supplement->m_bluetooth; |
| + return BluetoothSupplement::from(window->frame()); |
| } |
| - return Platform::current()->bluetooth(); |
| + return nullptr; |
| } |
| DEFINE_TRACE(BluetoothSupplement) |