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/content/keyboard_ui_content.h" | 5 #include "ui/keyboard/content/keyboard_ui_content.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "content/public/browser/render_widget_host.h" | 10 #include "content/public/browser/render_widget_host.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void KeyboardUIContent::LoadSystemKeyboard() { | 154 void KeyboardUIContent::LoadSystemKeyboard() { |
155 DCHECK(keyboard_contents_); | 155 DCHECK(keyboard_contents_); |
156 if (keyboard_contents_->GetURL() != default_url_) { | 156 if (keyboard_contents_->GetURL() != default_url_) { |
157 // TODO(bshe): The height of system virtual keyboard and IME virtual | 157 // TODO(bshe): The height of system virtual keyboard and IME virtual |
158 // keyboard may different. The height needs to be restored too. | 158 // keyboard may different. The height needs to be restored too. |
159 LoadContents(default_url_); | 159 LoadContents(default_url_); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 void KeyboardUIContent::UpdateInsetsForWindow(aura::Window* window) { | 163 void KeyboardUIContent::UpdateInsetsForWindow(aura::Window* window) { |
164 aura::Window* keyboard_window = GetKeyboardWindow(); | 164 aura::Window* keyboard_container = |
| 165 keyboard_controller()->GetContainerWindow(); |
165 if (!ShouldWindowOverscroll(window)) | 166 if (!ShouldWindowOverscroll(window)) |
166 return; | 167 return; |
167 | 168 |
168 scoped_ptr<content::RenderWidgetHostIterator> widgets( | 169 scoped_ptr<content::RenderWidgetHostIterator> widgets( |
169 content::RenderWidgetHost::GetRenderWidgetHosts()); | 170 content::RenderWidgetHost::GetRenderWidgetHosts()); |
170 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { | 171 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { |
171 content::RenderWidgetHostView* view = widget->GetView(); | 172 content::RenderWidgetHostView* view = widget->GetView(); |
172 if (view && window->Contains(view->GetNativeView())) { | 173 if (view && window->Contains(view->GetNativeView())) { |
173 gfx::Rect window_bounds = view->GetNativeView()->GetBoundsInScreen(); | 174 gfx::Rect window_bounds = view->GetNativeView()->GetBoundsInScreen(); |
174 gfx::Rect intersect = | 175 gfx::Rect intersect = |
175 gfx::IntersectRects(window_bounds, keyboard_window->bounds()); | 176 gfx::IntersectRects(window_bounds, keyboard_container->bounds()); |
176 int overlap = ShouldEnableInsets(window) ? intersect.height() : 0; | 177 int overlap = ShouldEnableInsets(window) ? intersect.height() : 0; |
177 if (overlap > 0 && overlap < window_bounds.height()) | 178 if (overlap > 0 && overlap < window_bounds.height()) |
178 view->SetInsets(gfx::Insets(0, 0, overlap, 0)); | 179 view->SetInsets(gfx::Insets(0, 0, overlap, 0)); |
179 else | 180 else |
180 view->SetInsets(gfx::Insets()); | 181 view->SetInsets(gfx::Insets()); |
181 return; | 182 return; |
182 } | 183 } |
183 } | 184 } |
184 } | 185 } |
185 | 186 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 keyboard_controller()->keyboard_visible()); | 323 keyboard_controller()->keyboard_visible()); |
323 } | 324 } |
324 | 325 |
325 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { | 326 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { |
326 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; | 327 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; |
327 if (target_window) | 328 if (target_window) |
328 window_bounds_observer_->AddObservedWindow(target_window); | 329 window_bounds_observer_->AddObservedWindow(target_window); |
329 } | 330 } |
330 | 331 |
331 } // namespace keyboard | 332 } // namespace keyboard |
OLD | NEW |