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/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/system_monitor.h" | 8 #include "app/system_monitor.h" |
9 #include "app/win_util.h" | 9 #include "app/win_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 is_window_(false), | 58 is_window_(false), |
59 restore_focus_when_enabled_(false), | 59 restore_focus_when_enabled_(false), |
60 delegate_(NULL) { | 60 delegate_(NULL) { |
61 } | 61 } |
62 | 62 |
63 WidgetWin::~WidgetWin() { | 63 WidgetWin::~WidgetWin() { |
64 } | 64 } |
65 | 65 |
66 // static | 66 // static |
67 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { | 67 WidgetWin* WidgetWin::GetWidget(HWND hwnd) { |
| 68 // TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is |
| 69 // associated with a WidgetWin (it might be a pure |
| 70 // WindowImpl). |
| 71 if (!WindowImpl::IsWindowImpl(hwnd)) |
| 72 return NULL; |
68 return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); | 73 return reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(hwnd)); |
69 } | 74 } |
70 | 75 |
71 // static | 76 // static |
72 WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) { | 77 WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) { |
73 // First, check if the top-level window is a Widget. | 78 // First, check if the top-level window is a Widget. |
74 HWND root = ::GetAncestor(hwnd, GA_ROOT); | 79 HWND root = ::GetAncestor(hwnd, GA_ROOT); |
75 if (!root) | 80 if (!root) |
76 return NULL; | 81 return NULL; |
77 | 82 |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1337 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1333 return Widget::GetWidgetFromNativeView(native_window); | 1338 return Widget::GetWidgetFromNativeView(native_window); |
1334 } | 1339 } |
1335 | 1340 |
1336 // static | 1341 // static |
1337 void Widget::NotifyLocaleChanged() { | 1342 void Widget::NotifyLocaleChanged() { |
1338 NOTIMPLEMENTED(); | 1343 NOTIMPLEMENTED(); |
1339 } | 1344 } |
1340 | 1345 |
1341 } // namespace views | 1346 } // namespace views |
OLD | NEW |