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

Side by Side Diff: content/renderer/device_sensors/device_light_event_pump.cc

Issue 2646093002: Move //content/browser/device_sensor/ into device/sensors (Closed)
Patch Set: gn format & code rebase Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/device_sensors/device_light_event_pump.h" 5 #include "content/renderer/device_sensors/device_light_event_pump.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "content/public/renderer/render_thread.h" 8 #include "content/public/renderer/render_thread.h"
9 #include "device/sensors/public/cpp/device_sensors_consts.h" 9 #include "device/sensors/public/cpp/device_sensors_consts.h"
10 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 10 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
(...skipping 13 matching lines...) Expand all
24 device::mojom::LightSensor>(thread), 24 device::mojom::LightSensor>(thread),
25 last_seen_data_(-1) { 25 last_seen_data_(-1) {
26 pump_delay_microseconds_ = kDefaultLightPumpDelayMicroseconds; 26 pump_delay_microseconds_ = kDefaultLightPumpDelayMicroseconds;
27 } 27 }
28 28
29 DeviceLightEventPump::~DeviceLightEventPump() { 29 DeviceLightEventPump::~DeviceLightEventPump() {
30 } 30 }
31 31
32 void DeviceLightEventPump::FireEvent() { 32 void DeviceLightEventPump::FireEvent() {
33 DCHECK(listener()); 33 DCHECK(listener());
34 DeviceLightData data; 34 device::DeviceLightData data;
35 if (reader_->GetLatestData(&data) && ShouldFireEvent(data.value)) { 35 if (reader_->GetLatestData(&data) && ShouldFireEvent(data.value)) {
36 last_seen_data_ = data.value; 36 last_seen_data_ = data.value;
37 listener()->didChangeDeviceLight(data.value); 37 listener()->didChangeDeviceLight(data.value);
38 } 38 }
39 } 39 }
40 40
41 bool DeviceLightEventPump::ShouldFireEvent(double lux) const { 41 bool DeviceLightEventPump::ShouldFireEvent(double lux) const {
42 if (lux < 0) 42 if (lux < 0)
43 return false; 43 return false;
44 44
(...skipping 11 matching lines...) Expand all
56 return reader_->Initialize(handle); 56 return reader_->Initialize(handle);
57 } 57 }
58 58
59 void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) { 59 void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) {
60 double data = *static_cast<double*>(fake_data); 60 double data = *static_cast<double*>(fake_data);
61 61
62 listener()->didChangeDeviceLight(data); 62 listener()->didChangeDeviceLight(data);
63 } 63 }
64 64
65 } // namespace content 65 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698