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

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: 'Moved hideKeyboard to chrome.experimental.input namespace' 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 keyboard_(NULL) { 58 keyboard_(NULL) {
59 registrar_.Add(this, 59 registrar_.Add(this,
60 NotificationType::NAV_ENTRY_COMMITTED, 60 NotificationType::NAV_ENTRY_COMMITTED,
61 NotificationService::AllSources()); 61 NotificationService::AllSources());
62 registrar_.Add(this, 62 registrar_.Add(this,
63 NotificationType::FOCUS_CHANGED_IN_PAGE, 63 NotificationType::FOCUS_CHANGED_IN_PAGE,
64 NotificationService::AllSources()); 64 NotificationService::AllSources());
65 registrar_.Add(this, 65 registrar_.Add(this,
66 NotificationType::TAB_CONTENTS_DESTROYED, 66 NotificationType::TAB_CONTENTS_DESTROYED,
67 NotificationService::AllSources()); 67 NotificationService::AllSources());
68 registrar_.Add(this,
69 NotificationType::HIDE_KEYBOARD_INVOKED,
70 NotificationService::AllSources());
68 71
69 browser_view->browser()->tabstrip_model()->AddObserver(this); 72 browser_view->browser()->tabstrip_model()->AddObserver(this);
70 73
71 animation_.reset(new ui::SlideAnimation(this)); 74 animation_.reset(new ui::SlideAnimation(this));
72 animation_->SetTweenType(ui::Tween::LINEAR); 75 animation_->SetTweenType(ui::Tween::LINEAR);
73 animation_->SetSlideDuration(kKeyboardSlideDuration); 76 animation_->SetSlideDuration(kKeyboardSlideDuration);
74 } 77 }
75 78
76 TouchBrowserFrameView::~TouchBrowserFrameView() { 79 TouchBrowserFrameView::~TouchBrowserFrameView() {
77 browser_view()->browser()->tabstrip_model()->RemoveObserver(this); 80 browser_view()->browser()->tabstrip_model()->RemoveObserver(this);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 controller->tab_contents()->property_bag(), false); 271 controller->tab_contents()->property_bag(), false);
269 } 272 }
270 } 273 }
271 if (source_browser == browser) 274 if (source_browser == browser)
272 UpdateKeyboardAndLayout(keyboard_type == GENERIC); 275 UpdateKeyboardAndLayout(keyboard_type == GENERIC);
273 } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) { 276 } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) {
274 GetFocusedStateAccessor()->DeleteProperty( 277 GetFocusedStateAccessor()->DeleteProperty(
275 Source<TabContents>(source).ptr()->property_bag()); 278 Source<TabContents>(source).ptr()->property_bag());
276 } else if (type == NotificationType::PREF_CHANGED) { 279 } else if (type == NotificationType::PREF_CHANGED) {
277 OpaqueBrowserFrameView::Observe(type, source, details); 280 OpaqueBrowserFrameView::Observe(type, source, details);
281 } else if (type == NotificationType::HIDE_KEYBOARD_INVOKED) {
282 TabContents* tab_contents =
283 browser_view()->browser()->GetSelectedTabContents();
284 if (tab_contents) {
285 GetFocusedStateAccessor()->SetProperty(tab_contents->property_bag(),
286 false);
287 }
288 UpdateKeyboardAndLayout(false);
278 } 289 }
279 } 290 }
280 291
281 /////////////////////////////////////////////////////////////////////////////// 292 ///////////////////////////////////////////////////////////////////////////////
282 // ui::AnimationDelegate implementation 293 // ui::AnimationDelegate implementation
283 void TouchBrowserFrameView::AnimationProgressed(const ui::Animation* anim) { 294 void TouchBrowserFrameView::AnimationProgressed(const ui::Animation* anim) {
284 ui::Transform transform; 295 ui::Transform transform;
285 transform.SetTranslateY( 296 transform.SetTranslateY(
286 ui::Tween::ValueBetween(anim->GetCurrentValue(), kKeyboardHeight, 0)); 297 ui::Tween::ValueBetween(anim->GetCurrentValue(), kKeyboardHeight, 0));
287 keyboard_->SetTransform(transform); 298 keyboard_->SetTransform(transform);
(...skipping 11 matching lines...) Expand all
299 310
300 // The keyboard that pops up may end up hiding the text entry. So make sure 311 // The keyboard that pops up may end up hiding the text entry. So make sure
301 // the renderer scrolls when necessary to keep the textfield visible. 312 // the renderer scrolls when necessary to keep the textfield visible.
302 RenderViewHost* host = 313 RenderViewHost* host =
303 browser_view()->browser()->GetSelectedTabContents()->render_view_host(); 314 browser_view()->browser()->GetSelectedTabContents()->render_view_host();
304 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoView( 315 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoView(
305 host->routing_id())); 316 host->routing_id()));
306 } 317 }
307 SchedulePaint(); 318 SchedulePaint();
308 } 319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698