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

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

Issue 2307083002: Cleanup: move WebRTC related files from chrome/browser/media to chrome/browser/media/webrtc/ (Closed)
Patch Set: Removed file wrongly resuscitated during rebase Created 4 years, 3 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 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
10 DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW);
11
12 HWND hwnd = reinterpret_cast<HWND>(id.id);
13
14 HICON icon_handle =
15 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_BIG, 0));
16
17 if (!icon_handle)
18 icon_handle = reinterpret_cast<HICON>(GetClassLongPtr(hwnd, GCLP_HICON));
19
20 if (!icon_handle) {
21 icon_handle =
22 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_SMALL, 0));
23 }
24
25 if (!icon_handle) {
26 icon_handle =
27 reinterpret_cast<HICON>(SendMessage(hwnd, WM_GETICON, ICON_SMALL2, 0));
28 }
29
30 if (!icon_handle)
31 icon_handle = reinterpret_cast<HICON>(GetClassLongPtr(hwnd, GCLP_HICONSM));
32
33 if (!icon_handle)
34 return gfx::ImageSkia();
35
36 std::unique_ptr<SkBitmap> icon_bitmap(
37 IconUtil::CreateSkBitmapFromHICON(icon_handle));
38
39 return gfx::ImageSkia::CreateFrom1xBitmap(*icon_bitmap);
40 }
OLDNEW
« no previous file with comments | « chrome/browser/media/window_icon_util_mac.mm ('k') | chrome/browser/media/window_icon_util_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698