| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/dbus/sensors_client.h" | 5 #include "chrome/browser/chromeos/dbus/sensors_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "chrome/browser/chromeos/system/runtime_environment.h" | 9 #include "chrome/browser/chromeos/system/runtime_environment.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 weak_ptr_factory_.GetWeakPtr())); | 42 weak_ptr_factory_.GetWeakPtr())); |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~SensorsClientImpl() { | 45 virtual ~SensorsClientImpl() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 void OrientationChangedReceived(dbus::Signal* signal) { | 49 void OrientationChangedReceived(dbus::Signal* signal) { |
| 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 51 | 51 |
| 52 sensors::ScreenOrientation orientation; | 52 content::ScreenOrientation orientation; |
| 53 | 53 |
| 54 dbus::MessageReader reader(signal); | 54 dbus::MessageReader reader(signal); |
| 55 int32 upward = 0; | 55 int32 upward = 0; |
| 56 if (!reader.PopInt32(&upward)) { | 56 if (!reader.PopInt32(&upward)) { |
| 57 LOG(WARNING) << "Orientation changed signal had incorrect parameters: " | 57 LOG(WARNING) << "Orientation changed signal had incorrect parameters: " |
| 58 << signal->ToString(); | 58 << signal->ToString(); |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 VLOG(1) << "Orientation changed to upward " << upward; | 61 VLOG(1) << "Orientation changed to upward " << upward; |
| 62 orientation.upward = static_cast<sensors::ScreenOrientation::Side>(upward); | 62 orientation = static_cast<content::ScreenOrientation>(upward); |
| 63 | 63 |
| 64 sensors::Provider::GetInstance()->ScreenOrientationChanged(orientation); | 64 sensors::Provider::GetInstance()->ScreenOrientationChanged(orientation); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void OrientationChangedConnected( | 67 void OrientationChangedConnected( |
| 68 const std::string& interface_name, | 68 const std::string& interface_name, |
| 69 const std::string& signal_name, | 69 const std::string& signal_name, |
| 70 bool success) { | 70 bool success) { |
| 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 72 if (!success) | 72 if (!success) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 92 | 92 |
| 93 SensorsClient* SensorsClient::Create(dbus::Bus* bus) { | 93 SensorsClient* SensorsClient::Create(dbus::Bus* bus) { |
| 94 if (system::runtime_environment::IsRunningOnChromeOS()) { | 94 if (system::runtime_environment::IsRunningOnChromeOS()) { |
| 95 return new SensorsClientImpl(bus); | 95 return new SensorsClientImpl(bus); |
| 96 } else { | 96 } else { |
| 97 return new SensorsClientStubImpl(); | 97 return new SensorsClientStubImpl(); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace chromeos | 101 } // namespace chromeos |
| OLD | NEW |