OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/widget/widget_win.h" | 5 #include "views/widget/widget_win.h" |
6 | 6 |
7 #include "app/keyboard_code_conversion_win.h" | 7 #include "app/keyboard_code_conversion_win.h" |
8 #include "app/l10n_util_win.h" | 8 #include "app/l10n_util_win.h" |
9 #include "app/system_monitor.h" | 9 #include "app/system_monitor.h" |
10 #include "app/view_prop.h" | 10 #include "app/view_prop.h" |
| 11 #include "app/win/hwnd_util.h" |
11 #include "app/win_util.h" | 12 #include "app/win_util.h" |
12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
13 #include "base/win_util.h" | |
14 #include "gfx/canvas_skia.h" | 14 #include "gfx/canvas_skia.h" |
15 #include "gfx/native_theme_win.h" | 15 #include "gfx/native_theme_win.h" |
16 #include "gfx/path.h" | 16 #include "gfx/path.h" |
17 #include "views/accessibility/view_accessibility.h" | 17 #include "views/accessibility/view_accessibility.h" |
18 #include "views/controls/native_control_win.h" | 18 #include "views/controls/native_control_win.h" |
19 #include "views/focus/focus_util_win.h" | 19 #include "views/focus/focus_util_win.h" |
20 #include "views/views_delegate.h" | 20 #include "views/views_delegate.h" |
21 #include "views/widget/aero_tooltip_manager.h" | 21 #include "views/widget/aero_tooltip_manager.h" |
22 #include "views/widget/child_window_message_processor.h" | 22 #include "views/widget/child_window_message_processor.h" |
23 #include "views/widget/default_theme_provider.h" | 23 #include "views/widget/default_theme_provider.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 WidgetWin::~WidgetWin() { | 71 WidgetWin::~WidgetWin() { |
72 } | 72 } |
73 | 73 |
74 // static | 74 // static |
75 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { | 75 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { |
76 // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is | 76 // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is |
77 // associated with a WidgetWin (it might be a pure | 77 // associated with a WidgetWin (it might be a pure |
78 // WindowImpl). | 78 // WindowImpl). |
79 if (!WindowImpl::IsWindowImpl(hwnd)) | 79 if (!WindowImpl::IsWindowImpl(hwnd)) |
80 return NULL; | 80 return NULL; |
81 return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); | 81 return reinterpret_cast<WidgetWin*>(app::win::GetWindowUserData(hwnd)); |
82 } | 82 } |
83 | 83 |
84 // static | 84 // static |
85 WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) { | 85 WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) { |
86 // First, check if the top-level window is a Widget. | 86 // First, check if the top-level window is a Widget. |
87 HWND root = ::GetAncestor(hwnd, GA_ROOT); | 87 HWND root = ::GetAncestor(hwnd, GA_ROOT); |
88 if (!root) | 88 if (!root) |
89 return NULL; | 89 return NULL; |
90 | 90 |
91 WidgetWin* widget = WidgetWin::GetWidget(root); | 91 WidgetWin* widget = WidgetWin::GetWidget(root); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 /////////////////////////////////////////////////////////////////////////////// | 1098 /////////////////////////////////////////////////////////////////////////////// |
1099 // WidgetWin, private: | 1099 // WidgetWin, private: |
1100 | 1100 |
1101 // static | 1101 // static |
1102 Window* WidgetWin::GetWindowImpl(HWND hwnd) { | 1102 Window* WidgetWin::GetWindowImpl(HWND hwnd) { |
1103 // NOTE: we can't use GetAncestor here as constrained windows are a Window, | 1103 // NOTE: we can't use GetAncestor here as constrained windows are a Window, |
1104 // but not a top level window. | 1104 // but not a top level window. |
1105 HWND parent = hwnd; | 1105 HWND parent = hwnd; |
1106 while (parent) { | 1106 while (parent) { |
1107 WidgetWin* widget = | 1107 WidgetWin* widget = |
1108 reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(parent)); | 1108 reinterpret_cast<WidgetWin*>(app::win::GetWindowUserData(parent)); |
1109 if (widget && widget->is_window_) | 1109 if (widget && widget->is_window_) |
1110 return static_cast<WindowWin*>(widget); | 1110 return static_cast<WindowWin*>(widget); |
1111 parent = ::GetParent(parent); | 1111 parent = ::GetParent(parent); |
1112 } | 1112 } |
1113 return NULL; | 1113 return NULL; |
1114 } | 1114 } |
1115 | 1115 |
1116 void WidgetWin::SizeContents(const gfx::Size& window_size) { | 1116 void WidgetWin::SizeContents(const gfx::Size& window_size) { |
1117 contents_.reset(new gfx::CanvasSkia(window_size.width(), | 1117 contents_.reset(new gfx::CanvasSkia(window_size.width(), |
1118 window_size.height(), | 1118 window_size.height(), |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1355 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1356 return Widget::GetWidgetFromNativeView(native_window); | 1356 return Widget::GetWidgetFromNativeView(native_window); |
1357 } | 1357 } |
1358 | 1358 |
1359 // static | 1359 // static |
1360 void Widget::NotifyLocaleChanged() { | 1360 void Widget::NotifyLocaleChanged() { |
1361 NOTIMPLEMENTED(); | 1361 NOTIMPLEMENTED(); |
1362 } | 1362 } |
1363 | 1363 |
1364 } // namespace views | 1364 } // namespace views |
OLD | NEW |