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