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 base::win::ScopedHICON previous_icon = window_icon_.Pass(); |
812 *window_icon.bitmap()); | 812 window_icon_.Set(IconUtil::CreateHICONFromSkBitmap(*window_icon.bitmap())); |
813 // We need to make sure to destroy the previous icon, otherwise we'll leak | 813 SendMessage(hwnd(), WM_SETICON, ICON_SMALL, |
814 // these GDI objects until we crash! | 814 reinterpret_cast<LPARAM>(window_icon_.Get())); |
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 } | 815 } |
821 if (!app_icon.isNull()) { | 816 if (!app_icon.isNull()) { |
822 HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(*app_icon.bitmap()); | 817 base::win::ScopedHICON previous_icon = app_icon_.Pass(); |
823 HICON old_icon = reinterpret_cast<HICON>( | 818 app_icon_.Set(IconUtil::CreateHICONFromSkBitmap(*app_icon.bitmap())); |
824 SendMessage(hwnd(), WM_SETICON, ICON_BIG, | 819 SendMessage(hwnd(), WM_SETICON, ICON_BIG, |
825 reinterpret_cast<LPARAM>(windows_icon))); | 820 reinterpret_cast<LPARAM>(app_icon_.Get())); |
826 if (old_icon) | |
827 DestroyIcon(old_icon); | |
828 } | 821 } |
829 } | 822 } |
830 | 823 |
831 void HWNDMessageHandler::SetFullscreen(bool fullscreen) { | 824 void HWNDMessageHandler::SetFullscreen(bool fullscreen) { |
832 fullscreen_handler()->SetFullscreen(fullscreen); | 825 fullscreen_handler()->SetFullscreen(fullscreen); |
833 // If we are out of fullscreen and there was a pending DWM transition for the | 826 // If we are out of fullscreen and there was a pending DWM transition for the |
834 // window, then go ahead and do it now. | 827 // window, then go ahead and do it now. |
835 if (!fullscreen && dwm_transition_desired_) | 828 if (!fullscreen && dwm_transition_desired_) |
836 PerformDwmTransition(); | 829 PerformDwmTransition(); |
837 } | 830 } |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 2453 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
2461 0, | 2454 0, |
2462 0, | 2455 0, |
2463 event_time, | 2456 event_time, |
2464 1); | 2457 1); |
2465 | 2458 |
2466 touch_events->push_back(event); | 2459 touch_events->push_back(event); |
2467 } | 2460 } |
2468 | 2461 |
2469 } // namespace views | 2462 } // namespace views |
OLD | NEW |