| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "aura/focus_manager.h" | 5 #include "ui/aura/focus_manager.h" |
| 6 | 6 |
| 7 #include "aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "aura/window_delegate.h" | 8 #include "ui/aura/window_delegate.h" |
| 9 | 9 |
| 10 namespace aura { | 10 namespace aura { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 FocusManager::FocusManager(Window* owner) | 13 FocusManager::FocusManager(Window* owner) |
| 14 : owner_(owner), | 14 : owner_(owner), |
| 15 focused_window_(NULL) { | 15 focused_window_(NULL) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 FocusManager::~FocusManager() { | 18 FocusManager::~FocusManager() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void FocusManager::SetFocusedWindow(Window* focused_window) { | 21 void FocusManager::SetFocusedWindow(Window* focused_window) { |
| 22 if (focused_window == focused_window_) | 22 if (focused_window == focused_window_) |
| 23 return; | 23 return; |
| 24 if (focused_window_) | 24 if (focused_window_) |
| 25 focused_window_->delegate()->OnBlur(); | 25 focused_window_->delegate()->OnBlur(); |
| 26 focused_window_ = focused_window; | 26 focused_window_ = focused_window; |
| 27 if (focused_window_) | 27 if (focused_window_) |
| 28 focused_window_->delegate()->OnFocus(); | 28 focused_window_->delegate()->OnFocus(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace internal | 31 } // namespace internal |
| 32 } // namespace aura | 32 } // namespace aura |
| OLD | NEW |