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 #include "chrome/browser/ui/touch/status_bubble_touch.h" | 5 #include "chrome/browser/ui/touch/status_bubble_touch.h" |
6 | 6 |
7 #include "chrome/browser/ui/touch/keyboard/keyboard_manager.h" | 7 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" |
8 | 8 |
9 StatusBubbleTouch::StatusBubbleTouch(views::View* base_view) | 9 StatusBubbleTouch::StatusBubbleTouch(views::View* base_view) |
10 : StatusBubbleViews(base_view) { | 10 : StatusBubbleViews(base_view) { |
11 KeyboardManager::GetInstance()->keyboard()->AddObserver(this); | 11 VirtualKeyboardManager::GetInstance()->keyboard()->AddObserver(this); |
12 } | 12 } |
13 | 13 |
14 StatusBubbleTouch::~StatusBubbleTouch() { | 14 StatusBubbleTouch::~StatusBubbleTouch() { |
15 views::Widget* keyboard = KeyboardManager::GetInstance()->keyboard(); | 15 views::Widget* keyboard = VirtualKeyboardManager::GetInstance()->keyboard(); |
16 if (keyboard) | 16 if (keyboard) |
17 keyboard->RemoveObserver(this); | 17 keyboard->RemoveObserver(this); |
18 } | 18 } |
19 | 19 |
20 void StatusBubbleTouch::Reposition() { | 20 void StatusBubbleTouch::Reposition() { |
21 StatusBubbleViews::Reposition(); | 21 StatusBubbleViews::Reposition(); |
22 views::Widget* keyboard = KeyboardManager::GetInstance()->keyboard(); | 22 views::Widget* keyboard = VirtualKeyboardManager::GetInstance()->keyboard(); |
23 if (popup() && keyboard && keyboard->IsVisible()) { | 23 if (popup() && keyboard && keyboard->IsVisible()) { |
24 gfx::Rect popup_screen = popup()->GetWindowScreenBounds(); | 24 gfx::Rect popup_screen = popup()->GetWindowScreenBounds(); |
25 gfx::Rect keyboard_screen = keyboard->GetWindowScreenBounds(); | 25 gfx::Rect keyboard_screen = keyboard->GetWindowScreenBounds(); |
26 if (popup_screen.Intersects(keyboard_screen)) { | 26 if (popup_screen.Intersects(keyboard_screen)) { |
27 // The keyboard may be hiding the popup. Reposition above the keyboard. | 27 // The keyboard may be hiding the popup. Reposition above the keyboard. |
28 popup_screen.set_y(keyboard_screen.y() - popup_screen.height()); | 28 popup_screen.set_y(keyboard_screen.y() - popup_screen.height()); |
29 popup()->SetBounds(popup_screen); | 29 popup()->SetBounds(popup_screen); |
30 } | 30 } |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 void StatusBubbleTouch::OnWidgetVisibilityChanged(views::Widget* widget, | 34 void StatusBubbleTouch::OnWidgetVisibilityChanged(views::Widget* widget, |
35 bool visible) { | 35 bool visible) { |
36 Reposition(); | 36 Reposition(); |
37 } | 37 } |
OLD | NEW |