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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 keyboard_visible_(false), | 204 keyboard_visible_(false), |
205 show_on_resize_(false), | 205 show_on_resize_(false), |
206 lock_keyboard_(false), | 206 lock_keyboard_(false), |
207 keyboard_mode_(FULL_WIDTH), | 207 keyboard_mode_(FULL_WIDTH), |
208 type_(ui::TEXT_INPUT_TYPE_NONE), | 208 type_(ui::TEXT_INPUT_TYPE_NONE), |
209 weak_factory_(this) { | 209 weak_factory_(this) { |
210 CHECK(proxy); | 210 CHECK(proxy); |
211 input_method_ = proxy_->GetInputMethod(); | 211 input_method_ = proxy_->GetInputMethod(); |
212 input_method_->AddObserver(this); | 212 input_method_->AddObserver(this); |
213 window_bounds_observer_.reset(new WindowBoundsChangeObserver()); | 213 window_bounds_observer_.reset(new WindowBoundsChangeObserver()); |
| 214 proxy_->SetController(this); |
214 } | 215 } |
215 | 216 |
216 KeyboardController::~KeyboardController() { | 217 KeyboardController::~KeyboardController() { |
217 if (container_) { | 218 if (container_) { |
218 if (container_->GetRootWindow()) | 219 if (container_->GetRootWindow()) |
219 container_->GetRootWindow()->RemoveObserver(this); | 220 container_->GetRootWindow()->RemoveObserver(this); |
220 container_->RemoveObserver(this); | 221 container_->RemoveObserver(this); |
221 } | 222 } |
222 if (input_method_) | 223 if (input_method_) |
223 input_method_->RemoveObserver(this); | 224 input_method_->RemoveObserver(this); |
224 ResetWindowInsets(); | 225 ResetWindowInsets(); |
| 226 proxy_->SetController(nullptr); |
225 } | 227 } |
226 | 228 |
227 // static | 229 // static |
228 void KeyboardController::ResetInstance(KeyboardController* controller) { | 230 void KeyboardController::ResetInstance(KeyboardController* controller) { |
229 if (instance_ && instance_ != controller) | 231 if (instance_ && instance_ != controller) |
230 delete instance_; | 232 delete instance_; |
231 instance_ = controller; | 233 instance_ = controller; |
232 } | 234 } |
233 | 235 |
234 // static | 236 // static |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 proxy_->HideKeyboardContainer(container_.get()); | 587 proxy_->HideKeyboardContainer(container_.get()); |
586 } | 588 } |
587 | 589 |
588 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 590 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
589 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; | 591 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; |
590 if (target_window) | 592 if (target_window) |
591 window_bounds_observer_->AddObservedWindow(target_window); | 593 window_bounds_observer_->AddObservedWindow(target_window); |
592 } | 594 } |
593 | 595 |
594 } // namespace keyboard | 596 } // namespace keyboard |
OLD | NEW |