Chromium Code Reviews| Index: chrome/browser/ui/gtk/browser_titlebar.cc |
| diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc |
| index 1bea5c143a4823f10a39913e0711c34a929b339d..018bb3c06fb5e5d2b68fd7b1a1958b0e6d61bc0d 100644 |
| --- a/chrome/browser/ui/gtk/browser_titlebar.cc |
| +++ b/chrome/browser/ui/gtk/browser_titlebar.cc |
| @@ -44,6 +44,7 @@ |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| +#include "chrome/browser/ui/web_applications/hosted_app_tab_helper.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| #include "content/public/browser/notification_service.h" |
| @@ -614,11 +615,19 @@ void BrowserTitlebar::UpdateTitleAndIcon() { |
| // top left of the custom frame, that will get updated when the |
| // throbber is updated. |
| Profile* profile = browser_window_->browser()->profile(); |
| - gfx::Image icon = browser_window_->browser()->GetCurrentPageIcon(); |
| - if (icon.IsEmpty()) { |
| + WebContents* web_contents = browser_window_->browser()-> |
|
tapted
2013/11/17 23:28:50
This is a lot of boilerplate, that's repeated belo
|
| + tab_strip_model()->GetActiveWebContents(); |
| + HostedAppTabHelper* hosted_app_tab_helper = |
| + web_contents ? HostedAppTabHelper::FromWebContents(web_contents) |
| + : NULL; |
| + const gfx::Image* icon = hosted_app_tab_helper |
| + ? hosted_app_tab_helper->image_family().GetBest( |
| + IconUtil::kMediumIconSize, IconUtil::kMediumIconSize) |
| + : NULL; |
| + if (!icon || icon->IsEmpty()) { |
| gtk_util::SetWindowIcon(window_, profile); |
| } else { |
| - gtk_util::SetWindowIcon(window_, profile, icon.ToGdkPixbuf()); |
| + gtk_util::SetWindowIcon(window_, profile, icon->ToGdkPixbuf()); |
| } |
| break; |
| } |
| @@ -644,14 +653,22 @@ void BrowserTitlebar::UpdateThrobber(WebContents* web_contents) { |
| if ((browser_window_->browser()->is_app() && |
| !browser_window_->browser()->is_type_tabbed()) || |
| browser_window_->browser()->is_type_popup()) { |
| - gfx::Image icon = browser_window_->browser()->GetCurrentPageIcon(); |
| - if (icon.IsEmpty()) { |
| + WebContents* web_contents = browser_window_->browser()-> |
| + tab_strip_model()->GetActiveWebContents(); |
| + HostedAppTabHelper* hosted_app_tab_helper = |
| + web_contents ? HostedAppTabHelper::FromWebContents(web_contents) |
| + : NULL; |
| + const gfx::Image* icon = hosted_app_tab_helper |
| + ? hosted_app_tab_helper->image_family().GetBest( |
| + IconUtil::kMediumIconSize, IconUtil::kMediumIconSize) |
| + : NULL; |
| + if (!icon || icon->IsEmpty()) { |
| // Fallback to the Chromium icon if the page has no icon. |
| gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), |
| rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_16).ToGdkPixbuf()); |
| } else { |
| gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), |
| - icon.ToGdkPixbuf()); |
| + icon->ToGdkPixbuf()); |
| } |
| } else { |
| gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), |