OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" | 5 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_event_router.h" | 9 #include "chrome/browser/extensions/extension_event_router.h" |
10 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 10 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/tabs/tab_strip_model.h" | 13 #include "chrome/browser/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
17 #include "chrome/browser/ui/views/dom_view.h" | 17 #include "chrome/browser/ui/views/dom_view.h" |
18 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/extensions/extension_messages.h" | 20 #include "chrome/common/extensions/extension_messages.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "content/browser/site_instance.h" | |
23 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/site_instance.h" |
24 #include "content/public/browser/web_contents_observer.h" | 24 #include "content/public/browser/web_contents_observer.h" |
25 #include "ui/base/animation/animation_delegate.h" | 25 #include "ui/base/animation/animation_delegate.h" |
26 #include "ui/base/animation/slide_animation.h" | 26 #include "ui/base/animation/slide_animation.h" |
27 #include "ui/base/ime/text_input_type.h" | 27 #include "ui/base/ime/text_input_type.h" |
28 #include "ui/gfx/compositor/layer.h" | 28 #include "ui/gfx/compositor/layer.h" |
29 #include "ui/gfx/interpolated_transform.h" | 29 #include "ui/gfx/interpolated_transform.h" |
30 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
31 #include "ui/views/ime/text_input_type_tracker.h" | 31 #include "ui/views/ime/text_input_type_tracker.h" |
32 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
33 | 33 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 params.bounds = GetKeyboardPosition(keyboard_height_); | 186 params.bounds = GetKeyboardPosition(keyboard_height_); |
187 Init(params); | 187 Init(params); |
188 #if defined(USE_AURA) | 188 #if defined(USE_AURA) |
189 ash::Shell::GetInstance()->GetContainer( | 189 ash::Shell::GetInstance()->GetContainer( |
190 ash::internal::kShellWindowId_MenuAndTooltipContainer)-> | 190 ash::internal::kShellWindowId_MenuAndTooltipContainer)-> |
191 AddChild(GetNativeView()); | 191 AddChild(GetNativeView()); |
192 #endif | 192 #endif |
193 | 193 |
194 // Setup the DOM view to host the keyboard. | 194 // Setup the DOM view to host the keyboard. |
195 Profile* profile = ProfileManager::GetDefaultProfile(); | 195 Profile* profile = ProfileManager::GetDefaultProfile(); |
196 dom_view_->Init(profile, | 196 dom_view_->Init(profile, SiteInstance::CreateForURL(profile, keyboard_url_)); |
197 SiteInstance::CreateSiteInstanceForURL(profile, keyboard_url_)); | |
198 dom_view_->LoadURL(keyboard_url_); | 197 dom_view_->LoadURL(keyboard_url_); |
199 dom_view_->SetVisible(true); | 198 dom_view_->SetVisible(true); |
200 SetContentsView(dom_view_); | 199 SetContentsView(dom_view_); |
201 | 200 |
202 // Setup observer so the events from the keyboard can be handled. | 201 // Setup observer so the events from the keyboard can be handled. |
203 content::WebContentsObserver::Observe( | 202 content::WebContentsObserver::Observe( |
204 dom_view_->dom_contents()->web_contents()); | 203 dom_view_->dom_contents()->web_contents()); |
205 | 204 |
206 // Initialize the animation. | 205 // Initialize the animation. |
207 animation_.reset(new ui::SlideAnimation(this)); | 206 animation_.reset(new ui::SlideAnimation(this)); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 533 |
535 void VirtualKeyboardManager::OnWidgetClosing(views::Widget* widget) { | 534 void VirtualKeyboardManager::OnWidgetClosing(views::Widget* widget) { |
536 DCHECK_EQ(keyboard_, widget); | 535 DCHECK_EQ(keyboard_, widget); |
537 keyboard_ = NULL; | 536 keyboard_ = NULL; |
538 } | 537 } |
539 | 538 |
540 // static | 539 // static |
541 VirtualKeyboardManager* VirtualKeyboardManager::GetInstance() { | 540 VirtualKeyboardManager* VirtualKeyboardManager::GetInstance() { |
542 return Singleton<VirtualKeyboardManager>::get(); | 541 return Singleton<VirtualKeyboardManager>::get(); |
543 } | 542 } |
OLD | NEW |