OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/media/window_icon_util.h" | 5 #include "chrome/browser/media/webrtc/window_icon_util.h" |
6 | 6 |
7 #include "ui/gfx/icon_util.h" | 7 #include "ui/gfx/icon_util.h" |
8 | 8 |
9 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) { | 9 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) { |
10 DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW); | 10 DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW); |
11 | 11 |
12 HWND hwnd = reinterpret_cast<HWND>(id.id); | 12 HWND hwnd = reinterpret_cast<HWND>(id.id); |
13 | 13 |
14 HICON icon_handle = | 14 HICON icon_handle = |
15 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_BIG, 0)); | 15 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_BIG, 0)); |
(...skipping 15 matching lines...) Expand all Loading... |
31 icon_handle = reinterpret_cast<HICON>(GetClassLongPtr(hwnd, GCLP_HICONSM)); | 31 icon_handle = reinterpret_cast<HICON>(GetClassLongPtr(hwnd, GCLP_HICONSM)); |
32 | 32 |
33 if (!icon_handle) | 33 if (!icon_handle) |
34 return gfx::ImageSkia(); | 34 return gfx::ImageSkia(); |
35 | 35 |
36 std::unique_ptr<SkBitmap> icon_bitmap( | 36 std::unique_ptr<SkBitmap> icon_bitmap( |
37 IconUtil::CreateSkBitmapFromHICON(icon_handle)); | 37 IconUtil::CreateSkBitmapFromHICON(icon_handle)); |
38 | 38 |
39 return gfx::ImageSkia::CreateFrom1xBitmap(*icon_bitmap); | 39 return gfx::ImageSkia::CreateFrom1xBitmap(*icon_bitmap); |
40 } | 40 } |
OLD | NEW |