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" | |
10 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" | 9 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
11 #include "content/common/notification_observer.h" | 10 #include "content/common/notification_observer.h" |
12 #include "content/common/notification_registrar.h" | 11 #include "content/common/notification_registrar.h" |
13 #include "ui/base/animation/animation_delegate.h" | 12 #include "ui/base/animation/animation_delegate.h" |
14 #include "views/focus/focus_manager.h" | 13 #include "views/ime/input_method.h" |
15 | 14 |
16 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
17 #include "chrome/browser/chromeos/cros/input_method_library.h" | 16 #include "chrome/browser/chromeos/cros/input_method_library.h" |
18 #endif | 17 #endif |
19 | 18 |
20 class BrowserFrame; | 19 class BrowserFrame; |
21 class BrowserView; | 20 class BrowserView; |
22 class KeyboardContainerView; | 21 class KeyboardContainerView; |
23 class NotificationDetails; | 22 class NotificationDetails; |
24 class NotificationSource; | 23 class NotificationSource; |
25 | 24 |
26 namespace ui { | 25 namespace ui { |
27 class SlideAnimation; | 26 class SlideAnimation; |
28 } | 27 } |
29 | 28 |
30 class TouchBrowserFrameView | 29 class TouchBrowserFrameView |
31 : public OpaqueBrowserFrameView, | 30 : public OpaqueBrowserFrameView, |
32 public views::FocusChangeListener, | |
33 public TabStripModelObserver, | |
34 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
35 public chromeos::InputMethodLibrary::VirtualKeyboardObserver, | 32 public chromeos::InputMethodLibrary::VirtualKeyboardObserver, |
36 #endif | 33 #endif |
37 public ui::AnimationDelegate { | 34 public ui::AnimationDelegate, |
| 35 public views::TextInputTypeChangedListener { |
38 public: | 36 public: |
39 enum VirtualKeyboardType { | 37 enum VirtualKeyboardType { |
40 NONE, | 38 NONE, |
41 GENERIC, | 39 GENERIC, |
42 URL, | 40 URL, |
43 }; | 41 }; |
44 | 42 |
45 // Internal class name. | 43 // Internal class name. |
46 static const char kViewClassName[]; | 44 static const char kViewClassName[]; |
47 | 45 |
48 // Constructs a non-client view for an BrowserFrame. | 46 // Constructs a non-client view for an BrowserFrame. |
49 TouchBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 47 TouchBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
50 virtual ~TouchBrowserFrameView(); | 48 virtual ~TouchBrowserFrameView(); |
51 | 49 |
52 // Overriden from Views. | 50 // Overriden from Views. |
53 virtual std::string GetClassName() const OVERRIDE; | 51 virtual std::string GetClassName() const OVERRIDE; |
54 | 52 |
55 // Overridden from OpaqueBrowserFrameView | 53 // Overridden from OpaqueBrowserFrameView |
56 virtual void Layout(); | 54 virtual void Layout(); |
57 | 55 |
58 // views::FocusChangeListener implementation | |
59 virtual void FocusWillChange(views::View* focused_before, | |
60 views::View* focused_now); | |
61 | |
62 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
63 // InputMethodLibrary::VirtualKeyboardObserver implementation. | 57 // InputMethodLibrary::VirtualKeyboardObserver implementation. |
64 virtual void VirtualKeyboardChanged( | 58 virtual void VirtualKeyboardChanged( |
65 chromeos::InputMethodLibrary* obj, | 59 chromeos::InputMethodLibrary* obj, |
66 const chromeos::input_method::VirtualKeyboard& virtual_keyboard, | 60 const chromeos::input_method::VirtualKeyboard& virtual_keyboard, |
67 const std::string& virtual_keyboard_layout); | 61 const std::string& virtual_keyboard_layout); |
68 #endif | 62 #endif |
69 | 63 |
70 protected: | 64 protected: |
71 // Overridden from OpaqueBrowserFrameView | 65 // Overridden from OpaqueBrowserFrameView |
72 virtual int GetReservedHeight() const; | 66 virtual int GetReservedHeight() const; |
73 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); | 67 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); |
74 | 68 |
75 private: | 69 private: |
76 virtual void InitVirtualKeyboard(); | 70 virtual void InitVirtualKeyboard(); |
| 71 void UpdateKeyboard(ui::TextInputType type); |
77 virtual void UpdateKeyboardAndLayout(bool should_show_keyboard); | 72 virtual void UpdateKeyboardAndLayout(bool should_show_keyboard); |
78 virtual VirtualKeyboardType DecideKeyboardStateForView(views::View* view); | |
79 | 73 |
80 // Overridden from views::View | 74 // Overridden from views::View |
81 virtual bool HitTest(const gfx::Point& point) const OVERRIDE; | 75 virtual bool HitTest(const gfx::Point& point) const OVERRIDE; |
82 | 76 |
83 // Overrridden from TabStripModelObserver. | |
84 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | |
85 TabContentsWrapper* new_contents, | |
86 int index, | |
87 bool user_gesture); | |
88 virtual void TabStripEmpty(); | |
89 | |
90 // Overridden from NotificationObserver. | 77 // Overridden from NotificationObserver. |
91 virtual void Observe(NotificationType type, | 78 virtual void Observe(NotificationType type, |
92 const NotificationSource& source, | 79 const NotificationSource& source, |
93 const NotificationDetails& details); | 80 const NotificationDetails& details); |
94 | 81 |
95 // Overridden from ui::AnimationDelegate: | 82 // Overridden from ui::AnimationDelegate: |
96 virtual void AnimationProgressed(const ui::Animation* animation); | 83 virtual void AnimationProgressed(const ui::Animation* animation); |
97 virtual void AnimationEnded(const ui::Animation* animation); | 84 virtual void AnimationEnded(const ui::Animation* animation); |
98 | 85 |
| 86 // Overridden from view::TextInputTypeChangedListener: |
| 87 virtual void TextInputTypeChanged(views::View* view, ui::TextInputType type); |
| 88 |
99 bool keyboard_showing_; | 89 bool keyboard_showing_; |
100 int keyboard_height_; | 90 int keyboard_height_; |
101 bool focus_listener_added_; | 91 bool focus_listener_added_; |
102 KeyboardContainerView* keyboard_; | 92 KeyboardContainerView* keyboard_; |
103 NotificationRegistrar registrar_; | 93 NotificationRegistrar registrar_; |
104 | 94 |
105 scoped_ptr<ui::SlideAnimation> animation_; | 95 scoped_ptr<ui::SlideAnimation> animation_; |
106 | 96 |
107 DISALLOW_COPY_AND_ASSIGN(TouchBrowserFrameView); | 97 DISALLOW_COPY_AND_ASSIGN(TouchBrowserFrameView); |
108 }; | 98 }; |
109 | 99 |
110 #endif // CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ | 100 #endif // CHROME_BROWSER_UI_TOUCH_FRAME_TOUCH_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |