| 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/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 14 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" | 14 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/tab_contents/navigation_controller.h" | 16 #include "content/browser/tab_contents/navigation_controller.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "content/browser/tab_contents/tab_contents_view.h" | 18 #include "content/browser/tab_contents/tab_contents_view.h" |
| 19 #include "content/common/notification_service.h" | 19 #include "content/common/notification_service.h" |
| 20 #include "content/common/notification_type.h" | 20 #include "content/common/notification_type.h" |
| 21 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
| 22 #include "ui/base/animation/slide_animation.h" | 22 #include "ui/base/animation/slide_animation.h" |
| 23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 24 #include "ui/gfx/transform.h" | 24 #include "ui/gfx/transform.h" |
| 25 #include "views/controls/button/image_button.h" | 25 #include "views/controls/button/image_button.h" |
| 26 #include "views/controls/textfield/textfield.h" | 26 #include "views/controls/textfield/textfield.h" |
| 27 #include "views/focus/focus_manager.h" | 27 #include "views/focus/focus_manager.h" |
| 28 | 28 |
| 29 #if defined(OS_CHROMEOS) |
| 30 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 31 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" |
| 32 #endif |
| 33 |
| 29 namespace { | 34 namespace { |
| 30 | 35 |
| 31 const int kKeyboardHeight = 360; | 36 const int kKeyboardHeight = 360; |
| 32 const int kKeyboardSlideDuration = 500; // In milliseconds | 37 const int kKeyboardSlideDuration = 500; // In milliseconds |
| 33 | 38 |
| 34 PropertyAccessor<bool>* GetFocusedStateAccessor() { | 39 PropertyAccessor<bool>* GetFocusedStateAccessor() { |
| 35 static PropertyAccessor<bool> state; | 40 static PropertyAccessor<bool> state; |
| 36 return &state; | 41 return &state; |
| 37 } | 42 } |
| 38 | 43 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 NotificationService::AllSources()); | 72 NotificationService::AllSources()); |
| 68 registrar_.Add(this, | 73 registrar_.Add(this, |
| 69 NotificationType::HIDE_KEYBOARD_INVOKED, | 74 NotificationType::HIDE_KEYBOARD_INVOKED, |
| 70 NotificationService::AllSources()); | 75 NotificationService::AllSources()); |
| 71 | 76 |
| 72 browser_view->browser()->tabstrip_model()->AddObserver(this); | 77 browser_view->browser()->tabstrip_model()->AddObserver(this); |
| 73 | 78 |
| 74 animation_.reset(new ui::SlideAnimation(this)); | 79 animation_.reset(new ui::SlideAnimation(this)); |
| 75 animation_->SetTweenType(ui::Tween::LINEAR); | 80 animation_->SetTweenType(ui::Tween::LINEAR); |
| 76 animation_->SetSlideDuration(kKeyboardSlideDuration); | 81 animation_->SetSlideDuration(kKeyboardSlideDuration); |
| 82 |
| 83 #if defined(OS_CHROMEOS) |
| 84 chromeos::InputMethodLibrary* library = |
| 85 chromeos::CrosLibrary::Get()->GetInputMethodLibrary(); |
| 86 library->AddVirtualKeyboardObserver(this); |
| 87 #endif |
| 77 } | 88 } |
| 78 | 89 |
| 79 TouchBrowserFrameView::~TouchBrowserFrameView() { | 90 TouchBrowserFrameView::~TouchBrowserFrameView() { |
| 80 browser_view()->browser()->tabstrip_model()->RemoveObserver(this); | 91 browser_view()->browser()->tabstrip_model()->RemoveObserver(this); |
| 81 } | 92 } |
| 82 | 93 |
| 83 std::string TouchBrowserFrameView::GetClassName() const { | 94 std::string TouchBrowserFrameView::GetClassName() const { |
| 84 return kViewClassName; | 95 return kViewClassName; |
| 85 } | 96 } |
| 86 | 97 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 RenderViewHost* host = | 329 RenderViewHost* host = |
| 319 browser_view()->browser()->GetSelectedTabContents()->render_view_host(); | 330 browser_view()->browser()->GetSelectedTabContents()->render_view_host(); |
| 320 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoView( | 331 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoView( |
| 321 host->routing_id())); | 332 host->routing_id())); |
| 322 } else { | 333 } else { |
| 323 // Notify the keyboard that it is hidden now. | 334 // Notify the keyboard that it is hidden now. |
| 324 keyboard_->SetVisible(false); | 335 keyboard_->SetVisible(false); |
| 325 } | 336 } |
| 326 SchedulePaint(); | 337 SchedulePaint(); |
| 327 } | 338 } |
| 339 |
| 340 #if defined(OS_CHROMEOS) |
| 341 void TouchBrowserFrameView::VirtualKeyboardChanged( |
| 342 chromeos::InputMethodLibrary* obj, |
| 343 const chromeos::input_method::VirtualKeyboard& virtual_keyboard, |
| 344 const std::string& virtual_keyboard_layout) { |
| 345 if (!keyboard_) |
| 346 return; |
| 347 |
| 348 const GURL& url = virtual_keyboard.GetURLForLayout(virtual_keyboard_layout); |
| 349 keyboard_->LoadURL(url); |
| 350 VLOG(1) << "VirtualKeyboardChanged: Switched to " << url.spec(); |
| 351 } |
| 352 #endif |
| OLD | NEW |