Chromium Code Reviews| Index: content/browser/sensors/sensors_provider_impl.cc |
| diff --git a/content/browser/sensors/sensors_provider_impl.cc b/content/browser/sensors/sensors_provider_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c0f5451162ba8fed40851d3e3f1f10cf0a7eb97a |
| --- /dev/null |
| +++ b/content/browser/sensors/sensors_provider_impl.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/memory/singleton.h" |
| +#include "content/browser/sensors/sensors_provider_impl.h" |
|
tfarina
2011/07/25 14:57:52
this should be the first include.
|
| + |
| +namespace sensors { |
| + |
| +ProviderImpl* ProviderImpl::GetInstance() { |
| + return Singleton<ProviderImpl>::get(); |
| +} |
| + |
| +ProviderImpl::ProviderImpl() |
|
tfarina
2011/07/25 14:57:52
This and the dtor should be defined after RemoveLi
cwolfe
2011/07/25 15:49:45
Consistent with PluginService, among others. Code
tfarina
2011/07/25 16:18:37
This is not optional :) And Scott will agree with
|
| + : listeners_(new ListenerList()) { |
| +} |
| + |
| +ProviderImpl::~ProviderImpl() { |
| +} |
| + |
| +void ProviderImpl::AddListener(Listener* listener) { |
| + listeners_->AddObserver(listener); |
| +} |
| + |
| +void ProviderImpl::RemoveListener(Listener* listener) { |
| + listeners_->RemoveObserver(listener); |
| +} |
| + |
| +void ProviderImpl::ScreenOrientationChanged( |
| + const ScreenOrientation& change) { |
| + listeners_->Notify(&Listener::OnScreenOrientationChanged, change); |
| +} |
| + |
| +} // namespace sensors |