| 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/win/win_util.h" | |
| 8 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 9 #include "gfx/canvas_skia.h" | 8 #include "gfx/canvas_skia.h" |
| 10 #include "gfx/native_theme_win.h" | 9 #include "gfx/native_theme_win.h" |
| 11 #include "gfx/path.h" | 10 #include "gfx/path.h" |
| 12 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 11 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 13 #include "ui/base/l10n/l10n_util_win.h" | 12 #include "ui/base/l10n/l10n_util_win.h" |
| 14 #include "ui/base/system_monitor/system_monitor.h" | 13 #include "ui/base/system_monitor/system_monitor.h" |
| 15 #include "ui/base/theme_provider.h" | 14 #include "ui/base/theme_provider.h" |
| 16 #include "ui/base/view_prop.h" | 15 #include "ui/base/view_prop.h" |
| 17 #include "ui/base/win/hwnd_util.h" | 16 #include "ui/base/win/hwnd_util.h" |
| 18 #include "views/accessibility/view_accessibility.h" | 17 #include "views/accessibility/view_accessibility.h" |
| 19 #include "views/controls/native_control_win.h" | 18 #include "views/controls/native_control_win.h" |
| 20 #include "views/focus/focus_util_win.h" | 19 #include "views/focus/focus_util_win.h" |
| 21 #include "views/views_delegate.h" | 20 #include "views/views_delegate.h" |
| 22 #include "views/widget/aero_tooltip_manager.h" | 21 #include "views/widget/aero_tooltip_manager.h" |
| 23 #include "views/widget/child_window_message_processor.h" | 22 #include "views/widget/child_window_message_processor.h" |
| 24 #include "views/widget/default_theme_provider.h" | 23 #include "views/widget/default_theme_provider.h" |
| 25 #include "views/widget/drop_target_win.h" | 24 #include "views/widget/drop_target_win.h" |
| 26 #include "views/widget/root_view.h" | 25 #include "views/widget/root_view.h" |
| 27 #include "views/widget/widget_delegate.h" | 26 #include "views/widget/widget_delegate.h" |
| 28 #include "views/widget/widget_utils.h" | 27 #include "views/widget/widget_utils.h" |
| 29 #include "views/window/window_win.h" | 28 #include "views/window/window_win.h" |
| 30 | 29 |
| 31 using ui::ViewProp; | 30 using ui::ViewProp; |
| 32 | 31 |
| 32 namespace { |
| 33 |
| 34 // Returns whether the specified window is the current active window. |
| 35 bool IsWindowActive(HWND hwnd) { |
| 36 WINDOWINFO info; |
| 37 return ::GetWindowInfo(hwnd, &info) && |
| 38 ((info.dwWindowStatus & WS_ACTIVECAPTION) != 0); |
| 39 } |
| 40 |
| 41 } // namespace |
| 42 |
| 33 namespace views { | 43 namespace views { |
| 34 | 44 |
| 35 // Property used to link the HWND to its RootView. | 45 // Property used to link the HWND to its RootView. |
| 36 static const char* const kRootViewWindowProperty = "__ROOT_VIEW__"; | 46 static const char* const kRootViewWindowProperty = "__ROOT_VIEW__"; |
| 37 | 47 |
| 38 // Links the HWND to it's Widget (as a Widget, not a WidgetWin). | 48 // Links the HWND to it's Widget (as a Widget, not a WidgetWin). |
| 39 static const char* const kWidgetKey = "__VIEWS_WIDGET__"; | 49 static const char* const kWidgetKey = "__VIEWS_WIDGET__"; |
| 40 | 50 |
| 41 bool WidgetWin::screen_reader_active_ = false; | 51 bool WidgetWin::screen_reader_active_ = false; |
| 42 | 52 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 396 |
| 387 Widget* WidgetWin::GetRootWidget() const { | 397 Widget* WidgetWin::GetRootWidget() const { |
| 388 return GetRootWidget(hwnd()); | 398 return GetRootWidget(hwnd()); |
| 389 } | 399 } |
| 390 | 400 |
| 391 bool WidgetWin::IsVisible() const { | 401 bool WidgetWin::IsVisible() const { |
| 392 return !!::IsWindowVisible(hwnd()); | 402 return !!::IsWindowVisible(hwnd()); |
| 393 } | 403 } |
| 394 | 404 |
| 395 bool WidgetWin::IsActive() const { | 405 bool WidgetWin::IsActive() const { |
| 396 return app::win::IsWindowActive(hwnd()); | 406 return IsWindowActive(hwnd()); |
| 397 } | 407 } |
| 398 | 408 |
| 399 bool WidgetWin::IsAccessibleWidget() const { | 409 bool WidgetWin::IsAccessibleWidget() const { |
| 400 return screen_reader_active_; | 410 return screen_reader_active_; |
| 401 } | 411 } |
| 402 | 412 |
| 403 TooltipManager* WidgetWin::GetTooltipManager() { | 413 TooltipManager* WidgetWin::GetTooltipManager() { |
| 404 return tooltip_manager_.get(); | 414 return tooltip_manager_.get(); |
| 405 } | 415 } |
| 406 | 416 |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1371 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
| 1362 return Widget::GetWidgetFromNativeView(native_window); | 1372 return Widget::GetWidgetFromNativeView(native_window); |
| 1363 } | 1373 } |
| 1364 | 1374 |
| 1365 // static | 1375 // static |
| 1366 void Widget::NotifyLocaleChanged() { | 1376 void Widget::NotifyLocaleChanged() { |
| 1367 NOTIMPLEMENTED(); | 1377 NOTIMPLEMENTED(); |
| 1368 } | 1378 } |
| 1369 | 1379 |
| 1370 } // namespace views | 1380 } // namespace views |
| OLD | NEW |