Chromium Code Reviews| 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 if (bounds != keyboard->bounds()) |
|
bshe
2014/09/30 21:57:16
nit: It would be nice to add a comment on why this
| |
| 64 keyboard->SetBounds(bounds); | |
| 64 } | 65 } |
| 65 | 66 |
| 66 // Overridden from content::WebContentsDelegate: | 67 // Overridden from content::WebContentsDelegate: |
| 67 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, | 68 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, |
| 68 const content::MediaStreamRequest& request, | 69 const content::MediaStreamRequest& request, |
| 69 const content::MediaResponseCallback& callback) OVERRIDE { | 70 const content::MediaResponseCallback& callback) OVERRIDE { |
| 70 proxy_->RequestAudioInput(web_contents, request, callback); | 71 proxy_->RequestAudioInput(web_contents, request, callback); |
| 71 } | 72 } |
| 72 | 73 |
| 73 // Overridden from content::WebContentsObserver: | 74 // Overridden from content::WebContentsObserver: |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 } | 200 } |
| 200 | 201 |
| 201 shadow_->SetContentBounds(new_bounds); | 202 shadow_->SetContentBounds(new_bounds); |
| 202 } | 203 } |
| 203 | 204 |
| 204 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { | 205 void KeyboardControllerProxy::OnWindowDestroyed(aura::Window* window) { |
| 205 window->RemoveObserver(this); | 206 window->RemoveObserver(this); |
| 206 } | 207 } |
| 207 | 208 |
| 208 } // namespace keyboard | 209 } // namespace keyboard |
| OLD | NEW |