1116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 2116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// found in the LICENSE file. 4116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h" 61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 71320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "base/lazy_instance.h" 8116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 9116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace extensions { 10116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 11116680a4aac90f2aa7413d9095a592090648e557Ben Murdochstatic base::LazyInstance<BrowserContextKeyedAPIFactory< 12116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ApiResourceManager<BluetoothLowEnergyNotifySession> > > g_factory = 13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LAZY_INSTANCE_INITIALIZER; 14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 15116680a4aac90f2aa7413d9095a592090648e557Ben Murdochtemplate <> 16116680a4aac90f2aa7413d9095a592090648e557Ben MurdochBrowserContextKeyedAPIFactory< 17116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ApiResourceManager<BluetoothLowEnergyNotifySession> >* 18116680a4aac90f2aa7413d9095a592090648e557Ben MurdochApiResourceManager<BluetoothLowEnergyNotifySession>::GetFactoryInstance() { 19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return g_factory.Pointer(); 20116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 21116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 22116680a4aac90f2aa7413d9095a592090648e557Ben MurdochBluetoothLowEnergyNotifySession::BluetoothLowEnergyNotifySession( 23116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool persistent, 24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch const std::string& owner_extension_id, 25116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch scoped_ptr<device::BluetoothGattNotifySession> session) 26116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch : ApiResource(owner_extension_id), 27116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch persistent_(persistent), 28116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch session_(session.release()) { 29116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 30116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 31116680a4aac90f2aa7413d9095a592090648e557Ben MurdochBluetoothLowEnergyNotifySession::~BluetoothLowEnergyNotifySession() { 32116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 33116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 34116680a4aac90f2aa7413d9095a592090648e557Ben Murdochdevice::BluetoothGattNotifySession* 35116680a4aac90f2aa7413d9095a592090648e557Ben MurdochBluetoothLowEnergyNotifySession::GetSession() const { 36116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return session_.get(); 37116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 38116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 39116680a4aac90f2aa7413d9095a592090648e557Ben Murdochbool BluetoothLowEnergyNotifySession::IsPersistent() const { 40116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return persistent_; 41116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 42116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 43116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} // namespace extensions 44