OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/corewm/focus_controller.h" | 5 #include "ui/views/corewm/focus_controller.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "ui/aura/client/activation_change_observer.h" | 8 #include "ui/aura/client/activation_change_observer.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/capture_client.h" | 10 #include "ui/aura/client/capture_client.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return; | 172 return; |
173 if (!active_window_->Contains(window)) | 173 if (!active_window_->Contains(window)) |
174 return; | 174 return; |
175 SetFocusedWindow(window); | 175 SetFocusedWindow(window); |
176 } | 176 } |
177 | 177 |
178 aura::Window* FocusController::GetFocusedWindow() { | 178 aura::Window* FocusController::GetFocusedWindow() { |
179 return focused_window_; | 179 return focused_window_; |
180 } | 180 } |
181 | 181 |
182 void FocusController::OnWindowHiddenInRootWindow( | |
183 aura::Window* window, | |
184 aura::RootWindow* root_window, | |
185 bool destroyed) { | |
186 //NOTREACHED(); | |
187 // This method is only for compat with aura::FocusManager. It should not be | |
188 // needed in the new FocusController. | |
189 } | |
190 | |
191 //////////////////////////////////////////////////////////////////////////////// | 182 //////////////////////////////////////////////////////////////////////////////// |
192 // FocusController, ui::EventHandler implementation: | 183 // FocusController, ui::EventHandler implementation: |
193 void FocusController::OnKeyEvent(ui::KeyEvent* event) { | 184 void FocusController::OnKeyEvent(ui::KeyEvent* event) { |
194 } | 185 } |
195 | 186 |
196 void FocusController::OnMouseEvent(ui::MouseEvent* event) { | 187 void FocusController::OnMouseEvent(ui::MouseEvent* event) { |
197 if (event->type() == ui::ET_MOUSE_PRESSED) | 188 if (event->type() == ui::ET_MOUSE_PRESSED) |
198 WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target())); | 189 WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target())); |
199 } | 190 } |
200 | 191 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { | 343 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { |
353 // Only focus |window| if it or any of its parents can be focused. Otherwise | 344 // Only focus |window| if it or any of its parents can be focused. Otherwise |
354 // FocusWindow() will focus the topmost window, which may not be the | 345 // FocusWindow() will focus the topmost window, which may not be the |
355 // currently focused one. | 346 // currently focused one. |
356 if (rules_->CanFocusWindow(GetToplevelWindow(window))) | 347 if (rules_->CanFocusWindow(GetToplevelWindow(window))) |
357 FocusWindow(window); | 348 FocusWindow(window); |
358 } | 349 } |
359 | 350 |
360 } // namespace corewm | 351 } // namespace corewm |
361 } // namespace views | 352 } // namespace views |
OLD | NEW |