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/values.h" | 8 #include "base/values.h" |
9 #include "content/public/browser/render_widget_host.h" | 9 #include "content/public/browser/render_widget_host.h" |
10 #include "content/public/browser/render_widget_host_iterator.h" | 10 #include "content/public/browser/render_widget_host_iterator.h" |
11 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
12 #include "content/public/browser/site_instance.h" | 12 #include "content/public/browser/site_instance.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_contents.h" | |
15 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
16 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "content/public/browser/web_contents_source.h" |
17 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
18 #include "content/public/common/bindings_policy.h" | 18 #include "content/public/common/bindings_policy.h" |
19 #include "ui/aura/layout_manager.h" | 19 #include "ui/aura/layout_manager.h" |
20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
21 #include "ui/base/ime/input_method.h" | 21 #include "ui/base/ime/input_method.h" |
22 #include "ui/base/ime/text_input_client.h" | 22 #include "ui/base/ime/text_input_client.h" |
23 #include "ui/keyboard/content/keyboard_constants.h" | 23 #include "ui/keyboard/content/keyboard_constants.h" |
24 #include "ui/keyboard/keyboard_controller.h" | 24 #include "ui/keyboard/keyboard_controller.h" |
25 #include "ui/keyboard/keyboard_switches.h" | 25 #include "ui/keyboard/keyboard_switches.h" |
26 #include "ui/keyboard/keyboard_util.h" | 26 #include "ui/keyboard/keyboard_util.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 aura::Window* KeyboardUIContent::GetKeyboardWindow() { | 185 aura::Window* KeyboardUIContent::GetKeyboardWindow() { |
186 if (!keyboard_contents_) { | 186 if (!keyboard_contents_) { |
187 content::BrowserContext* context = browser_context(); | 187 content::BrowserContext* context = browser_context(); |
188 keyboard_contents_.reset(content::WebContents::Create( | 188 keyboard_contents_.reset(content::WebContents::Create( |
189 content::WebContents::CreateParams(context, | 189 content::WebContents::CreateParams(context, |
190 content::SiteInstance::CreateForURL(context, | 190 content::SiteInstance::CreateForURL(context, |
191 GetVirtualKeyboardUrl())))); | 191 GetVirtualKeyboardUrl())))); |
| 192 WebContentsSource::CreateForWebContentsAndLocation(keyboard_contents_.get(), |
| 193 FROM_HERE); |
192 keyboard_contents_->SetDelegate(new KeyboardContentsDelegate(this)); | 194 keyboard_contents_->SetDelegate(new KeyboardContentsDelegate(this)); |
193 SetupWebContents(keyboard_contents_.get()); | 195 SetupWebContents(keyboard_contents_.get()); |
194 LoadContents(GetVirtualKeyboardUrl()); | 196 LoadContents(GetVirtualKeyboardUrl()); |
195 keyboard_contents_->GetNativeView()->AddObserver(this); | 197 keyboard_contents_->GetNativeView()->AddObserver(this); |
196 } | 198 } |
197 | 199 |
198 return keyboard_contents_->GetNativeView(); | 200 return keyboard_contents_->GetNativeView(); |
199 } | 201 } |
200 | 202 |
201 bool KeyboardUIContent::HasKeyboardWindow() const { | 203 bool KeyboardUIContent::HasKeyboardWindow() const { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 keyboard_controller()->keyboard_visible()); | 323 keyboard_controller()->keyboard_visible()); |
322 } | 324 } |
323 | 325 |
324 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { | 326 void KeyboardUIContent::AddBoundsChangedObserver(aura::Window* window) { |
325 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; | 327 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; |
326 if (target_window) | 328 if (target_window) |
327 window_bounds_observer_->AddObservedWindow(target_window); | 329 window_bounds_observer_->AddObservedWindow(target_window); |
328 } | 330 } |
329 | 331 |
330 } // namespace keyboard | 332 } // namespace keyboard |
OLD | NEW |