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

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

Issue 1334763002: bluetooth: Subscribe to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-origin
Patch Set: Include map 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 cde18aa442c6f5acfbd266effe8dcd000d86d289..eb175aa3d5640ef0434c393e2e01f676e4f1e156 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.cpp
@@ -33,15 +33,24 @@ WebBluetooth* BluetoothSupplement::from(LocalFrame* frame)
return nullptr;
}
-WebBluetooth* BluetoothSupplement::getFromScriptState(ScriptState* scriptState)
+static WebBluetooth* getFromLocalDOMWindow(LocalDOMWindow* window)
{
- LocalDOMWindow* window = scriptState->domWindow();
if (window && window->frame()) {
haraken 2015/10/10 14:19:35 As commented in the other CL, it is unsafe to use
ortuno 2015/10/12 17:46:07 Using executionContext now.
return BluetoothSupplement::from(window->frame());
}
return nullptr;
}
+WebBluetooth* BluetoothSupplement::getFromScriptState(ScriptState* scriptState)
+{
+ return getFromLocalDOMWindow(scriptState->domWindow());
+}
+
+WebBluetooth* BluetoothSupplement::getFromExecutionContext(ExecutionContext* executionContext)
+{
+ return getFromLocalDOMWindow(executionContext->executingWindow());
haraken 2015/10/10 14:19:35 executionContext->executingWindow() may work but i
ortuno 2015/10/12 17:46:07 Done.
+}
+
DEFINE_TRACE(BluetoothSupplement)
{
WillBeHeapSupplement<LocalFrame>::trace(visitor);

Powered by Google App Engine
This is Rietveld 408576698