| 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/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 | 10 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 if (!custom_window_region_ && !delegate_->IsUsingCustomFrame()) | 801 if (!custom_window_region_ && !delegate_->IsUsingCustomFrame()) |
| 802 dwm_transition_desired_ = true; | 802 dwm_transition_desired_ = true; |
| 803 if (!dwm_transition_desired_ || !fullscreen_handler_->fullscreen()) | 803 if (!dwm_transition_desired_ || !fullscreen_handler_->fullscreen()) |
| 804 PerformDwmTransition(); | 804 PerformDwmTransition(); |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 | 807 |
| 808 void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon, | 808 void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon, |
| 809 const gfx::ImageSkia& app_icon) { | 809 const gfx::ImageSkia& app_icon) { |
| 810 if (!window_icon.isNull()) { | 810 if (!window_icon.isNull()) { |
| 811 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap( | 811 window_icon_.Set(IconUtil::CreateHICONFromSkBitmap(*window_icon.bitmap())); |
| 812 *window_icon.bitmap()); | 812 SendMessage(hwnd(), WM_SETICON, ICON_SMALL, |
| 813 // We need to make sure to destroy the previous icon, otherwise we'll leak | 813 reinterpret_cast<LPARAM>(window_icon_.Get())); |
| 814 // these GDI objects until we crash! | |
| 815 HICON old_icon = reinterpret_cast<HICON>( | |
| 816 SendMessage(hwnd(), WM_SETICON, ICON_SMALL, | |
| 817 reinterpret_cast<LPARAM>(windows_icon))); | |
| 818 if (old_icon) | |
| 819 DestroyIcon(old_icon); | |
| 820 } | 814 } |
| 821 if (!app_icon.isNull()) { | 815 if (!app_icon.isNull()) { |
| 822 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(*app_icon.bitmap()); | 816 app_icon_.Set(IconUtil::CreateHICONFromSkBitmap(*app_icon.bitmap())); |
| 823 HICON old_icon = reinterpret_cast<HICON>( | 817 SendMessage(hwnd(), WM_SETICON, ICON_BIG, |
| 824 SendMessage(hwnd(), WM_SETICON, ICON_BIG, | 818 reinterpret_cast<LPARAM>(app_icon_.Get())); |
| 825 reinterpret_cast<LPARAM>(windows_icon))); | |
| 826 if (old_icon) | |
| 827 DestroyIcon(old_icon); | |
| 828 } | 819 } |
| 829 } | 820 } |
| 830 | 821 |
| 831 void HWNDMessageHandler::SetFullscreen(bool fullscreen) { | 822 void HWNDMessageHandler::SetFullscreen(bool fullscreen) { |
| 832 fullscreen_handler()->SetFullscreen(fullscreen); | 823 fullscreen_handler()->SetFullscreen(fullscreen); |
| 833 // If we are out of fullscreen and there was a pending DWM transition for the | 824 // If we are out of fullscreen and there was a pending DWM transition for the |
| 834 // window, then go ahead and do it now. | 825 // window, then go ahead and do it now. |
| 835 if (!fullscreen && dwm_transition_desired_) | 826 if (!fullscreen && dwm_transition_desired_) |
| 836 PerformDwmTransition(); | 827 PerformDwmTransition(); |
| 837 } | 828 } |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 2451 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 2461 0, | 2452 0, |
| 2462 0, | 2453 0, |
| 2463 event_time, | 2454 event_time, |
| 2464 1); | 2455 1); |
| 2465 | 2456 |
| 2466 touch_events->push_back(event); | 2457 touch_events->push_back(event); |
| 2467 } | 2458 } |
| 2468 | 2459 |
| 2469 } // namespace views | 2460 } // namespace views |
| OLD | NEW |