Chromium Code Reviews| Index: chrome/browser/ui/touch/frame/touch_browser_frame_view.cc |
| diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc |
| index 545f31cc28923a2116a3dff889799778bdae21da..41789042243330c449719dbca5c46a559eec52a8 100644 |
| --- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc |
| +++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc |
| @@ -38,6 +38,9 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame, |
| } |
| TouchBrowserFrameView::~TouchBrowserFrameView() { |
| + if (focus_change_listener_.get()) { |
| + GetFocusManager()->RemoveFocusChangeListener(focus_change_listener_.get()); |
| + } |
| } |
| void TouchBrowserFrameView::Layout() { |
| @@ -59,6 +62,15 @@ int TouchBrowserFrameView::GetReservedHeight() const { |
| return 0; |
| } |
| +void TouchBrowserFrameView::ViewHierarchyChanged(bool is_add, View* parent, |
|
bryeung
2011/01/27 20:50:34
Why are we doing this in ViewHierarchyChanged? Is
oshima
2011/01/27 21:35:41
Yes, this is a standard item to initialize things
|
| + View* child) { |
|
oshima
2011/01/27 19:58:33
fix indentation. see my comment in header.
varunjain
2011/01/27 23:01:38
Done.
|
| + OpaqueBrowserFrameView::ViewHierarchyChanged(is_add, parent, child); |
| + if (!focus_change_listener_.get()) { |
|
oshima
2011/01/27 19:58:33
You need to check GetWidget(). This assumes that t
varunjain
2011/01/27 23:01:38
GetWidget is checked inside GetFocusManager. I wil
|
| + focus_change_listener_.reset(new TouchBrowserFocusChangeListener(this)); |
| + GetFocusManager()->AddFocusChangeListener(focus_change_listener_.get()); |
|
bryeung
2011/01/27 20:50:34
Related to oshima's point: GetFocusManager can ret
varunjain
2011/01/27 23:01:38
Done.
|
| + } |
| +} |
| + |
| /////////////////////////////////////////////////////////////////////////////// |
| // TouchBrowserFrameView, private: |
| @@ -118,3 +130,24 @@ void TouchBrowserFrameView::Observe(NotificationType type, |
| UpdateKeyboardAndLayout(false); |
| } |
| } |
| + |
| +/////////////////////////////////////////////////////////////////////////////// |
| +// |
| +// TouchBrowserFocusChangeListener |
| +// |
| +/////////////////////////////////////////////////////////////////////////////// |
| + |
| +TouchBrowserFrameView::TouchBrowserFocusChangeListener |
| + ::TouchBrowserFocusChangeListener(TouchBrowserFrameView* browser_frame) |
| + : touch_browser_frame_(browser_frame) { |
| +} |
| + |
| +void TouchBrowserFrameView::TouchBrowserFocusChangeListener::FocusWillChange( |
| + views::View* focused_before, views::View* focused_now) { |
| + if (!focused_before || (focused_now && focused_now->GetVirtualKeyboardType() |
|
oshima
2011/01/27 19:58:33
moving the "(forcusd_now && .." to next line would
varunjain
2011/01/27 23:01:38
Done.
|
| + != focused_before->GetVirtualKeyboardType())) { |
| + // TODO: support other types of keyboard. |
| + touch_browser_frame_->UpdateKeyboardAndLayout( |
| + focused_now->GetVirtualKeyboardType() == views::View::REGULAR_KEYBOARD); |
| + } |
| +} |