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 "ui/aura/layout_manager.h" | 8 #include "ui/aura/layout_manager.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/aura/window_delegate.h" | 10 #include "ui/aura/window_delegate.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 container_(NULL), | 125 container_(NULL), |
126 input_method_(NULL), | 126 input_method_(NULL), |
127 keyboard_visible_(false), | 127 keyboard_visible_(false), |
128 weak_factory_(this) { | 128 weak_factory_(this) { |
129 CHECK(proxy); | 129 CHECK(proxy); |
130 input_method_ = proxy_->GetInputMethod(); | 130 input_method_ = proxy_->GetInputMethod(); |
131 input_method_->AddObserver(this); | 131 input_method_->AddObserver(this); |
132 } | 132 } |
133 | 133 |
134 KeyboardController::~KeyboardController() { | 134 KeyboardController::~KeyboardController() { |
135 if (container_) | 135 if (container_) { |
136 container_->RemoveObserver(this); | 136 container_->RemoveObserver(this); |
137 container_->SetLayoutManager(NULL); | |
sadrul
2013/09/27 20:25:16
The container window takes ownership of the layout
| |
138 } | |
137 if (input_method_) | 139 if (input_method_) |
138 input_method_->RemoveObserver(this); | 140 input_method_->RemoveObserver(this); |
139 } | 141 } |
140 | 142 |
141 aura::Window* KeyboardController::GetContainerWindow() { | 143 aura::Window* KeyboardController::GetContainerWindow() { |
142 if (!container_) { | 144 if (!container_) { |
143 container_ = new aura::Window(new KeyboardWindowDelegate()); | 145 container_ = new aura::Window(new KeyboardWindowDelegate()); |
144 container_->SetName("KeyboardContainer"); | 146 container_->SetName("KeyboardContainer"); |
145 container_->Init(ui::LAYER_NOT_DRAWN); | 147 container_->Init(ui::LAYER_NOT_DRAWN); |
146 container_->AddObserver(this); | 148 container_->AddObserver(this); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 const ui::InputMethod* input_method) { | 235 const ui::InputMethod* input_method) { |
234 DCHECK_EQ(input_method_, input_method); | 236 DCHECK_EQ(input_method_, input_method); |
235 input_method_ = NULL; | 237 input_method_ = NULL; |
236 } | 238 } |
237 | 239 |
238 bool KeyboardController::WillHideKeyboard() const { | 240 bool KeyboardController::WillHideKeyboard() const { |
239 return weak_factory_.HasWeakPtrs(); | 241 return weak_factory_.HasWeakPtrs(); |
240 } | 242 } |
241 | 243 |
242 } // namespace keyboard | 244 } // namespace keyboard |
OLD | NEW |