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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 options.wait = true; | 142 options.wait = true; |
143 base::LaunchProcess(command, options, NULL); | 143 base::LaunchProcess(command, options, NULL); |
144 #endif | 144 #endif |
145 } | 145 } |
146 | 146 |
147 aura::Window *GetFrameWindow(aura::Window *window) { | 147 aura::Window *GetFrameWindow(aura::Window *window) { |
148 // Each container window has a non-negative id. Stop traversing at the child | 148 // Each container window has a non-negative id. Stop traversing at the child |
149 // of a container window. | 149 // of a container window. |
150 if (!window) | 150 if (!window) |
151 return NULL; | 151 return NULL; |
152 while(window->parent() && window->parent()->id() < 0) { | 152 while (window->parent() && window->parent()->id() < 0) { |
153 window = window->parent(); | 153 window = window->parent(); |
154 } | 154 } |
155 return window; | 155 return window; |
156 } | 156 } |
157 | 157 |
158 } // namespace | 158 } // namespace |
159 | 159 |
160 namespace keyboard { | 160 namespace keyboard { |
161 | 161 |
162 // Observer for both keyboard show and hide animations. It should be owned by | 162 // Observer for both keyboard show and hide animations. It should be owned by |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 }; | 218 }; |
219 | 219 |
220 void WindowBoundsChangeObserver::OnWindowBoundsChanged(aura::Window* window, | 220 void WindowBoundsChangeObserver::OnWindowBoundsChanged(aura::Window* window, |
221 const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { | 221 const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { |
222 KeyboardController* controller = KeyboardController::GetInstance(); | 222 KeyboardController* controller = KeyboardController::GetInstance(); |
223 if (controller) | 223 if (controller) |
224 controller->UpdateWindowInsets(window); | 224 controller->UpdateWindowInsets(window); |
225 } | 225 } |
226 | 226 |
227 void WindowBoundsChangeObserver::OnWindowDestroyed(aura::Window* window) { | 227 void WindowBoundsChangeObserver::OnWindowDestroyed(aura::Window* window) { |
228 if (window->HasObserver(this)) | 228 if (window->HasObserver(this)) |
229 window->RemoveObserver(this); | 229 window->RemoveObserver(this); |
230 observed_windows_.erase(window); | 230 observed_windows_.erase(window); |
231 } | 231 } |
232 | 232 |
233 void WindowBoundsChangeObserver::AddObservedWindow(aura::Window* window) { | 233 void WindowBoundsChangeObserver::AddObservedWindow(aura::Window* window) { |
234 if (!window->HasObserver(this)) { | 234 if (!window->HasObserver(this)) { |
235 window->AddObserver(this); | 235 window->AddObserver(this); |
236 observed_windows_.insert(window); | 236 observed_windows_.insert(window); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 void WindowBoundsChangeObserver::RemoveAllObservedWindows() { | 240 void WindowBoundsChangeObserver::RemoveAllObservedWindows() { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 proxy_->HideKeyboardContainer(container_.get()); | 577 proxy_->HideKeyboardContainer(container_.get()); |
578 } | 578 } |
579 | 579 |
580 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 580 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
581 aura::Window* target_window = GetFrameWindow(window); | 581 aura::Window* target_window = GetFrameWindow(window); |
582 if (target_window) | 582 if (target_window) |
583 window_bounds_observer_->AddObservedWindow(target_window); | 583 window_bounds_observer_->AddObservedWindow(target_window); |
584 } | 584 } |
585 | 585 |
586 } // namespace keyboard | 586 } // namespace keyboard |
OLD | NEW |