Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: views/focus/external_focus_tracker.cc

Issue 141013: Relanding focus manager refactoring (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/tree/tree_view.cc ('k') | views/focus/focus_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "views/view.h" 8 #include "views/view.h"
8 #include "views/focus/view_storage.h" 9 #include "views/focus/view_storage.h"
9 10
10 namespace views { 11 namespace views {
11 12
12 ExternalFocusTracker::ExternalFocusTracker(View* parent_view, 13 ExternalFocusTracker::ExternalFocusTracker(View* parent_view,
13 FocusManager* focus_manager) 14 FocusManager* focus_manager)
14 : focus_manager_(focus_manager), 15 : focus_manager_(focus_manager),
15 parent_view_(parent_view) { 16 parent_view_(parent_view) {
17 DCHECK(focus_manager);
18 DCHECK(parent_view);
16 view_storage_ = ViewStorage::GetSharedInstance(); 19 view_storage_ = ViewStorage::GetSharedInstance();
17 last_focused_view_storage_id_ = view_storage_->CreateStorageID(); 20 last_focused_view_storage_id_ = view_storage_->CreateStorageID();
18 // Store the view which is focused when we're created. 21 // Store the view which is focused when we're created.
19 StartTracking(); 22 StartTracking();
20 } 23 }
21 24
22 ExternalFocusTracker::~ExternalFocusTracker() { 25 ExternalFocusTracker::~ExternalFocusTracker() {
23 view_storage_->RemoveView(last_focused_view_storage_id_); 26 view_storage_->RemoveView(last_focused_view_storage_id_);
24 if (focus_manager_) 27 if (focus_manager_)
25 focus_manager_->RemoveFocusChangeListener(this); 28 focus_manager_->RemoveFocusChangeListener(this);
(...skipping 30 matching lines...) Expand all
56 if (view != NULL) 59 if (view != NULL)
57 view_storage_->StoreView(last_focused_view_storage_id_, view); 60 view_storage_->StoreView(last_focused_view_storage_id_, view);
58 } 61 }
59 62
60 void ExternalFocusTracker::StartTracking() { 63 void ExternalFocusTracker::StartTracking() {
61 StoreLastFocusedView(focus_manager_->GetFocusedView()); 64 StoreLastFocusedView(focus_manager_->GetFocusedView());
62 focus_manager_->AddFocusChangeListener(this); 65 focus_manager_->AddFocusChangeListener(this);
63 } 66 }
64 67
65 } // namespace views 68 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/tree/tree_view.cc ('k') | views/focus/focus_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698