Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / content / browser / device_sensors / data_fetcher_shared_memory_chromeos.cc
blob76349d2a37d37726b80f8bcde6cef78c181e6e30
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
3 // found in the LICENSE file.
5 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
7 #include "content/browser/device_sensors/sensor_manager_chromeos.h"
9 namespace content {
11 DataFetcherSharedMemory::DataFetcherSharedMemory() {
14 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
17 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
18 DCHECK(buffer);
19 if (!sensor_manager_)
20 sensor_manager_.reset(new SensorManagerChromeOS);
22 switch (consumer_type) {
23 case CONSUMER_TYPE_MOTION:
24 sensor_manager_->StartFetchingDeviceMotionData(
25 static_cast<DeviceMotionHardwareBuffer*>(buffer));
26 return true;
27 case CONSUMER_TYPE_ORIENTATION:
28 sensor_manager_->StartFetchingDeviceOrientationData(
29 static_cast<DeviceOrientationHardwareBuffer*>(buffer));
30 return true;
31 case CONSUMER_TYPE_LIGHT:
32 NOTIMPLEMENTED();
33 return false;
35 NOTREACHED();
36 return false;
39 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
40 switch (consumer_type) {
41 case CONSUMER_TYPE_MOTION:
42 return sensor_manager_->StopFetchingDeviceMotionData();
43 case CONSUMER_TYPE_ORIENTATION:
44 return sensor_manager_->StopFetchingDeviceOrientationData();
45 case CONSUMER_TYPE_LIGHT:
46 NOTIMPLEMENTED();
47 return false;
49 NOTREACHED();
50 return false;
53 } // namespace content