Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp

Issue 1399623003: bluetooth: Change BluetoothSupplement::from(ScriptState*) to from(LocalFrame*) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Add assert for supplement and changed to use executionContext Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.h ('k') | third_party/WebKit/Source/modules/bluetooth/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698