| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/view_manager/focus_controller.h" | 5 #include "components/mus/focus_controller.h" |
| 6 | 6 |
| 7 #include "components/view_manager/focus_controller_delegate.h" | 7 #include "components/mus/focus_controller_delegate.h" |
| 8 #include "components/view_manager/server_view.h" | 8 #include "components/mus/server_view.h" |
| 9 #include "components/view_manager/server_view_drawn_tracker.h" | 9 #include "components/mus/server_view_drawn_tracker.h" |
| 10 | 10 |
| 11 namespace view_manager { | 11 namespace view_manager { |
| 12 | 12 |
| 13 FocusController::FocusController(FocusControllerDelegate* delegate) | 13 FocusController::FocusController(FocusControllerDelegate* delegate) |
| 14 : delegate_(delegate) { | 14 : delegate_(delegate) {} |
| 15 } | |
| 16 | 15 |
| 17 FocusController::~FocusController() { | 16 FocusController::~FocusController() {} |
| 18 } | |
| 19 | 17 |
| 20 void FocusController::SetFocusedView(ServerView* view) { | 18 void FocusController::SetFocusedView(ServerView* view) { |
| 21 if (GetFocusedView() == view) | 19 if (GetFocusedView() == view) |
| 22 return; | 20 return; |
| 23 | 21 |
| 24 SetFocusedViewImpl(view, CHANGE_SOURCE_EXPLICIT); | 22 SetFocusedViewImpl(view, CHANGE_SOURCE_EXPLICIT); |
| 25 } | 23 } |
| 26 | 24 |
| 27 ServerView* FocusController::GetFocusedView() { | 25 ServerView* FocusController::GetFocusedView() { |
| 28 return drawn_tracker_ ? drawn_tracker_->view() : nullptr; | 26 return drawn_tracker_ ? drawn_tracker_->view() : nullptr; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 } | 42 } |
| 45 | 43 |
| 46 void FocusController::OnDrawnStateChanged(ServerView* ancestor, | 44 void FocusController::OnDrawnStateChanged(ServerView* ancestor, |
| 47 ServerView* view, | 45 ServerView* view, |
| 48 bool is_drawn) { | 46 bool is_drawn) { |
| 49 DCHECK(!is_drawn); // We only observe when drawn. | 47 DCHECK(!is_drawn); // We only observe when drawn. |
| 50 SetFocusedViewImpl(ancestor, CHANGE_SOURCE_DRAWN_STATE_CHANGED); | 48 SetFocusedViewImpl(ancestor, CHANGE_SOURCE_DRAWN_STATE_CHANGED); |
| 51 } | 49 } |
| 52 | 50 |
| 53 } // namespace view_manager | 51 } // namespace view_manager |
| OLD | NEW |