OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/view.h" | 5 #include "views/view.h" |
6 | 6 |
7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
8 #include "app/gfx/canvas.h" | 8 #include "app/gfx/canvas.h" |
9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "views/accessibility/view_accessibility_wrapper.h" | 11 #include "views/accessibility/view_accessibility_wrapper.h" |
12 #include "views/border.h" | 12 #include "views/border.h" |
13 #include "views/widget/root_view.h" | 13 #include "views/widget/root_view.h" |
14 #include "views/widget/widget.h" | 14 #include "views/widget/widget.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 | 17 |
18 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { | 18 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { |
19 if (accessibility_.get() == NULL) { | 19 if (accessibility_.get() == NULL) { |
20 accessibility_.reset(new ViewAccessibilityWrapper(this)); | 20 accessibility_.reset(new ViewAccessibilityWrapper(this)); |
21 } | 21 } |
22 return accessibility_.get(); | 22 return accessibility_.get(); |
23 } | 23 } |
24 | 24 |
25 void View::Focus() { | |
26 // Set the native focus to the root view window so it receives the keyboard | |
27 // messages. | |
28 FocusManager* focus_manager = GetFocusManager(); | |
29 if (focus_manager) | |
30 focus_manager->FocusNativeView(GetRootView()->GetWidget()->GetNativeView()); | |
31 } | |
32 | |
33 int View::GetHorizontalDragThreshold() { | 25 int View::GetHorizontalDragThreshold() { |
34 static int threshold = -1; | 26 static int threshold = -1; |
35 if (threshold == -1) | 27 if (threshold == -1) |
36 threshold = GetSystemMetrics(SM_CXDRAG) / 2; | 28 threshold = GetSystemMetrics(SM_CXDRAG) / 2; |
37 return threshold; | 29 return threshold; |
38 } | 30 } |
39 | 31 |
40 int View::GetVerticalDragThreshold() { | 32 int View::GetVerticalDragThreshold() { |
41 static int threshold = -1; | 33 static int threshold = -1; |
42 if (threshold == -1) | 34 if (threshold == -1) |
43 threshold = GetSystemMetrics(SM_CYDRAG) / 2; | 35 threshold = GetSystemMetrics(SM_CYDRAG) / 2; |
44 return threshold; | 36 return threshold; |
45 } | 37 } |
46 | 38 |
47 } // namespace views | 39 } // namespace views |
OLD | NEW |