| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 const aura::Window* KeyboardUIContent::GetKeyboardRootWindow() const { | 290 const aura::Window* KeyboardUIContent::GetKeyboardRootWindow() const { |
| 291 if (!keyboard_contents_) { | 291 if (!keyboard_contents_) { |
| 292 return nullptr; | 292 return nullptr; |
| 293 } | 293 } |
| 294 return keyboard_contents_->GetNativeView()->GetRootWindow(); | 294 return keyboard_contents_->GetNativeView()->GetRootWindow(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void KeyboardUIContent::LoadContents(const GURL& url) { | 297 void KeyboardUIContent::LoadContents(const GURL& url) { |
| 298 if (keyboard_contents_) { | 298 if (keyboard_contents_) { |
| 299 content::OpenURLParams params( | 299 content::OpenURLParams params(url, content::Referrer(), |
| 300 url, | 300 WindowOpenDisposition::SINGLETON_TAB, |
| 301 content::Referrer(), | 301 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false); |
| 302 SINGLETON_TAB, | |
| 303 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
| 304 false); | |
| 305 keyboard_contents_->OpenURL(params); | 302 keyboard_contents_->OpenURL(params); |
| 306 } | 303 } |
| 307 } | 304 } |
| 308 | 305 |
| 309 const GURL& KeyboardUIContent::GetVirtualKeyboardUrl() { | 306 const GURL& KeyboardUIContent::GetVirtualKeyboardUrl() { |
| 310 if (keyboard::IsInputViewEnabled()) { | 307 if (keyboard::IsInputViewEnabled()) { |
| 311 const GURL& override_url = GetOverrideContentUrl(); | 308 const GURL& override_url = GetOverrideContentUrl(); |
| 312 return override_url.is_valid() ? override_url : default_url_; | 309 return override_url.is_valid() ? override_url : default_url_; |
| 313 } else { | 310 } else { |
| 314 return default_url_; | 311 return default_url_; |
| 315 } | 312 } |
| 316 } | 313 } |
| 317 | 314 |
| 318 bool KeyboardUIContent::ShouldEnableInsets(aura::Window* window) { | 315 bool KeyboardUIContent::ShouldEnableInsets(aura::Window* window) { |
| 319 aura::Window* keyboard_window = GetKeyboardWindow(); | 316 aura::Window* keyboard_window = GetKeyboardWindow(); |
| 320 return (keyboard_window->GetRootWindow() == window->GetRootWindow() && | 317 return (keyboard_window->GetRootWindow() == window->GetRootWindow() && |
| 321 keyboard::IsKeyboardOverscrollEnabled() && | 318 keyboard::IsKeyboardOverscrollEnabled() && |
| 322 keyboard_window->IsVisible() && | 319 keyboard_window->IsVisible() && |
| 323 keyboard_controller()->keyboard_visible()); | 320 keyboard_controller()->keyboard_visible()); |
| 324 } | 321 } |
| 325 | 322 |
| 326 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { | 323 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { |
| 327 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; | 324 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; |
| 328 if (target_window) | 325 if (target_window) |
| 329 window_bounds_observer_->AddObservedWindow(target_window); | 326 window_bounds_observer_->AddObservedWindow(target_window); |
| 330 } | 327 } |
| 331 | 328 |
| 332 } // namespace keyboard | 329 } // namespace keyboard |
| OLD | NEW |