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

Unified Diff: content/browser/sensors/sensors_provider_impl.cc

Issue 7366011: Initial sensor event provider for testing views screen rotation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Style fixes Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698