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

Side by Side Diff: content/browser/device_orientation/orientation.cc

Issue 10755002: Refactors DeviceOrientation to make it more extensible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moves construction of DeviceData objects out of ProviderImpl 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/device_orientation/orientation.h"
6
7 namespace device_orientation {
8
9 DeviceData* Orientation::Clone() const {
10 Orientation* orientation = new Orientation();
bulach 2012/07/12 10:43:27 nit: odd indentation, remove one space from 10-19
aousterh 2012/07/12 17:13:57 Done.
11 orientation->alpha_ = alpha_;
12 orientation->beta_ = beta_;
13 orientation->gamma_ = gamma_;
14 orientation->absolute_ = absolute_;
15 orientation->can_provide_alpha_ = can_provide_alpha_;
16 orientation->can_provide_beta_ = can_provide_beta_;
17 orientation->can_provide_gamma_ = can_provide_gamma_;
18 orientation->can_provide_absolute_ = can_provide_absolute_;
19 return orientation;
20 }
21
22 bool Orientation::IsEmpty() const {
23 return !can_provide_alpha_ && !can_provide_beta_ && !can_provide_gamma_
24 && !can_provide_absolute_;
bulach 2012/07/12 10:43:27 nit: I think the && needs to be in the previous li
aousterh 2012/07/12 17:13:57 Done.
25 }
26
27 // Returns true if two orientations are considered different enough that
28 // observers should be notified of the new orientation.
29 bool Orientation::SignificantlyDifferentFrom(
30 const DeviceData& other_device_data) {
31 const Orientation& other_orientation =
32 static_cast<const Orientation&>(other_device_data);
33
34 return IsElementSignificantlyDifferent(can_provide_alpha_,
35 other_orientation.can_provide_alpha(),
36 alpha_,
37 other_orientation.alpha()) ||
38 IsElementSignificantlyDifferent(can_provide_beta_,
39 other_orientation.can_provide_beta(),
40 beta_,
41 other_orientation.beta()) ||
42 IsElementSignificantlyDifferent(can_provide_gamma_,
43 other_orientation.can_provide_gamma(),
44 gamma_,
45 other_orientation.gamma()) ||
46 (can_provide_absolute_ != other_orientation.can_provide_absolute() ||
bulach 2012/07/12 10:43:27 nit: no need for this parens.
aousterh 2012/07/12 17:13:57 Done.
47 absolute_ != other_orientation.absolute());
48 }
49
50 }; // namespace device_orientation
bulach 2012/07/12 10:43:27 nit: remove the ;
aousterh 2012/07/12 17:13:57 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698