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

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

Issue 146093: Relanding focus manager refactoring (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2006-2009 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 "views/focus/focus_manager.h"
6
7 #include "views/view.h"
8 #include "views/widget/widget_win.h"
9
10 namespace views {
11
12 void FocusManager::ClearNativeFocus() {
13 // Keep the top root window focused so we get keyboard events.
14 ::SetFocus(widget_->GetNativeView());
15 }
16
17 void FocusManager::FocusNativeView(gfx::NativeView native_view) {
18 // Only reset focus if hwnd is not already focused.
19 if (native_view && ::GetFocus() != native_view)
20 ::SetFocus(native_view);
21 }
22
23 // static
24 FocusManager* FocusManager::GetFocusManagerForNativeView(
25 gfx::NativeView native_view) {
26 HWND root = ::GetAncestor(native_view, GA_ROOT);
27 if (!root)
28 return NULL;
29 WidgetWin* widget = WidgetWin::GetWidget(root);
30 return widget ? widget->GetFocusManager() : NULL;
31 }
32
33 } // namespace views
34
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698