| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file implements a mock location provider and the factory functions for | 5 // This file implements a mock location provider and the factory functions for |
| 6 // various ways of creating it. | 6 // various ways of creating it. |
| 7 | 7 |
| 8 #include "device/geolocation/mock_location_provider.h" | 8 #include "content/browser/geolocation/mock_location_provider.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
| 17 | 17 |
| 18 namespace device { | 18 namespace content { |
| 19 | 19 |
| 20 MockLocationProvider::MockLocationProvider() | 20 MockLocationProvider::MockLocationProvider() |
| 21 : state_(STOPPED), | 21 : state_(STOPPED), |
| 22 is_permission_granted_(false), | 22 is_permission_granted_(false), |
| 23 provider_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} | 23 provider_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
| 24 | 24 |
| 25 MockLocationProvider::~MockLocationProvider() {} | 25 MockLocationProvider::~MockLocationProvider() {} |
| 26 | 26 |
| 27 void MockLocationProvider::HandlePositionChanged(const Geoposition& position) { | 27 void MockLocationProvider::HandlePositionChanged(const Geoposition& position) { |
| 28 if (provider_task_runner_->BelongsToCurrentThread()) { | 28 if (provider_task_runner_->BelongsToCurrentThread()) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 LocationProvider* NewAutoFailMockLocationProvider() { | 116 LocationProvider* NewAutoFailMockLocationProvider() { |
| 117 return new AutoMockLocationProvider(false, false); | 117 return new AutoMockLocationProvider(false, false); |
| 118 } | 118 } |
| 119 | 119 |
| 120 LocationProvider* NewAutoSuccessMockNetworkLocationProvider() { | 120 LocationProvider* NewAutoSuccessMockNetworkLocationProvider() { |
| 121 return new AutoMockLocationProvider(true, true); | 121 return new AutoMockLocationProvider(true, true); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace device | 124 } // namespace content |
| OLD | NEW |