OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller_proxy.h" | 5 #include "ui/keyboard/keyboard_controller_proxy.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/public/browser/site_instance.h" | 9 #include "content/public/browser/site_instance.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const gfx::Rect& pos) OVERRIDE { | 53 const gfx::Rect& pos) OVERRIDE { |
54 aura::Window* keyboard = proxy_->GetKeyboardWindow(); | 54 aura::Window* keyboard = proxy_->GetKeyboardWindow(); |
55 // keyboard window must have been added to keyboard container window at this | 55 // keyboard window must have been added to keyboard container window at this |
56 // point. Otherwise, wrong keyboard bounds is used and may cause problem as | 56 // point. Otherwise, wrong keyboard bounds is used and may cause problem as |
57 // described in crbug.com/367788. | 57 // described in crbug.com/367788. |
58 DCHECK(keyboard->parent()); | 58 DCHECK(keyboard->parent()); |
59 gfx::Rect bounds = keyboard->bounds(); | 59 gfx::Rect bounds = keyboard->bounds(); |
60 int new_height = pos.height(); | 60 int new_height = pos.height(); |
61 bounds.set_y(bounds.y() + bounds.height() - new_height); | 61 bounds.set_y(bounds.y() + bounds.height() - new_height); |
62 bounds.set_height(new_height); | 62 bounds.set_height(new_height); |
63 keyboard->SetBounds(bounds); | 63 // Keyboard bounds should only be reset when it actually changes. Otherwise |
| 64 // it interrupts the initial animation of showing the keyboard. Described in |
| 65 // crbug.com/356753. |
| 66 if (bounds != keyboard->bounds()) |
| 67 keyboard->SetBounds(bounds); |
64 } | 68 } |
65 | 69 |
66 // Overridden from content::WebContentsDelegate: | 70 // Overridden from content::WebContentsDelegate: |
67 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, | 71 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, |
68 const content::MediaStreamRequest& request, | 72 const content::MediaStreamRequest& request, |
69 const content::MediaResponseCallback& callback) OVERRIDE { | 73 const content::MediaResponseCallback& callback) OVERRIDE { |
70 proxy_->RequestAudioInput(web_contents, request, callback); | 74 proxy_->RequestAudioInput(web_contents, request, callback); |
71 } | 75 } |
72 | 76 |
73 // Overridden from content::WebContentsObserver: | 77 // Overridden from content::WebContentsObserver: |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 203 } |
200 | 204 |
201 shadow_->SetContentBounds(new_bounds); | 205 shadow_->SetContentBounds(new_bounds); |
202 } | 206 } |
203 | 207 |
204 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { | 208 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { |
205 window->RemoveObserver(this); | 209 window->RemoveObserver(this); |
206 } | 210 } |
207 | 211 |
208 } // namespace keyboard | 212 } // namespace keyboard |
OLD | NEW |