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

Unified Diff: chrome/browser/chromeos/dbus/sensors_source.cc

Issue 8400034: chromeos: Add a stub implementation for SensorsSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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: chrome/browser/chromeos/dbus/sensors_source.cc
diff --git a/chrome/browser/chromeos/dbus/sensors_source.cc b/chrome/browser/chromeos/dbus/sensors_source.cc
deleted file mode 100644
index 014bd6e5d5c1eaa5036fe6ad4a7706a6f551270e..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/dbus/sensors_source.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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 "chrome/browser/chromeos/dbus/sensors_source.h"
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "content/browser/browser_thread.h"
-#include "content/browser/sensors/sensors_provider.h"
-#include "dbus/bus.h"
-#include "dbus/message.h"
-#include "dbus/object_proxy.h"
-
-// TODO(cwolfe): Fix the DEPs so that these can be pulled in from
-// "chromeos/dbus/service_constants.h".
-namespace chromeos {
-// Sensors service identifiers.
-const char kSensorsServiceName[] = "org.chromium.Sensors";
-const char kSensorsServicePath[] = "/org/chromium/Sensors";
-const char kSensorsServiceInterface[] = "org.chromium.Sensors";
-// Sensors signal names.
-const char kScreenOrientationChanged[] = "ScreenOrientationChanged";
-
-SensorsSource::SensorsSource()
- : sensors_proxy_(NULL),
- weak_ptr_factory_(this) {
-}
-
-void SensorsSource::Init(dbus::Bus* bus) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- sensors_proxy_ = bus->GetObjectProxy(chromeos::kSensorsServiceName,
- chromeos::kSensorsServicePath);
- sensors_proxy_->ConnectToSignal(chromeos::kSensorsServiceInterface,
- chromeos::kScreenOrientationChanged,
- base::Bind(&SensorsSource::OrientationChangedReceived,
- weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&SensorsSource::OrientationChangedConnected,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-SensorsSource::~SensorsSource() {
-}
-
-void SensorsSource::OrientationChangedReceived(dbus::Signal* signal) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- sensors::ScreenOrientation orientation;
-
- dbus::MessageReader reader(signal);
- int32 upward = 0;
- if (!reader.PopInt32(&upward)) {
- LOG(WARNING) << "Orientation changed signal had incorrect parameters: "
- << signal->ToString();
- return;
- }
- VLOG(1) << "Orientation changed to upward " << upward;
- orientation.upward = static_cast<sensors::ScreenOrientation::Side>(upward);
-
- sensors::Provider::GetInstance()->ScreenOrientationChanged(orientation);
-}
-
-void SensorsSource::OrientationChangedConnected(
- const std::string& interface_name,
- const std::string& signal_name,
- bool success) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!success)
- LOG(WARNING) << "Failed to connect to orientation changed signal.";
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/dbus/sensors_source.h ('k') | chrome/browser/chromeos/dbus/speech_synthesizer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698