Index: chrome/browser/media/window_icon_util_chromeos.cc |
diff --git a/chrome/browser/media/window_icon_util_chromeos.cc b/chrome/browser/media/window_icon_util_chromeos.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9a2da7fb3b8e2ce2fa2e73dd062f0e3f95c0a9af |
--- /dev/null |
+++ b/chrome/browser/media/window_icon_util_chromeos.cc |
@@ -0,0 +1,30 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/media/window_icon_util.h" |
+ |
+#include "content/public/browser/desktop_media_id.h" |
+#include "grit/theme_resources.h" |
+#include "ui/aura/client/aura_constants.h" |
+#include "ui/aura/window.h" |
+#include "ui/base/resource/resource_bundle.h" |
+ |
+gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) { |
+ DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW); |
+ aura::Window* window = content::DesktopMediaID::GetAuraWindowById(id); |
+ const gfx::ImageSkia* icon_image_ptr = nullptr; |
+ if (window) |
+ icon_image_ptr = window->GetProperty(aura::client::kWindowIconKey); |
+ |
+ if (icon_image_ptr) |
+ return *icon_image_ptr; |
+ |
+ // 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.
|
+ // host, and thus not registered in aura::Window. |
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
+ icon_image_ptr = rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia(); |
+ if (icon_image_ptr) |
+ return *icon_image_ptr; |
+ return gfx::ImageSkia(); |
+} |