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/webrtc/window_icon_util.h"
6 
7 #include "content/public/browser/desktop_media_id.h"
8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/window.h"
10 
GetWindowIcon(content::DesktopMediaID id)11 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
12   DCHECK_EQ(content::DesktopMediaID::TYPE_WINDOW, id.type);
13   aura::Window* window = content::DesktopMediaID::GetNativeWindowById(id);
14   if (!window)
15     return gfx::ImageSkia();
16 
17   gfx::ImageSkia* image = window->GetProperty(aura::client::kWindowIconKey);
18   if (!image)
19     image = window->GetProperty(aura::client::kAppIconKey);
20   return image ? *image : gfx::ImageSkia();
21 }
22