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 3838b4f6883f50634210874bfd8cab58b3655cec..205099242133445196073367501af7790acb722d 100644 | 
| --- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc | 
| +++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc | 
| @@ -35,7 +35,8 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame, | 
| BrowserView* browser_view) | 
| : OpaqueBrowserFrameView(frame, browser_view), | 
| keyboard_showing_(false), | 
| - keyboard_(NULL) { | 
| + keyboard_(NULL), | 
| + focus_listener_added_(false) { | 
| registrar_.Add(this, | 
| NotificationType::NAV_ENTRY_COMMITTED, | 
| NotificationService::AllSources()); | 
| @@ -63,6 +64,17 @@ void TouchBrowserFrameView::Layout() { | 
| keyboard_->SetBounds(GetBoundsForReservedArea()); | 
| } | 
| +void TouchBrowserFrameView::FocusWillChange(views::View* focused_before, | 
| + views::View* focused_now) { | 
| + if (!focused_before || | 
| + (focused_now && focused_now->GetContentType() | 
| + != focused_before->GetContentType())) { | 
| + // TODO: support other types of keyboard. | 
| 
 
bryeung
2011/02/01 19:03:53
this should have a name attached to it
 
varunjain
2011/02/04 00:11:39
Done.
 
 | 
| + UpdateKeyboardAndLayout( | 
| + focused_now->GetContentType() == views::View::GENERIC_INPUT); | 
| + } | 
| +} | 
| + | 
| /////////////////////////////////////////////////////////////////////////////// | 
| // TouchBrowserFrameView, protected: | 
| int TouchBrowserFrameView::GetReservedHeight() const { | 
| @@ -72,6 +84,22 @@ int TouchBrowserFrameView::GetReservedHeight() const { | 
| return 0; | 
| } | 
| +void TouchBrowserFrameView::ViewHierarchyChanged(bool is_add, | 
| + View* parent, | 
| + View* child) { | 
| + OpaqueBrowserFrameView::ViewHierarchyChanged(is_add, parent, child); | 
| + if (is_add && child == this && !focus_listener_added_ && GetFocusManager()) { | 
| 
 
bryeung
2011/02/01 19:03:53
Maybe this would be easier to understand if you pu
 
varunjain
2011/02/04 00:11:39
Done.
 
 | 
| + // Add focus listener when this view is added to the hierarchy. | 
| + GetFocusManager()->AddFocusChangeListener(this); | 
| + focus_listener_added_ = true; | 
| + } else if (!is_add && child == this | 
| + && focus_listener_added_ && GetFocusManager()) { | 
| + // Remove focus listener when this view is removed from the hierarchy. | 
| + GetFocusManager()->RemoveFocusChangeListener(this); | 
| + focus_listener_added_ = false; | 
| + } | 
| +} | 
| + | 
| /////////////////////////////////////////////////////////////////////////////// | 
| // TouchBrowserFrameView, private: |