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 "content/public/browser/desktop_media_id.h" | |
8 #include "grit/theme_resources.h" | |
9 #include "ui/aura/client/aura_constants.h" | |
10 #include "ui/aura/window.h" | |
11 #include "ui/base/resource/resource_bundle.h" | |
12 | |
13 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) { | |
14 DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW); | |
15 aura::Window* window = content::DesktopMediaID::GetAuraWindowById(id); | |
16 const gfx::ImageSkia* icon_image_ptr = nullptr; | |
17 if (window) | |
18 icon_image_ptr = window->GetProperty(aura::client::kWindowIconKey); | |
19 | |
20 if (icon_image_ptr) | |
21 return *icon_image_ptr; | |
22 | |
23 // The default icon (for chrome window itself) does not enter window tree | |
msw
2016/08/24 17:01:28
Can you clarify this comment? The current phrasing
qiangchen
2016/08/24 18:03:30
Done.
| |
24 // host, and thus not registered in aura::Window. | |
25 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
26 icon_image_ptr = rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia(); | |
27 if (icon_image_ptr) | |
28 return *icon_image_ptr; | |
29 return gfx::ImageSkia(); | |
30 } | |
OLD | NEW |