- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / native_focus_tracker_views.cc
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/native_focus_tracker_views.h"
6
7 NativeFocusTrackerViews::NativeFocusTrackerViews(NativeFocusTrackerHost* host)
8     : host_(host) {
9   views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this);
10 }
11
12 NativeFocusTrackerViews::~NativeFocusTrackerViews() {
13   views::WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(this);
14 }
15
16 void NativeFocusTrackerViews::OnNativeFocusChange(
17     gfx::NativeView focused_before,
18     gfx::NativeView focused_now) {
19   host_->SetBrowser(GetBrowserForNativeView(focused_now));
20 }
21
22 // static
23 NativeFocusTracker* NativeFocusTracker::Create(NativeFocusTrackerHost* host) {
24   return new NativeFocusTrackerViews(host);
25 }