Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/media/window_icon_util.h" | |
| 6 | |
| 7 #include "ui/gfx/icon_util.h" | |
| 8 | |
| 9 gfx::ImageSkia WindowIconUtil::GetWindowIcon(content::DesktopMediaID id) { | |
| 10 HWND hwnd = reinterpret_cast<HWND>(id.id); | |
|
Sergey Ulanov
2016/08/18 05:38:18
DCHECK that the id.type is TYPE_WINDOW
qiangchen
2016/08/18 20:07:46
Done.
| |
| 11 | |
| 12 HICON icon_handle = | |
| 13 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_BIG, 0)); | |
| 14 if (icon_handle == nullptr) | |
|
Sergey Ulanov
2016/08/18 05:38:18
nit: "!icon_handle" instead of "icon_handle == nul
qiangchen
2016/08/18 20:07:46
Done.
| |
| 15 icon_handle = (HICON)GetClassLongPtr(hwnd, GCLP_HICON); | |
|
Sergey Ulanov
2016/08/18 05:38:18
Don't use c-style casts. In this case I think you
qiangchen
2016/08/18 20:07:46
Done.
| |
| 16 if (icon_handle == nullptr) | |
|
Sergey Ulanov
2016/08/18 05:38:18
add {} for multi-line if statement
https://google.
qiangchen
2016/08/18 20:07:46
Done.
| |
| 17 icon_handle = | |
| 18 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_SMALL, 0)); | |
| 19 if (icon_handle == nullptr) | |
| 20 icon_handle = | |
| 21 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_SMALL2, 0)); | |
| 22 if (icon_handle == nullptr) | |
| 23 icon_handle = (HICON)GetClassLongPtr(hwnd, GCLP_HICONSM); | |
|
Sergey Ulanov
2016/08/18 05:38:18
static_cast<>
qiangchen
2016/08/18 20:07:46
Done.
| |
| 24 | |
| 25 if (icon_handle == nullptr) | |
| 26 return gfx::ImageSkia(); | |
| 27 | |
| 28 std::unique_ptr<SkBitmap> icon_bitmap( | |
| 29 IconUtil::CreateSkBitmapFromHICON(icon_handle)); | |
| 30 | |
| 31 return gfx::ImageSkia::CreateFrom1xBitmap(*icon_bitmap); | |
| 32 } | |
| OLD | NEW |