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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 virtual bool IsPopupOrPanel( | 45 virtual bool IsPopupOrPanel( |
46 const content::WebContents* source) const OVERRIDE { | 46 const content::WebContents* source) const OVERRIDE { |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 virtual void MoveContents(content::WebContents* source, | 50 virtual void MoveContents(content::WebContents* source, |
51 const gfx::Rect& pos) OVERRIDE { | 51 const gfx::Rect& pos) OVERRIDE { |
52 aura::Window* keyboard = proxy_->GetKeyboardWindow(); | 52 aura::Window* keyboard = proxy_->GetKeyboardWindow(); |
| 53 // keyboard window must have been added to keyboard container window at this |
| 54 // point. Otherwise, wrong keyboard bounds is used and may cause problem as |
| 55 // described in crbug.com/367788. |
| 56 DCHECK(keyboard->parent()); |
53 gfx::Rect bounds = keyboard->bounds(); | 57 gfx::Rect bounds = keyboard->bounds(); |
54 int new_height = pos.height(); | 58 int new_height = pos.height(); |
55 bounds.set_y(bounds.y() + bounds.height() - new_height); | 59 bounds.set_y(bounds.y() + bounds.height() - new_height); |
56 bounds.set_height(new_height); | 60 bounds.set_height(new_height); |
57 keyboard->SetBounds(bounds); | 61 keyboard->SetBounds(bounds); |
58 } | 62 } |
59 | 63 |
60 // Overridden from content::WebContentsDelegate: | 64 // Overridden from content::WebContentsDelegate: |
61 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, | 65 virtual void RequestMediaAccessPermission(content::WebContents* web_contents, |
62 const content::MediaStreamRequest& request, | 66 const content::MediaStreamRequest& request, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 DCHECK(keyboard_contents_); | 158 DCHECK(keyboard_contents_); |
155 if (keyboard_contents_->GetURL() != GetVirtualKeyboardUrl()) { | 159 if (keyboard_contents_->GetURL() != GetVirtualKeyboardUrl()) { |
156 LoadContents(GetVirtualKeyboardUrl()); | 160 LoadContents(GetVirtualKeyboardUrl()); |
157 } | 161 } |
158 } | 162 } |
159 | 163 |
160 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { | 164 void KeyboardControllerProxy::SetupWebContents(content::WebContents* contents) { |
161 } | 165 } |
162 | 166 |
163 } // namespace keyboard | 167 } // namespace keyboard |
OLD | NEW |