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

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: Small changes to appease try bots Created 8 years, 4 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..8abf364e0f5397f096030d94841d655508b553e3 100644
--- a/content/browser/device_orientation/orientation.h
+++ b/content/browser/device_orientation/orientation.h
@@ -5,52 +5,24 @@
#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"
+#include "content/common/content_export.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
//
// can_provide_{alpha,beta,gamma,absolute} is true if data can be provided
// for that variable.
+ CONTENT_EXPORT Orientation();
- Orientation()
- : alpha_(0),
- beta_(0),
- gamma_(0),
- absolute_(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_;
- }
+ // From DeviceData.
+ virtual IPC::Message* CreateIPCMessage(int render_view_id) const OVERRIDE;
+ virtual bool ShouldFireEvent(const DeviceData* old_data) const OVERRIDE;
void set_alpha(double alpha) {
can_provide_alpha_ = true;
@@ -81,6 +53,11 @@ class Orientation {
bool absolute() const { return absolute_; }
private:
+ virtual ~Orientation();
+
+ static bool IsElementSignificantlyDifferent(bool can_provide_element1,
+ bool can_provide_element2, double element1, double element2);
+
double alpha_;
double beta_;
double gamma_;
« no previous file with comments | « content/browser/device_orientation/observer_delegate.cc ('k') | content/browser/device_orientation/orientation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698