blob: a358fc8d3f92d5f0fe0ca9fe8761dcad4ce5b371 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/focus/focus_manager.h"
#include "views/view.h"
#include "views/widget/native_widget.h"
#include "views/widget/widget.h"
namespace views {
void FocusManager::ClearNativeFocus() {
// Keep the top root window focused so we get keyboard events.
::SetFocus(widget_->GetNativeView());
}
void FocusManager::FocusNativeView(gfx::NativeView native_view) {
// Only reset focus if hwnd is not already focused.
if (native_view && ::GetFocus() != native_view)
::SetFocus(native_view);
}
// static
FocusManager* FocusManager::GetFocusManagerForNativeView(
gfx::NativeView native_view) {
// TODO(beng): This method probably isn't necessary.
Widget* widget = Widget::GetTopLevelWidgetForNativeView(native_view);
return widget ? widget->GetFocusManager() : NULL;
}
// static
FocusManager* FocusManager::GetFocusManagerForNativeWindow(
gfx::NativeWindow native_window) {
return GetFocusManagerForNativeView(native_window);
}
} // namespace views
|