OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 #include "views/widget/tooltip_manager.h" | 34 #include "views/widget/tooltip_manager.h" |
35 #include "views/widget/widget.h" | 35 #include "views/widget/widget.h" |
36 | 36 |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 #include "base/win/scoped_gdi_object.h" | 38 #include "base/win/scoped_gdi_object.h" |
39 #include "views/accessibility/native_view_accessibility_win.h" | 39 #include "views/accessibility/native_view_accessibility_win.h" |
40 #endif | 40 #endif |
41 #if defined(TOOLKIT_USES_GTK) | 41 #if defined(TOOLKIT_USES_GTK) |
42 #include "ui/base/gtk/scoped_handle_gtk.h" | 42 #include "ui/base/gtk/scoped_handle_gtk.h" |
43 #endif | 43 #endif |
44 #if defined(USE_AURA) | |
45 #include "ui/aura/focus_manager.h" | |
Ben Goodger (Google)
2011/10/26 19:06:04
you won't need these items after you do the item i
mazda
2011/10/27 13:05:05
Done.
| |
46 #include "ui/aura/window.h" | |
47 #endif | |
44 | 48 |
45 namespace { | 49 namespace { |
46 | 50 |
47 // Whether to use accelerated compositing when necessary (e.g. when a view has a | 51 // Whether to use accelerated compositing when necessary (e.g. when a view has a |
48 // transformation). | 52 // transformation). |
49 #if defined(VIEWS_COMPOSITOR) | 53 #if defined(VIEWS_COMPOSITOR) |
50 bool use_acceleration_when_possible = true; | 54 bool use_acceleration_when_possible = true; |
51 #else | 55 #else |
52 bool use_acceleration_when_possible = false; | 56 bool use_acceleration_when_possible = false; |
53 #endif | 57 #endif |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1219 | 1223 |
1220 void View::OnFocus() { | 1224 void View::OnFocus() { |
1221 // TODO(beng): Investigate whether it's possible for us to move this to | 1225 // TODO(beng): Investigate whether it's possible for us to move this to |
1222 // Focus(). | 1226 // Focus(). |
1223 // By default, we clear the native focus. This ensures that no visible native | 1227 // By default, we clear the native focus. This ensures that no visible native |
1224 // view as the focus and that we still receive keyboard inputs. | 1228 // view as the focus and that we still receive keyboard inputs. |
1225 FocusManager* focus_manager = GetFocusManager(); | 1229 FocusManager* focus_manager = GetFocusManager(); |
1226 if (focus_manager) | 1230 if (focus_manager) |
1227 focus_manager->ClearNativeFocus(); | 1231 focus_manager->ClearNativeFocus(); |
1228 | 1232 |
1233 #if defined(USE_AURA) | |
1234 aura::Window* window = GetWidget()->GetNativeWindow(); | |
Ben Goodger (Google)
2011/10/26 19:06:04
This should be done by implementing NativeWidgetAu
mazda
2011/10/27 13:05:05
Done.
| |
1235 window->GetFocusManager()->SetFocusedWindow(window); | |
1236 #endif | |
1237 | |
1229 // TODO(beng): Investigate whether it's possible for us to move this to | 1238 // TODO(beng): Investigate whether it's possible for us to move this to |
1230 // Focus(). | 1239 // Focus(). |
1231 // Notify assistive technologies of the focus change. | 1240 // Notify assistive technologies of the focus change. |
1232 GetWidget()->NotifyAccessibilityEvent( | 1241 GetWidget()->NotifyAccessibilityEvent( |
1233 this, ui::AccessibilityTypes::EVENT_FOCUS, true); | 1242 this, ui::AccessibilityTypes::EVENT_FOCUS, true); |
1234 } | 1243 } |
1235 | 1244 |
1236 void View::OnBlur() { | 1245 void View::OnBlur() { |
1237 } | 1246 } |
1238 | 1247 |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2075 | 2084 |
2076 OSExchangeData data; | 2085 OSExchangeData data; |
2077 WriteDragData(press_pt, &data); | 2086 WriteDragData(press_pt, &data); |
2078 | 2087 |
2079 // Message the RootView to do the drag and drop. That way if we're removed | 2088 // Message the RootView to do the drag and drop. That way if we're removed |
2080 // the RootView can detect it and avoid calling us back. | 2089 // the RootView can detect it and avoid calling us back. |
2081 GetWidget()->RunShellDrag(this, data, drag_operations); | 2090 GetWidget()->RunShellDrag(this, data, drag_operations); |
2082 } | 2091 } |
2083 | 2092 |
2084 } // namespace views | 2093 } // namespace views |
OLD | NEW |