| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/device_orientation/provider.h" | 5 #include "chrome/browser/device_orientation/provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 |
| 10 #if defined(OS_MACOSX) |
| 11 #include "chrome/browser/device_orientation/accelerometer_mac.h" |
| 12 #endif |
| 13 |
| 9 #include "chrome/browser/device_orientation/data_fetcher.h" | 14 #include "chrome/browser/device_orientation/data_fetcher.h" |
| 10 #include "chrome/browser/device_orientation/provider_impl.h" | 15 #include "chrome/browser/device_orientation/provider_impl.h" |
| 11 | 16 |
| 12 namespace device_orientation { | 17 namespace device_orientation { |
| 13 | 18 |
| 14 Provider* Provider::GetInstance() { | 19 Provider* Provider::GetInstance() { |
| 15 if (!instance_) { | 20 if (!instance_) { |
| 16 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 21 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 17 const ProviderImpl::DataFetcherFactory default_factories[] = { NULL }; | 22 const ProviderImpl::DataFetcherFactory default_factories[] = { |
| 23 #if defined(OS_MACOSX) |
| 24 AccelerometerMac::Create, |
| 25 #endif |
| 26 NULL |
| 27 }; |
| 18 | 28 |
| 19 instance_ = new ProviderImpl(MessageLoop::current(), default_factories); | 29 instance_ = new ProviderImpl(MessageLoop::current(), default_factories); |
| 20 } | 30 } |
| 21 return instance_; | 31 return instance_; |
| 22 } | 32 } |
| 23 | 33 |
| 24 void Provider::SetInstanceForTests(Provider* provider) { | 34 void Provider::SetInstanceForTests(Provider* provider) { |
| 25 DCHECK(!instance_); | 35 DCHECK(!instance_); |
| 26 instance_ = provider; | 36 instance_ = provider; |
| 27 } | 37 } |
| 28 | 38 |
| 29 Provider* Provider::instance_ = NULL; | 39 Provider* Provider::instance_ = NULL; |
| 30 | 40 |
| 31 } // namespace device_orientation | 41 } // namespace device_orientation |
| OLD | NEW |