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

Side by Side 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: Fix global interface test 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 unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/bluetooth/BluetoothSupplement.h ('k') | third_party/WebKit/public/blink_headers.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698