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 <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "app/win/win_util.h" | |
10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
11 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.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/l10n/l10n_util_win.h" | 15 #include "ui/base/l10n/l10n_util_win.h" |
17 #include "ui/base/system_monitor/system_monitor.h" | 16 #include "ui/base/system_monitor/system_monitor.h" |
18 #include "ui/base/theme_provider.h" | 17 #include "ui/base/theme_provider.h" |
19 #include "ui/base/view_prop.h" | 18 #include "ui/base/view_prop.h" |
20 #include "ui/base/win/hwnd_util.h" | 19 #include "ui/base/win/hwnd_util.h" |
21 #include "views/accessibility/view_accessibility.h" | 20 #include "views/accessibility/view_accessibility.h" |
22 #include "views/controls/native_control_win.h" | 21 #include "views/controls/native_control_win.h" |
23 #include "views/focus/focus_util_win.h" | 22 #include "views/focus/focus_util_win.h" |
24 #include "views/views_delegate.h" | 23 #include "views/views_delegate.h" |
25 #include "views/widget/aero_tooltip_manager.h" | 24 #include "views/widget/aero_tooltip_manager.h" |
26 #include "views/widget/child_window_message_processor.h" | 25 #include "views/widget/child_window_message_processor.h" |
27 #include "views/widget/default_theme_provider.h" | 26 #include "views/widget/default_theme_provider.h" |
28 #include "views/widget/drop_target_win.h" | 27 #include "views/widget/drop_target_win.h" |
29 #include "views/widget/root_view.h" | 28 #include "views/widget/root_view.h" |
30 #include "views/widget/widget_delegate.h" | 29 #include "views/widget/widget_delegate.h" |
31 #include "views/widget/widget_utils.h" | 30 #include "views/widget/widget_utils.h" |
32 #include "views/window/window_win.h" | 31 #include "views/window/window_win.h" |
33 | 32 |
34 #pragma comment(lib, "dwmapi.lib") | 33 #pragma comment(lib, "dwmapi.lib") |
35 | 34 |
36 using ui::ViewProp; | 35 using ui::ViewProp; |
37 | 36 |
| 37 namespace { |
| 38 |
| 39 // Returns whether the specified window is the current active window. |
| 40 bool IsWindowActive(HWND hwnd) { |
| 41 WINDOWINFO info; |
| 42 return ::GetWindowInfo(hwnd, &info) && |
| 43 ((info.dwWindowStatus & WS_ACTIVECAPTION) != 0); |
| 44 } |
| 45 |
| 46 } // namespace |
| 47 |
38 namespace views { | 48 namespace views { |
39 | 49 |
40 // Property used to link the HWND to its RootView. | 50 // Property used to link the HWND to its RootView. |
41 static const char* const kRootViewWindowProperty = "__ROOT_VIEW__"; | 51 static const char* const kRootViewWindowProperty = "__ROOT_VIEW__"; |
42 | 52 |
43 // Links the HWND to it's Widget (as a Widget, not a WidgetWin). | 53 // Links the HWND to it's Widget (as a Widget, not a WidgetWin). |
44 static const char* const kWidgetKey = "__VIEWS_WIDGET__"; | 54 static const char* const kWidgetKey = "__VIEWS_WIDGET__"; |
45 | 55 |
46 bool WidgetWin::screen_reader_active_ = false; | 56 bool WidgetWin::screen_reader_active_ = false; |
47 | 57 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 410 |
401 Widget* WidgetWin::GetRootWidget() const { | 411 Widget* WidgetWin::GetRootWidget() const { |
402 return GetRootWidget(hwnd()); | 412 return GetRootWidget(hwnd()); |
403 } | 413 } |
404 | 414 |
405 bool WidgetWin::IsVisible() const { | 415 bool WidgetWin::IsVisible() const { |
406 return !!::IsWindowVisible(hwnd()); | 416 return !!::IsWindowVisible(hwnd()); |
407 } | 417 } |
408 | 418 |
409 bool WidgetWin::IsActive() const { | 419 bool WidgetWin::IsActive() const { |
410 return app::win::IsWindowActive(hwnd()); | 420 return IsWindowActive(hwnd()); |
411 } | 421 } |
412 | 422 |
413 bool WidgetWin::IsAccessibleWidget() const { | 423 bool WidgetWin::IsAccessibleWidget() const { |
414 return screen_reader_active_; | 424 return screen_reader_active_; |
415 } | 425 } |
416 | 426 |
417 TooltipManager* WidgetWin::GetTooltipManager() { | 427 TooltipManager* WidgetWin::GetTooltipManager() { |
418 return tooltip_manager_.get(); | 428 return tooltip_manager_.get(); |
419 } | 429 } |
420 | 430 |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1385 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1376 return Widget::GetWidgetFromNativeView(native_window); | 1386 return Widget::GetWidgetFromNativeView(native_window); |
1377 } | 1387 } |
1378 | 1388 |
1379 // static | 1389 // static |
1380 void Widget::NotifyLocaleChanged() { | 1390 void Widget::NotifyLocaleChanged() { |
1381 NOTIMPLEMENTED(); | 1391 NOTIMPLEMENTED(); |
1382 } | 1392 } |
1383 | 1393 |
1384 } // namespace views | 1394 } // namespace views |
OLD | NEW |