Index: chrome/browser/ui/touch/frame/touch_browser_frame_view.h |
diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.h b/chrome/browser/ui/touch/frame/touch_browser_frame_view.h |
index a680fbc603eb9dbe809e6334aa48b9e2fee951f5..71975a41b1132a56f7935ac661afbe1016136d47 100644 |
--- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.h |
+++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.h |
@@ -8,6 +8,7 @@ |
#include "chrome/browser/tabs/tab_strip_model_observer.h" |
#include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
+#include "content/browser/sensors/provider.h" |
#include "content/common/notification_observer.h" |
#include "content/common/notification_registrar.h" |
#include "ui/base/animation/animation_delegate.h" |
@@ -27,6 +28,29 @@ namespace ui { |
class SlideAnimation; |
} |
+class TouchBrowserFrameView; |
+ |
+typedef void (TouchBrowserFrameView::*OrientationChangeFn) |
+ (const sensors::ScreenOrientationChange*); |
+ |
+class OrientationChangeHack : public sensors::Listener { |
+ public: |
+ OrientationChangeHack(TouchBrowserFrameView* frame, |
+ OrientationChangeFn function); |
+ virtual ~OrientationChangeHack(); |
+ |
+ virtual void SensorChanged(sensors::Channel channel, |
+ const std::string& data); |
+ void InjectSensorChanged(sensors::Channel channel, const std::string& data); |
+ |
+ private: |
+ scoped_refptr<sensors::Connection> connection_; |
+ TouchBrowserFrameView* frame_; |
+ OrientationChangeFn function_; |
+ |
+ // copy and assignment are allowed. |
+}; |
+ |
class TouchBrowserFrameView |
: public OpaqueBrowserFrameView, |
public views::FocusChangeListener, |
@@ -96,12 +120,22 @@ class TouchBrowserFrameView |
virtual void AnimationProgressed(const ui::Animation* animation); |
virtual void AnimationEnded(const ui::Animation* animation); |
+ // Orientation changed |
+ void OnScreenOrientationChanged( |
+ const sensors::ScreenOrientationChange* change); |
+ |
bool keyboard_showing_; |
int keyboard_height_; |
bool focus_listener_added_; |
KeyboardContainerView* keyboard_; |
NotificationRegistrar registrar_; |
+ // state for rotation. |
+ sensors::ScreenOrientationChange::Side up_; |
+ int original_width_; |
+ int original_height_; |
+ OrientationChangeHack hack_; |
+ |
scoped_ptr<ui::SlideAnimation> animation_; |
DISALLOW_COPY_AND_ASSIGN(TouchBrowserFrameView); |