| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void MoveContents(content::WebContents* source, | 51 void MoveContents(content::WebContents* source, |
| 52 const gfx::Rect& pos) override { | 52 const gfx::Rect& pos) override { |
| 53 aura::Window* keyboard = proxy_->GetKeyboardWindow(); | 53 aura::Window* keyboard = proxy_->GetKeyboardWindow(); |
| 54 // keyboard window must have been added to keyboard container window at this | 54 // keyboard window must have been added to keyboard container window at this |
| 55 // point. Otherwise, wrong keyboard bounds is used and may cause problem as | 55 // point. Otherwise, wrong keyboard bounds is used and may cause problem as |
| 56 // described in crbug.com/367788. | 56 // described in crbug.com/367788. |
| 57 DCHECK(keyboard->parent()); | 57 DCHECK(keyboard->parent()); |
| 58 gfx::Rect bounds = keyboard->bounds(); | 58 // keyboard window bounds may not set to |pos| after this call. If keyboard |
| 59 int new_height = pos.height(); | 59 // is in FULL_WIDTH mode, only the height of keyboard window will be |
| 60 bounds.set_y(bounds.y() + bounds.height() - new_height); | 60 // changed. |
| 61 bounds.set_height(new_height); | 61 keyboard->SetBounds(pos); |
| 62 // Keyboard bounds should only be reset when it actually changes. Otherwise | |
| 63 // it interrupts the initial animation of showing the keyboard. Described in | |
| 64 // crbug.com/356753. | |
| 65 if (bounds != keyboard->bounds()) | |
| 66 keyboard->SetBounds(bounds); | |
| 67 } | 62 } |
| 68 | 63 |
| 69 // Overridden from content::WebContentsDelegate: | 64 // Overridden from content::WebContentsDelegate: |
| 70 void RequestMediaAccessPermission( | 65 void RequestMediaAccessPermission( |
| 71 content::WebContents* web_contents, | 66 content::WebContents* web_contents, |
| 72 const content::MediaStreamRequest& request, | 67 const content::MediaStreamRequest& request, |
| 73 const content::MediaResponseCallback& callback) override { | 68 const content::MediaResponseCallback& callback) override { |
| 74 proxy_->RequestAudioInput(web_contents, request, callback); | 69 proxy_->RequestAudioInput(web_contents, request, callback); |
| 75 } | 70 } |
| 76 | 71 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 197 } |
| 203 | 198 |
| 204 shadow_->SetContentBounds(new_bounds); | 199 shadow_->SetContentBounds(new_bounds); |
| 205 } | 200 } |
| 206 | 201 |
| 207 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { | 202 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { |
| 208 window->RemoveObserver(this); | 203 window->RemoveObserver(this); |
| 209 } | 204 } |
| 210 | 205 |
| 211 } // namespace keyboard | 206 } // namespace keyboard |
| OLD | NEW |