| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/system_monitor/system_monitor.h" | 14 #include "base/system_monitor/system_monitor.h" |
| 15 #include "base/win/scoped_gdi_object.h" | 15 #include "base/win/scoped_gdi_object.h" |
| 16 #include "base/win/win_util.h" | 16 #include "base/win/win_util.h" |
| 17 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
| 18 #include "ui/base/dragdrop/drag_drop_types.h" | 18 #include "ui/base/dragdrop/drag_drop_types.h" |
| 19 #include "ui/base/dragdrop/drag_source.h" | 19 #include "ui/base/dragdrop/drag_source.h" |
| 20 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
| 21 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 21 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 22 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 22 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 23 #include "ui/base/l10n/l10n_util_win.h" | 23 #include "ui/base/l10n/l10n_util_win.h" |
| 24 #include "ui/base/native_theme/native_theme_win.h" |
| 24 #include "ui/base/theme_provider.h" | 25 #include "ui/base/theme_provider.h" |
| 25 #include "ui/base/view_prop.h" | 26 #include "ui/base/view_prop.h" |
| 26 #include "ui/base/win/hwnd_util.h" | 27 #include "ui/base/win/hwnd_util.h" |
| 27 #include "ui/base/win/mouse_wheel_util.h" | 28 #include "ui/base/win/mouse_wheel_util.h" |
| 28 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
| 29 #include "ui/gfx/canvas_paint.h" | 30 #include "ui/gfx/canvas_paint.h" |
| 30 #include "ui/gfx/canvas_skia_paint.h" | 31 #include "ui/gfx/canvas_skia_paint.h" |
| 31 #include "ui/gfx/icon_util.h" | 32 #include "ui/gfx/icon_util.h" |
| 32 #include "ui/base/native_theme/native_theme_win.h" | |
| 33 #include "ui/gfx/path.h" | 33 #include "ui/gfx/path.h" |
| 34 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
| 35 #include "ui/views/accessibility/native_view_accessibility_win.h" | 35 #include "ui/views/accessibility/native_view_accessibility_win.h" |
| 36 #include "ui/views/controls/native_control_win.h" | 36 #include "ui/views/controls/native_control_win.h" |
| 37 #include "ui/views/controls/textfield/native_textfield_views.h" | 37 #include "ui/views/controls/textfield/native_textfield_views.h" |
| 38 #include "ui/views/drag_utils.h" | 38 #include "ui/views/drag_utils.h" |
| 39 #include "ui/views/focus/accelerator_handler.h" | 39 #include "ui/views/focus/accelerator_handler.h" |
| 40 #include "ui/views/focus/view_storage.h" | 40 #include "ui/views/focus/view_storage.h" |
| 41 #include "ui/views/focus/widget_focus_manager.h" | 41 #include "ui/views/focus/widget_focus_manager.h" |
| 42 #include "ui/views/ime/input_method_win.h" | 42 #include "ui/views/ime/input_method_win.h" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 else | 712 else |
| 713 *show_state = ui::SHOW_STATE_NORMAL; | 713 *show_state = ui::SHOW_STATE_NORMAL; |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 | 716 |
| 717 void NativeWidgetWin::SetWindowTitle(const string16& title) { | 717 void NativeWidgetWin::SetWindowTitle(const string16& title) { |
| 718 SetWindowText(GetNativeView(), title.c_str()); | 718 SetWindowText(GetNativeView(), title.c_str()); |
| 719 SetAccessibleName(title); | 719 SetAccessibleName(title); |
| 720 } | 720 } |
| 721 | 721 |
| 722 void NativeWidgetWin::SetWindowIcons(const SkBitmap& window_icon, | 722 void NativeWidgetWin::SetWindowIcons(const gfx::ImageSkia& window_icon, |
| 723 const SkBitmap& app_icon) { | 723 const gfx::ImageSkia& app_icon) { |
| 724 if (!window_icon.isNull()) { | 724 if (!window_icon.isNull()) { |
| 725 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(window_icon); | 725 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(window_icon); |
| 726 // We need to make sure to destroy the previous icon, otherwise we'll leak | 726 // We need to make sure to destroy the previous icon, otherwise we'll leak |
| 727 // these GDI objects until we crash! | 727 // these GDI objects until we crash! |
| 728 HICON old_icon = reinterpret_cast<HICON>( | 728 HICON old_icon = reinterpret_cast<HICON>( |
| 729 SendMessage(GetNativeView(), WM_SETICON, ICON_SMALL, | 729 SendMessage(GetNativeView(), WM_SETICON, ICON_SMALL, |
| 730 reinterpret_cast<LPARAM>(windows_icon))); | 730 reinterpret_cast<LPARAM>(windows_icon))); |
| 731 if (old_icon) | 731 if (old_icon) |
| 732 DestroyIcon(old_icon); | 732 DestroyIcon(old_icon); |
| 733 } | 733 } |
| (...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2719 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2719 return (GetKeyState(VK_LBUTTON) & 0x80) || |
| 2720 (GetKeyState(VK_RBUTTON) & 0x80) || | 2720 (GetKeyState(VK_RBUTTON) & 0x80) || |
| 2721 (GetKeyState(VK_MBUTTON) & 0x80) || | 2721 (GetKeyState(VK_MBUTTON) & 0x80) || |
| 2722 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2722 (GetKeyState(VK_XBUTTON1) & 0x80) || |
| 2723 (GetKeyState(VK_XBUTTON2) & 0x80); | 2723 (GetKeyState(VK_XBUTTON2) & 0x80); |
| 2724 } | 2724 } |
| 2725 | 2725 |
| 2726 } // namespace internal | 2726 } // namespace internal |
| 2727 | 2727 |
| 2728 } // namespace views | 2728 } // namespace views |
| OLD | NEW |