| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/focus/external_focus_tracker.h" | 5 #include "views/focus/external_focus_tracker.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "views/view.h" | 8 #include "views/view.h" | 
| 9 #include "views/focus/view_storage.h" | 9 #include "views/focus/view_storage.h" | 
| 10 | 10 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 23 } | 23 } | 
| 24 | 24 | 
| 25 ExternalFocusTracker::~ExternalFocusTracker() { | 25 ExternalFocusTracker::~ExternalFocusTracker() { | 
| 26   view_storage_->RemoveView(last_focused_view_storage_id_); | 26   view_storage_->RemoveView(last_focused_view_storage_id_); | 
| 27   if (focus_manager_) | 27   if (focus_manager_) | 
| 28     focus_manager_->RemoveFocusChangeListener(this); | 28     focus_manager_->RemoveFocusChangeListener(this); | 
| 29 } | 29 } | 
| 30 | 30 | 
| 31 void ExternalFocusTracker::FocusWillChange(View* focused_before, | 31 void ExternalFocusTracker::FocusWillChange(View* focused_before, | 
| 32                                            View* focused_now) { | 32                                            View* focused_now) { | 
| 33   if (focused_now && !parent_view_->IsParentOf(focused_now) && | 33   if (focused_now && !parent_view_->Contains(focused_now) && | 
| 34       parent_view_ != focused_now) { | 34       parent_view_ != focused_now) { | 
| 35     // Store the newly focused view. | 35     // Store the newly focused view. | 
| 36     StoreLastFocusedView(focused_now); | 36     StoreLastFocusedView(focused_now); | 
| 37   } | 37   } | 
| 38 } | 38 } | 
| 39 | 39 | 
| 40 void ExternalFocusTracker::FocusLastFocusedExternalView() { | 40 void ExternalFocusTracker::FocusLastFocusedExternalView() { | 
| 41   View* last_focused_view = | 41   View* last_focused_view = | 
| 42       view_storage_->RetrieveView(last_focused_view_storage_id_); | 42       view_storage_->RetrieveView(last_focused_view_storage_id_); | 
| 43   if (last_focused_view) | 43   if (last_focused_view) | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 59   if (view != NULL) | 59   if (view != NULL) | 
| 60     view_storage_->StoreView(last_focused_view_storage_id_, view); | 60     view_storage_->StoreView(last_focused_view_storage_id_, view); | 
| 61 } | 61 } | 
| 62 | 62 | 
| 63 void ExternalFocusTracker::StartTracking() { | 63 void ExternalFocusTracker::StartTracking() { | 
| 64   StoreLastFocusedView(focus_manager_->GetFocusedView()); | 64   StoreLastFocusedView(focus_manager_->GetFocusedView()); | 
| 65   focus_manager_->AddFocusChangeListener(this); | 65   focus_manager_->AddFocusChangeListener(this); | 
| 66 } | 66 } | 
| 67 | 67 | 
| 68 }  // namespace views | 68 }  // namespace views | 
| OLD | NEW | 
|---|