Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5017)

Unified Diff: chrome/browser/ui/gtk/browser_titlebar.cc

Issue 64853004: Use high resolution icons where possible for streamlined hosted app icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_experiment_create_app_from_page
Patch Set: rework Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_),

Powered by Google App Engine
This is Rietveld 408576698