Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/ui/touch/frame/touch_browser_frame_view.cc

Issue 7033033: Add hideKeyboard API to chrome.experimental.input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/frame/touch_browser_frame_view.h" 5 #include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" 8 #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 keyboard_(NULL) { 57 keyboard_(NULL) {
58 registrar_.Add(this, 58 registrar_.Add(this,
59 NotificationType::NAV_ENTRY_COMMITTED, 59 NotificationType::NAV_ENTRY_COMMITTED,
60 NotificationService::AllSources()); 60 NotificationService::AllSources());
61 registrar_.Add(this, 61 registrar_.Add(this,
62 NotificationType::FOCUS_CHANGED_IN_PAGE, 62 NotificationType::FOCUS_CHANGED_IN_PAGE,
63 NotificationService::AllSources()); 63 NotificationService::AllSources());
64 registrar_.Add(this, 64 registrar_.Add(this,
65 NotificationType::TAB_CONTENTS_DESTROYED, 65 NotificationType::TAB_CONTENTS_DESTROYED,
66 NotificationService::AllSources()); 66 NotificationService::AllSources());
67 registrar_.Add(this,
68 NotificationType::HIDE_KEYBOARD_INVOKED,
69 NotificationService::AllSources());
67 70
68 browser_view->browser()->tabstrip_model()->AddObserver(this); 71 browser_view->browser()->tabstrip_model()->AddObserver(this);
69 72
70 animation_.reset(new ui::SlideAnimation(this)); 73 animation_.reset(new ui::SlideAnimation(this));
71 animation_->SetTweenType(ui::Tween::LINEAR); 74 animation_->SetTweenType(ui::Tween::LINEAR);
72 animation_->SetSlideDuration(kKeyboardSlideDuration); 75 animation_->SetSlideDuration(kKeyboardSlideDuration);
73 } 76 }
74 77
75 TouchBrowserFrameView::~TouchBrowserFrameView() { 78 TouchBrowserFrameView::~TouchBrowserFrameView() {
76 browser_view()->browser()->tabstrip_model()->RemoveObserver(this); 79 browser_view()->browser()->tabstrip_model()->RemoveObserver(this);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 controller->tab_contents()->property_bag(), false); 270 controller->tab_contents()->property_bag(), false);
268 } 271 }
269 } 272 }
270 if (source_browser == browser) 273 if (source_browser == browser)
271 UpdateKeyboardAndLayout(keyboard_type == GENERIC); 274 UpdateKeyboardAndLayout(keyboard_type == GENERIC);
272 } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) { 275 } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) {
273 GetFocusedStateAccessor()->DeleteProperty( 276 GetFocusedStateAccessor()->DeleteProperty(
274 Source<TabContents>(source).ptr()->property_bag()); 277 Source<TabContents>(source).ptr()->property_bag());
275 } else if (type == NotificationType::PREF_CHANGED) { 278 } else if (type == NotificationType::PREF_CHANGED) {
276 OpaqueBrowserFrameView::Observe(type, source, details); 279 OpaqueBrowserFrameView::Observe(type, source, details);
280 } else if (type == NotificationType::HIDE_KEYBOARD_INVOKED) {
281 UpdateKeyboardAndLayout(false);
sadrul 2011/05/19 22:30:00 In case the web-page (RWHVV) is currently in focus
mazda 2011/05/20 12:16:05 I added code to reset property-bag. Thanks.
277 } 282 }
278 } 283 }
279 284
280 /////////////////////////////////////////////////////////////////////////////// 285 ///////////////////////////////////////////////////////////////////////////////
281 // ui::AnimationDelegate implementation 286 // ui::AnimationDelegate implementation
282 void TouchBrowserFrameView::AnimationProgressed(const ui::Animation* anim) { 287 void TouchBrowserFrameView::AnimationProgressed(const ui::Animation* anim) {
283 ui::Transform transform; 288 ui::Transform transform;
284 transform.SetTranslateY( 289 transform.SetTranslateY(
285 ui::Tween::ValueBetween(anim->GetCurrentValue(), kKeyboardHeight, 0)); 290 ui::Tween::ValueBetween(anim->GetCurrentValue(), kKeyboardHeight, 0));
286 keyboard_->SetTransform(transform); 291 keyboard_->SetTransform(transform);
(...skipping 10 matching lines...) Expand all
297 parent()->Layout(); 302 parent()->Layout();
298 303
299 // The keyboard that pops up may end up hiding the text entry. So make sure 304 // The keyboard that pops up may end up hiding the text entry. So make sure
300 // the renderer scrolls when necessary to keep the textfield visible. 305 // the renderer scrolls when necessary to keep the textfield visible.
301 RenderViewHost* host = 306 RenderViewHost* host =
302 browser_view()->browser()->GetSelectedTabContents()->render_view_host(); 307 browser_view()->browser()->GetSelectedTabContents()->render_view_host();
303 host->ScrollFocusedEditableNodeIntoView(); 308 host->ScrollFocusedEditableNodeIntoView();
304 } 309 }
305 SchedulePaint(); 310 SchedulePaint();
306 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698