Index: chrome/browser/ui/views/frame/browser_view.cc |
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc |
index 7464350424c0c602287a17df265d5d057eb576ee..b0e079467394896ee520b1ed954556bf2a18ed8f 100644 |
--- a/chrome/browser/ui/views/frame/browser_view.cc |
+++ b/chrome/browser/ui/views/frame/browser_view.cc |
@@ -87,6 +87,7 @@ |
#include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
#include "chrome/browser/ui/views/update_recommended_message_box.h" |
#include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h" |
+#include "chrome/browser/ui/web_applications/hosted_app_tab_helper.h" |
#include "chrome/browser/ui/window_sizer/window_sizer.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
@@ -116,6 +117,7 @@ |
#include "ui/events/event_utils.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/color_utils.h" |
+#include "ui/gfx/icon_util.h" |
#include "ui/gfx/sys_color_change_listener.h" |
#include "ui/views/controls/button/menu_button.h" |
#include "ui/views/controls/single_split_view.h" |
@@ -1574,8 +1576,23 @@ gfx::ImageSkia BrowserView::GetWindowAppIcon() { |
} |
gfx::ImageSkia BrowserView::GetWindowIcon() { |
- if (browser_->is_app() || browser_->is_type_popup()) |
- return browser_->GetCurrentPageIcon().AsImageSkia(); |
+ if (browser_->is_app() || browser_->is_type_popup()) { |
+ WebContents* web_contents = |
+ browser_->tab_strip_model()->GetActiveWebContents(); |
+ // |web_contents| can be NULL since GetCurrentPageIcon() is called by the |
+ // window during the window's creation (before tabs have been added). |
+ HostedAppTabHelper* hosted_app_tab_helper = |
+ web_contents ? HostedAppTabHelper::FromWebContents(web_contents) |
+ : NULL; |
+ // Use IconUtil::kMediumIconSize as it is the size used for the Alt+Tab |
+ // icon. |
+ const gfx::Image* icon = hosted_app_tab_helper |
+ ? hosted_app_tab_helper->image_family().GetBest( |
+ IconUtil::kMediumIconSize, IconUtil::kMediumIconSize) |
+ : NULL; |
+ |
+ return icon ? icon->AsImageSkia() : gfx::ImageSkia(); |
+ } |
return gfx::ImageSkia(); |
} |