| 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/widget/widget_win.h" | 5 #include "views/widget/widget_win.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_win.h" | 7 #include "app/l10n_util_win.h" |
| 8 #include "app/view_prop.h" | 8 #include "app/view_prop.h" |
| 9 #include "app/win/hwnd_util.h" | |
| 10 #include "app/win/win_util.h" | 9 #include "app/win/win_util.h" |
| 11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 12 #include "gfx/canvas_skia.h" | 11 #include "gfx/canvas_skia.h" |
| 13 #include "gfx/native_theme_win.h" | 12 #include "gfx/native_theme_win.h" |
| 14 #include "gfx/path.h" | 13 #include "gfx/path.h" |
| 15 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 14 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 16 #include "ui/base/system_monitor/system_monitor.h" | 15 #include "ui/base/system_monitor/system_monitor.h" |
| 16 #include "ui/base/win/hwnd_util.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" |
| 24 #include "views/widget/drop_target_win.h" | 24 #include "views/widget/drop_target_win.h" |
| 25 #include "views/widget/root_view.h" | 25 #include "views/widget/root_view.h" |
| 26 #include "views/widget/widget_delegate.h" | 26 #include "views/widget/widget_delegate.h" |
| (...skipping 44 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*>(app::win::GetWindowUserData(hwnd)); | 81 return reinterpret_cast<WidgetWin*>(ui::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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 /////////////////////////////////////////////////////////////////////////////// | 1103 /////////////////////////////////////////////////////////////////////////////// |
| 1104 // WidgetWin, private: | 1104 // WidgetWin, private: |
| 1105 | 1105 |
| 1106 // static | 1106 // static |
| 1107 Window* WidgetWin::GetWindowImpl(HWND hwnd) { | 1107 Window* WidgetWin::GetWindowImpl(HWND hwnd) { |
| 1108 // NOTE: we can't use GetAncestor here as constrained windows are a Window, | 1108 // NOTE: we can't use GetAncestor here as constrained windows are a Window, |
| 1109 // but not a top level window. | 1109 // but not a top level window. |
| 1110 HWND parent = hwnd; | 1110 HWND parent = hwnd; |
| 1111 while (parent) { | 1111 while (parent) { |
| 1112 WidgetWin* widget = | 1112 WidgetWin* widget = |
| 1113 reinterpret_cast<WidgetWin*>(app::win::GetWindowUserData(parent)); | 1113 reinterpret_cast<WidgetWin*>(ui::GetWindowUserData(parent)); |
| 1114 if (widget && widget->is_window_) | 1114 if (widget && widget->is_window_) |
| 1115 return static_cast<WindowWin*>(widget); | 1115 return static_cast<WindowWin*>(widget); |
| 1116 parent = ::GetParent(parent); | 1116 parent = ::GetParent(parent); |
| 1117 } | 1117 } |
| 1118 return NULL; | 1118 return NULL; |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 void WidgetWin::SizeContents(const gfx::Size& window_size) { | 1121 void WidgetWin::SizeContents(const gfx::Size& window_size) { |
| 1122 contents_.reset(new gfx::CanvasSkia(window_size.width(), | 1122 contents_.reset(new gfx::CanvasSkia(window_size.width(), |
| 1123 window_size.height(), | 1123 window_size.height(), |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1360 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
| 1361 return Widget::GetWidgetFromNativeView(native_window); | 1361 return Widget::GetWidgetFromNativeView(native_window); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 // static | 1364 // static |
| 1365 void Widget::NotifyLocaleChanged() { | 1365 void Widget::NotifyLocaleChanged() { |
| 1366 NOTIMPLEMENTED(); | 1366 NOTIMPLEMENTED(); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 } // namespace views | 1369 } // namespace views |
| OLD | NEW |