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 9ba91608a547f0687f502b24600adb2c89ca6fac..9e73a47d176af04dd9d78784544cceeb5c83a8ff 100644 |
| --- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc |
| +++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc |
| @@ -28,7 +28,7 @@ |
| namespace { |
| -const int kKeyboardHeight = 360; |
| +const int kKeyboardHeight = 300; |
|
bryeung
2011/06/03 19:14:52
please rename to kDefaultKeyboardHeight
Peng
2011/06/03 22:22:10
Done.
|
| const int kKeyboardSlideDuration = 500; // In milliseconds |
| PropertyAccessor<bool>* GetFocusedStateAccessor() { |
| @@ -54,6 +54,7 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame, |
| BrowserView* browser_view) |
| : OpaqueBrowserFrameView(frame, browser_view), |
| keyboard_showing_(false), |
| + keyboard_height_(kKeyboardHeight), |
| focus_listener_added_(false), |
| keyboard_(NULL) { |
| registrar_.Add(this, |
| @@ -68,6 +69,9 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame, |
| registrar_.Add(this, |
| NotificationType::HIDE_KEYBOARD_INVOKED, |
| NotificationService::AllSources()); |
| + registrar_.Add(this, |
| + NotificationType::SET_KEYBOARD_HEIGHT_INVOKED, |
| + NotificationService::AllSources()); |
| browser_view->browser()->tabstrip_model()->AddObserver(this); |
| @@ -97,8 +101,8 @@ void TouchBrowserFrameView::Layout() { |
| // same bounds as when the keyboard is visible. But |
| // |GetBoundsForReservedArea| should not take this into account so that the |
| // render view gets the entire area to relayout itself. |
| - bounds.set_y(bounds.y() - kKeyboardHeight); |
| - bounds.set_height(kKeyboardHeight); |
| + bounds.set_y(bounds.y() - keyboard_height_); |
| + bounds.set_height(keyboard_height_); |
| } |
| keyboard_->SetBoundsRect(bounds); |
| } |
| @@ -116,7 +120,7 @@ void TouchBrowserFrameView::FocusWillChange(views::View* focused_before, |
| /////////////////////////////////////////////////////////////////////////////// |
| // TouchBrowserFrameView, protected: |
| int TouchBrowserFrameView::GetReservedHeight() const { |
| - return keyboard_showing_ ? kKeyboardHeight : 0; |
| + return keyboard_showing_ ? keyboard_height_ : 0; |
| } |
| void TouchBrowserFrameView::ViewHierarchyChanged(bool is_add, |
| @@ -174,7 +178,7 @@ void TouchBrowserFrameView::UpdateKeyboardAndLayout(bool should_show_keyboard) { |
| animation_->Hide(); |
| browser_view()->set_clip_y(ui::Tween::ValueBetween( |
| - animation_->GetCurrentValue(), 0, kKeyboardHeight)); |
| + animation_->GetCurrentValue(), 0, keyboard_height_)); |
| parent()->Layout(); |
| } |
| } |
| @@ -286,6 +290,12 @@ void TouchBrowserFrameView::Observe(NotificationType type, |
| false); |
| } |
| UpdateKeyboardAndLayout(false); |
| + } else if (type == NotificationType::SET_KEYBOARD_HEIGHT_INVOKED) { |
| + int height = *reinterpret_cast<int*>(details.map_key()); |
| + if (height != keyboard_height_) { |
|
bryeung
2011/06/03 19:14:52
we need to do more error checking here, e.g.:
- d
Peng
2011/06/03 22:22:10
Done.
|
| + keyboard_height_ = height; |
| + parent()->Layout(); |
| + } |
| } |
| } |
| @@ -294,10 +304,10 @@ void TouchBrowserFrameView::Observe(NotificationType type, |
| void TouchBrowserFrameView::AnimationProgressed(const ui::Animation* anim) { |
| ui::Transform transform; |
| transform.SetTranslateY( |
| - ui::Tween::ValueBetween(anim->GetCurrentValue(), kKeyboardHeight, 0)); |
| + ui::Tween::ValueBetween(anim->GetCurrentValue(), keyboard_height_, 0)); |
| keyboard_->SetTransform(transform); |
| browser_view()->set_clip_y( |
| - ui::Tween::ValueBetween(anim->GetCurrentValue(), 0, kKeyboardHeight)); |
| + ui::Tween::ValueBetween(anim->GetCurrentValue(), 0, keyboard_height_)); |
| SchedulePaint(); |
| } |