| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller.h" | 5 #include "ui/keyboard/keyboard_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "content/public/browser/render_widget_host.h" | 9 #include "content/public/browser/render_widget_host.h" |
| 10 #include "content/public/browser/render_widget_host_iterator.h" | 10 #include "content/public/browser/render_widget_host_iterator.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 : wm::MaskedWindowTargeter(container), | 51 : wm::MaskedWindowTargeter(container), |
| 52 proxy_(proxy) { | 52 proxy_(proxy) { |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual ~KeyboardContainerTargeter() {} | 55 virtual ~KeyboardContainerTargeter() {} |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // wm::MaskedWindowTargeter: | 58 // wm::MaskedWindowTargeter: |
| 59 virtual bool GetHitTestMask(aura::Window* window, | 59 virtual bool GetHitTestMask(aura::Window* window, |
| 60 gfx::Path* mask) const OVERRIDE { | 60 gfx::Path* mask) const OVERRIDE { |
| 61 if (proxy_ && !proxy_->HasKeyboardWindow()) |
| 62 return true; |
| 61 gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() : | 63 gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() : |
| 62 keyboard::DefaultKeyboardBoundsFromWindowBounds(window->bounds()); | 64 keyboard::DefaultKeyboardBoundsFromWindowBounds(window->bounds()); |
| 63 mask->addRect(RectToSkRect(keyboard_bounds)); | 65 mask->addRect(RectToSkRect(keyboard_bounds)); |
| 64 return true; | 66 return true; |
| 65 } | 67 } |
| 66 | 68 |
| 67 keyboard::KeyboardControllerProxy* proxy_; | 69 keyboard::KeyboardControllerProxy* proxy_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(KeyboardContainerTargeter); | 71 DISALLOW_COPY_AND_ASSIGN(KeyboardContainerTargeter); |
| 70 }; | 72 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 98 const gfx::Point& location) OVERRIDE { | 100 const gfx::Point& location) OVERRIDE { |
| 99 return true; | 101 return true; |
| 100 } | 102 } |
| 101 virtual bool CanFocus() OVERRIDE { return false; } | 103 virtual bool CanFocus() OVERRIDE { return false; } |
| 102 virtual void OnCaptureLost() OVERRIDE {} | 104 virtual void OnCaptureLost() OVERRIDE {} |
| 103 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {} | 105 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {} |
| 104 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} | 106 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} |
| 105 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} | 107 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} |
| 106 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { delete this; } | 108 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { delete this; } |
| 107 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} | 109 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} |
| 108 virtual bool HasHitTestMask() const OVERRIDE { return true; } | 110 virtual bool HasHitTestMask() const OVERRIDE { |
| 111 return !proxy_ || proxy_->HasKeyboardWindow(); |
| 112 } |
| 109 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { | 113 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { |
| 114 if (proxy_ && !proxy_->HasKeyboardWindow()) |
| 115 return; |
| 110 gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() : | 116 gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() : |
| 111 keyboard::DefaultKeyboardBoundsFromWindowBounds(bounds_); | 117 keyboard::DefaultKeyboardBoundsFromWindowBounds(bounds_); |
| 112 mask->addRect(RectToSkRect(keyboard_bounds)); | 118 mask->addRect(RectToSkRect(keyboard_bounds)); |
| 113 } | 119 } |
| 114 | 120 |
| 115 gfx::Rect bounds_; | 121 gfx::Rect bounds_; |
| 116 keyboard::KeyboardControllerProxy* proxy_; | 122 keyboard::KeyboardControllerProxy* proxy_; |
| 117 | 123 |
| 118 DISALLOW_COPY_AND_ASSIGN(KeyboardWindowDelegate); | 124 DISALLOW_COPY_AND_ASSIGN(KeyboardWindowDelegate); |
| 119 }; | 125 }; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 // background during animation. | 472 // background during animation. |
| 467 NotifyKeyboardBoundsChanging(proxy_->GetKeyboardWindow()->bounds()); | 473 NotifyKeyboardBoundsChanging(proxy_->GetKeyboardWindow()->bounds()); |
| 468 proxy_->EnsureCaretInWorkArea(); | 474 proxy_->EnsureCaretInWorkArea(); |
| 469 } | 475 } |
| 470 | 476 |
| 471 void KeyboardController::HideAnimationFinished() { | 477 void KeyboardController::HideAnimationFinished() { |
| 472 proxy_->HideKeyboardContainer(container_.get()); | 478 proxy_->HideKeyboardContainer(container_.get()); |
| 473 } | 479 } |
| 474 | 480 |
| 475 } // namespace keyboard | 481 } // namespace keyboard |
| OLD | NEW |