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

Unified Diff: content/browser/device_orientation/orientation.h

Issue 10755002: Refactors DeviceOrientation to make it more extensible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Handles null device_data in observer Created 8 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/device_orientation/orientation.h
diff --git a/content/browser/device_orientation/orientation.h b/content/browser/device_orientation/orientation.h
index 543ff0bc7f3026b1048fd45bad12dc5a05129332..770b8dc32962b7d362aa12322fb25815a58fba2e 100644
--- a/content/browser/device_orientation/orientation.h
+++ b/content/browser/device_orientation/orientation.h
@@ -5,8 +5,12 @@
#ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_ORIENTATION_H_
#define CONTENT_BROWSER_DEVICE_ORIENTATION_ORIENTATION_H_
+#include "base/compiler_specific.h"
+#include "content/browser/device_orientation/device_data.h"
+
namespace device_orientation {
-class Orientation {
+
+class Orientation : public DeviceData {
public:
// alpha, beta, gamma and absolute are the rotations around the axes as
// specified in http://dev.w3.org/geo/api/spec-source-orientation.html
@@ -15,42 +19,17 @@ class Orientation {
// for that variable.
Orientation()
- : alpha_(0),
- beta_(0),
- gamma_(0),
- absolute_(false),
- can_provide_alpha_(false),
+ : can_provide_alpha_(false),
can_provide_beta_(false),
can_provide_gamma_(false),
can_provide_absolute_(false) {
}
- Orientation(const Orientation& orientation)
- : alpha_(orientation.alpha()),
- beta_(orientation.beta()),
- gamma_(orientation.gamma()),
- absolute_(orientation.absolute()),
- can_provide_alpha_(orientation.can_provide_alpha()),
- can_provide_beta_(orientation.can_provide_beta()),
- can_provide_gamma_(orientation.can_provide_gamma()),
- can_provide_absolute_(orientation.can_provide_absolute()) {
- }
- void operator=(const Orientation& source) {
- alpha_ = source.alpha();
- beta_ = source.beta();
- gamma_ = source.gamma();
- absolute_ = source.absolute();
- can_provide_alpha_ = source.can_provide_alpha();
- can_provide_beta_ = source.can_provide_beta();
- can_provide_gamma_ = source.can_provide_gamma();
- can_provide_absolute_ = source.can_provide_absolute();
- }
-
- static Orientation Empty() { return Orientation(); }
- bool is_empty() const {
- return !can_provide_alpha_ && !can_provide_beta_ && !can_provide_gamma_
- && !can_provide_absolute_;
- }
+ virtual DeviceData* Clone() const OVERRIDE;
+ virtual bool IsEmpty() const OVERRIDE;
+ virtual bool SignificantlyDifferentFrom(
+ const DeviceData& other) const OVERRIDE;
+ virtual IPC::Message* CreateIPCMessage(int render_view_id) const OVERRIDE;
void set_alpha(double alpha) {
can_provide_alpha_ = true;

Powered by Google App Engine
This is Rietveld 408576698