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/keyboard/keyboard_manager.h" | 5 #include "chrome/browser/ui/touch/keyboard/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/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
15 #include "chrome/browser/ui/views/dom_view.h" | 15 #include "chrome/browser/ui/views/dom_view.h" |
16 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" | 16 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" |
| 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
18 #include "chrome/common/chrome_notification_types.h" | |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "content/browser/site_instance.h" | 20 #include "content/browser/site_instance.h" |
21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
22 #include "content/browser/tab_contents/tab_contents_observer.h" | 22 #include "content/browser/tab_contents/tab_contents_observer.h" |
23 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
24 #include "ui/base/animation/animation_delegate.h" | 24 #include "ui/base/animation/animation_delegate.h" |
25 #include "ui/base/animation/slide_animation.h" | 25 #include "ui/base/animation/slide_animation.h" |
26 #include "ui/base/ime/text_input_type.h" | 26 #include "ui/base/ime/text_input_type.h" |
27 #include "ui/gfx/interpolated_transform.h" | 27 #include "ui/gfx/interpolated_transform.h" |
28 #include "views/ime/text_input_type_tracker.h" | 28 #include "views/ime/text_input_type_tracker.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 transform_.reset(new ui::InterpolatedTranslation( | 206 transform_.reset(new ui::InterpolatedTranslation( |
207 gfx::Point(0, keyboard_height_), gfx::Point())); | 207 gfx::Point(0, keyboard_height_), gfx::Point())); |
208 | 208 |
209 GetRootView()->SetTransform( | 209 GetRootView()->SetTransform( |
210 transform_->Interpolate(animation_->GetCurrentValue())); | 210 transform_->Interpolate(animation_->GetCurrentValue())); |
211 animation_->Show(); | 211 animation_->Show(); |
212 | 212 |
213 MoveToTop(); | 213 MoveToTop(); |
214 Show(); | 214 Show(); |
| 215 |
| 216 bool visible = true; |
| 217 NotificationService::current()->Notify( |
| 218 chrome::NOTIFICATION_KEYBOARD_VISIBILITY_CHANGED, |
| 219 Source<KeyboardWidget>(this), |
| 220 Details<bool>(&visible)); |
215 } | 221 } |
216 | 222 |
217 void KeyboardWidget::Hide() { | 223 void KeyboardWidget::Hide() { |
218 animation_->Hide(); | 224 animation_->Hide(); |
| 225 |
| 226 bool visible = false; |
| 227 NotificationService::current()->Notify( |
| 228 chrome::NOTIFICATION_KEYBOARD_VISIBILITY_CHANGED, |
| 229 Source<KeyboardWidget>(this), |
| 230 Details<bool>(&visible)); |
219 } | 231 } |
220 | 232 |
221 void KeyboardWidget::SetTarget(views::Widget* target) { | 233 void KeyboardWidget::SetTarget(views::Widget* target) { |
222 if (target_) | 234 if (target_) |
223 target_->RemoveObserver(this); | 235 target_->RemoveObserver(this); |
224 | 236 |
225 target_ = target; | 237 target_ = target; |
226 | 238 |
227 if (target_) { | 239 if (target_) { |
228 // TODO(sad): Make |target_| the parent widget. | 240 // TODO(sad): Make |target_| the parent widget. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 438 |
427 void KeyboardManager::OnWidgetClosing(views::Widget* widget) { | 439 void KeyboardManager::OnWidgetClosing(views::Widget* widget) { |
428 DCHECK_EQ(keyboard_, widget); | 440 DCHECK_EQ(keyboard_, widget); |
429 keyboard_ = NULL; | 441 keyboard_ = NULL; |
430 } | 442 } |
431 | 443 |
432 // static | 444 // static |
433 KeyboardManager* KeyboardManager::GetInstance() { | 445 KeyboardManager* KeyboardManager::GetInstance() { |
434 return Singleton<KeyboardManager>::get(); | 446 return Singleton<KeyboardManager>::get(); |
435 } | 447 } |
OLD | NEW |