| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/sensor/SensorProviderProxy.h" | 5 #include "modules/sensor/SensorProviderProxy.h" |
| 6 | 6 |
| 7 #include "modules/sensor/SensorProxy.h" | 7 #include "modules/sensor/SensorProxy.h" |
| 8 #include "platform/mojo/MojoHelper.h" | 8 #include "platform/mojo/MojoHelper.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "services/device/public/interfaces/constants.mojom-blink.h" | 10 #include "services/device/public/interfaces/constants.mojom-blink.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 SensorProxy* sensor = new SensorProxy(type, this, page); | 59 SensorProxy* sensor = new SensorProxy(type, this, page); |
| 60 sensor_proxies_.insert(sensor); | 60 sensor_proxies_.insert(sensor); |
| 61 | 61 |
| 62 return sensor; | 62 return sensor; |
| 63 } | 63 } |
| 64 | 64 |
| 65 SensorProxy* SensorProviderProxy::GetSensorProxy( | 65 SensorProxy* SensorProviderProxy::GetSensorProxy( |
| 66 device::mojom::blink::SensorType type) { | 66 device::mojom::blink::SensorType type) { |
| 67 for (SensorProxy* sensor : sensor_proxies_) { | 67 for (SensorProxy* sensor : sensor_proxies_) { |
| 68 // TODO(Mikhail) : Hash sensors by type for efficiency. | 68 // TODO(Mikhail) : Hash sensors by type for efficiency. |
| 69 if (sensor->GetType() == type) | 69 if (sensor->type() == type) |
| 70 return sensor; | 70 return sensor; |
| 71 } | 71 } |
| 72 | 72 |
| 73 return nullptr; | 73 return nullptr; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void SensorProviderProxy::OnSensorProviderConnectionError() { | 76 void SensorProviderProxy::OnSensorProviderConnectionError() { |
| 77 sensor_provider_.reset(); | 77 sensor_provider_.reset(); |
| 78 for (SensorProxy* sensor : sensor_proxies_) | 78 for (SensorProxy* sensor : sensor_proxies_) |
| 79 sensor->HandleSensorError(); | 79 sensor->HandleSensorError(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |