OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 ALLOW_THIS_IN_INITIALIZER_LIST( | 177 ALLOW_THIS_IN_INITIALIZER_LIST( |
178 extension_dispatcher_(ProfileManager::GetDefaultProfile(), this)), | 178 extension_dispatcher_(ProfileManager::GetDefaultProfile(), this)), |
179 target_(NULL), | 179 target_(NULL), |
180 keyboard_height_(kDefaultKeyboardHeight) { | 180 keyboard_height_(kDefaultKeyboardHeight) { |
181 | 181 |
182 // Initialize the widget first. | 182 // Initialize the widget first. |
183 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 183 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
184 params.keep_on_top = true; | 184 params.keep_on_top = true; |
185 params.transparent = true; | 185 params.transparent = true; |
186 params.bounds = GetKeyboardPosition(keyboard_height_); | 186 params.bounds = GetKeyboardPosition(keyboard_height_); |
| 187 Init(params); |
187 #if defined(USE_AURA) | 188 #if defined(USE_AURA) |
188 params.parent = aura_shell::Shell::GetInstance()->GetContainer( | 189 aura_shell::Shell::GetInstance()->GetContainer( |
189 aura_shell::internal::kShellWindowId_MenusAndTooltipsContainer); | 190 aura_shell::internal::kShellWindowId_MenusAndTooltipsContainer)-> |
| 191 AddChild(GetNativeView()); |
190 #endif | 192 #endif |
191 Init(params); | |
192 | 193 |
193 // Setup the DOM view to host the keyboard. | 194 // Setup the DOM view to host the keyboard. |
194 Profile* profile = ProfileManager::GetDefaultProfile(); | 195 Profile* profile = ProfileManager::GetDefaultProfile(); |
195 GURL keyboard_url(chrome::kChromeUIKeyboardURL); | 196 GURL keyboard_url(chrome::kChromeUIKeyboardURL); |
196 dom_view_->Init(profile, | 197 dom_view_->Init(profile, |
197 SiteInstance::CreateSiteInstanceForURL(profile, keyboard_url)); | 198 SiteInstance::CreateSiteInstanceForURL(profile, keyboard_url)); |
198 dom_view_->LoadURL(keyboard_url); | 199 dom_view_->LoadURL(keyboard_url); |
199 dom_view_->SetVisible(true); | 200 dom_view_->SetVisible(true); |
200 SetContentsView(dom_view_); | 201 SetContentsView(dom_view_); |
201 | 202 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 555 |
555 void VirtualKeyboardManager::OnDesktopBoundsChanged( | 556 void VirtualKeyboardManager::OnDesktopBoundsChanged( |
556 const gfx::Rect& prev_bounds) { | 557 const gfx::Rect& prev_bounds) { |
557 keyboard_->ResetBounds(); | 558 keyboard_->ResetBounds(); |
558 } | 559 } |
559 | 560 |
560 // static | 561 // static |
561 VirtualKeyboardManager* VirtualKeyboardManager::GetInstance() { | 562 VirtualKeyboardManager* VirtualKeyboardManager::GetInstance() { |
562 return Singleton<VirtualKeyboardManager>::get(); | 563 return Singleton<VirtualKeyboardManager>::get(); |
563 } | 564 } |
OLD | NEW |