Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: chrome/browser/media/window_icon_util_win.cc

Issue 2246923002: Icon Capture Utility For Linux, Windows and Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 class WindowIconUtilWin : public WindowIconUtil {
10 public:
11 WindowIconUtilWin() {}
12 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) override;
13 };
14
15 gfx::ImageSkia WindowIconUtilWin::GetWindowIcon(content::DesktopMediaID id) {
16 HWND hwnd = reinterpret_cast<HWND>(id.id);
17
18 HICON icon_handle =
19 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_BIG, 0));
20 if (icon_handle == NULL)
Sergey Ulanov 2016/08/15 22:28:39 use nullptr instead of NULL.
qiangchen 2016/08/16 22:29:52 Done.
21 icon_handle = (HICON)GetClassLongPtr(hwnd, GCLP_HICON);
22 if (icon_handle == NULL)
23 icon_handle =
24 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_SMALL, 0));
25 if (icon_handle == NULL)
26 icon_handle =
27 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_SMALL2, 0));
28 if (icon_handle == NULL)
29 icon_handle = (HICON)GetClassLongPtr(hwnd, GCLP_HICONSM);
30
31 if (icon_handle == NULL)
32 return gfx::ImageSkia();
33
34 std::unique_ptr<SkBitmap> icon_bitmap(
35 IconUtil::CreateSkBitmapFromHICON(icon_handle));
36
37 return gfx::ImageSkia::CreateFrom1xBitmap(*icon_bitmap);
38 }
39
40 std::unique_ptr<WindowIconUtil> WindowIconUtil::Create(
41 const webrtc::DesktopCaptureOptions& options) {
42 return std::unique_ptr<WindowIconUtil>(new WindowIconUtilWin());
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698