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/touch/frame/touch_browser_frame_view.h" | 5 #include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" | 8 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
12 #include "chrome/browser/ui/touch/frame/keyboard_container_view.h" | 12 #include "chrome/browser/ui/touch/frame/keyboard_container_view.h" |
| 13 #include "chrome/browser/ui/touch/keyboard/keyboard_manager.h" |
13 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
14 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" | 15 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 16 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/tab_contents/navigation_controller.h" | 17 #include "content/browser/tab_contents/navigation_controller.h" |
17 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
18 #include "content/browser/tab_contents/tab_contents_view.h" | 19 #include "content/browser/tab_contents/tab_contents_view.h" |
19 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
20 #include "content/common/notification_type.h" | 21 #include "content/common/notification_type.h" |
21 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
22 #include "ui/base/animation/slide_animation.h" | 23 #include "ui/base/animation/slide_animation.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Profile* keyboard_profile = browser_view()->browser()->profile(); | 166 Profile* keyboard_profile = browser_view()->browser()->profile(); |
166 DCHECK(keyboard_profile) << "Profile required for virtual keyboard."; | 167 DCHECK(keyboard_profile) << "Profile required for virtual keyboard."; |
167 | 168 |
168 keyboard_ = new KeyboardContainerView(keyboard_profile, | 169 keyboard_ = new KeyboardContainerView(keyboard_profile, |
169 browser_view()->browser()); | 170 browser_view()->browser()); |
170 keyboard_->SetVisible(false); | 171 keyboard_->SetVisible(false); |
171 AddChildView(keyboard_); | 172 AddChildView(keyboard_); |
172 } | 173 } |
173 | 174 |
174 void TouchBrowserFrameView::UpdateKeyboardAndLayout(bool should_show_keyboard) { | 175 void TouchBrowserFrameView::UpdateKeyboardAndLayout(bool should_show_keyboard) { |
| 176 #if 0 |
175 if (should_show_keyboard) | 177 if (should_show_keyboard) |
176 InitVirtualKeyboard(); | 178 InitVirtualKeyboard(); |
177 | 179 |
178 if (should_show_keyboard == keyboard_showing_) | 180 if (should_show_keyboard == keyboard_showing_) |
179 return; | 181 return; |
| 182 #endif |
180 | 183 |
| 184 if (should_show_keyboard) { |
| 185 KeyboardManager::GetInstance()->ShowKeyboardForWidget(GetWidget()); |
| 186 } else { |
| 187 KeyboardManager::GetInstance()->Hide(); |
| 188 } |
| 189 |
| 190 #if 0 |
181 DCHECK(keyboard_); | 191 DCHECK(keyboard_); |
182 | |
183 keyboard_showing_ = should_show_keyboard; | 192 keyboard_showing_ = should_show_keyboard; |
184 if (keyboard_showing_) { | 193 if (keyboard_showing_) { |
185 // We don't re-layout the client view until the animation ends (see | 194 // We don't re-layout the client view until the animation ends (see |
186 // AnimationEnded below) because we want the client view to occupy the | 195 // AnimationEnded below) because we want the client view to occupy the |
187 // entire height during the animation. It is necessary to reset the | 196 // entire height during the animation. It is necessary to reset the |
188 // transform for the keyboard first so that the contents are sized properly | 197 // transform for the keyboard first so that the contents are sized properly |
189 // when layout, and then start the animation. | 198 // when layout, and then start the animation. |
190 ui::Transform reset; | 199 ui::Transform reset; |
191 keyboard_->SetTransform(reset); | 200 keyboard_->SetTransform(reset); |
192 Layout(); | 201 Layout(); |
193 | 202 |
194 animation_->Show(); | 203 animation_->Show(); |
195 } else { | 204 } else { |
196 animation_->Hide(); | 205 animation_->Hide(); |
197 | 206 |
198 browser_view()->set_clip_y(ui::Tween::ValueBetween( | 207 browser_view()->set_clip_y(ui::Tween::ValueBetween( |
199 animation_->GetCurrentValue(), 0, keyboard_height_)); | 208 animation_->GetCurrentValue(), 0, keyboard_height_)); |
200 parent()->Layout(); | 209 parent()->Layout(); |
201 } | 210 } |
| 211 #endif |
202 } | 212 } |
203 | 213 |
204 TouchBrowserFrameView::VirtualKeyboardType | 214 TouchBrowserFrameView::VirtualKeyboardType |
205 TouchBrowserFrameView::DecideKeyboardStateForView(views::View* view) { | 215 TouchBrowserFrameView::DecideKeyboardStateForView(views::View* view) { |
206 if (!view) | 216 if (!view) |
207 return NONE; | 217 return NONE; |
208 | 218 |
209 std::string cname = view->GetClassName(); | 219 std::string cname = view->GetClassName(); |
210 if (cname == views::Textfield::kViewClassName) { | 220 if (cname == views::Textfield::kViewClassName) { |
211 return GENERIC; | 221 return GENERIC; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 const chromeos::input_method::VirtualKeyboard& virtual_keyboard, | 376 const chromeos::input_method::VirtualKeyboard& virtual_keyboard, |
367 const std::string& virtual_keyboard_layout) { | 377 const std::string& virtual_keyboard_layout) { |
368 if (!keyboard_) | 378 if (!keyboard_) |
369 return; | 379 return; |
370 | 380 |
371 const GURL& url = virtual_keyboard.GetURLForLayout(virtual_keyboard_layout); | 381 const GURL& url = virtual_keyboard.GetURLForLayout(virtual_keyboard_layout); |
372 keyboard_->LoadURL(url); | 382 keyboard_->LoadURL(url); |
373 VLOG(1) << "VirtualKeyboardChanged: Switched to " << url.spec(); | 383 VLOG(1) << "VirtualKeyboardChanged: Switched to " << url.spec(); |
374 } | 384 } |
375 #endif | 385 #endif |
OLD | NEW |