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 #ifndef CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 9 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
10 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" | 10 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 11 #include "content/browser/sensors/provider.h" |
11 #include "content/common/notification_observer.h" | 12 #include "content/common/notification_observer.h" |
12 #include "content/common/notification_registrar.h" | 13 #include "content/common/notification_registrar.h" |
13 #include "ui/base/animation/animation_delegate.h" | 14 #include "ui/base/animation/animation_delegate.h" |
14 #include "views/focus/focus_manager.h" | 15 #include "views/focus/focus_manager.h" |
15 | 16 |
16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
17 #include "chrome/browser/chromeos/cros/input_method_library.h" | 18 #include "chrome/browser/chromeos/cros/input_method_library.h" |
18 #endif | 19 #endif |
19 | 20 |
20 class BrowserFrame; | 21 class BrowserFrame; |
21 class BrowserView; | 22 class BrowserView; |
22 class KeyboardContainerView; | 23 class KeyboardContainerView; |
23 class NotificationDetails; | 24 class NotificationDetails; |
24 class NotificationSource; | 25 class NotificationSource; |
25 | 26 |
26 namespace ui { | 27 namespace ui { |
27 class SlideAnimation; | 28 class SlideAnimation; |
28 } | 29 } |
29 | 30 |
| 31 class TouchBrowserFrameView; |
| 32 |
| 33 typedef void (TouchBrowserFrameView::*OrientationChangeFn) |
| 34 (const sensors::ScreenOrientationChange*); |
| 35 |
| 36 class OrientationChangeHack : public sensors::Listener { |
| 37 public: |
| 38 OrientationChangeHack(TouchBrowserFrameView* frame, |
| 39 OrientationChangeFn function); |
| 40 virtual ~OrientationChangeHack(); |
| 41 |
| 42 virtual void SensorChanged(sensors::Channel channel, |
| 43 const std::string& data); |
| 44 void InjectSensorChanged(sensors::Channel channel, const std::string& data); |
| 45 |
| 46 private: |
| 47 scoped_refptr<sensors::Connection> connection_; |
| 48 TouchBrowserFrameView* frame_; |
| 49 OrientationChangeFn function_; |
| 50 |
| 51 // copy and assignment are allowed. |
| 52 }; |
| 53 |
30 class TouchBrowserFrameView | 54 class TouchBrowserFrameView |
31 : public OpaqueBrowserFrameView, | 55 : public OpaqueBrowserFrameView, |
32 public views::FocusChangeListener, | 56 public views::FocusChangeListener, |
33 public TabStripModelObserver, | 57 public TabStripModelObserver, |
34 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
35 public chromeos::InputMethodLibrary::VirtualKeyboardObserver, | 59 public chromeos::InputMethodLibrary::VirtualKeyboardObserver, |
36 #endif | 60 #endif |
37 public ui::AnimationDelegate { | 61 public ui::AnimationDelegate { |
38 public: | 62 public: |
39 enum VirtualKeyboardType { | 63 enum VirtualKeyboardType { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 113 |
90 // Overridden from NotificationObserver. | 114 // Overridden from NotificationObserver. |
91 virtual void Observe(NotificationType type, | 115 virtual void Observe(NotificationType type, |
92 const NotificationSource& source, | 116 const NotificationSource& source, |
93 const NotificationDetails& details); | 117 const NotificationDetails& details); |
94 | 118 |
95 // Overridden from ui::AnimationDelegate: | 119 // Overridden from ui::AnimationDelegate: |
96 virtual void AnimationProgressed(const ui::Animation* animation); | 120 virtual void AnimationProgressed(const ui::Animation* animation); |
97 virtual void AnimationEnded(const ui::Animation* animation); | 121 virtual void AnimationEnded(const ui::Animation* animation); |
98 | 122 |
| 123 // Orientation changed |
| 124 void OnScreenOrientationChanged( |
| 125 const sensors::ScreenOrientationChange* change); |
| 126 |
99 bool keyboard_showing_; | 127 bool keyboard_showing_; |
100 int keyboard_height_; | 128 int keyboard_height_; |
101 bool focus_listener_added_; | 129 bool focus_listener_added_; |
102 KeyboardContainerView* keyboard_; | 130 KeyboardContainerView* keyboard_; |
103 NotificationRegistrar registrar_; | 131 NotificationRegistrar registrar_; |
104 | 132 |
| 133 // state for rotation. |
| 134 sensors::ScreenOrientationChange::Side up_; |
| 135 int original_width_; |
| 136 int original_height_; |
| 137 OrientationChangeHack hack_; |
| 138 |
105 scoped_ptr<ui::SlideAnimation> animation_; | 139 scoped_ptr<ui::SlideAnimation> animation_; |
106 | 140 |
107 DISALLOW_COPY_AND_ASSIGN(TouchBrowserFrameView); | 141 DISALLOW_COPY_AND_ASSIGN(TouchBrowserFrameView); |
108 }; | 142 }; |
109 | 143 |
110 #endif // CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ | 144 #endif // CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |