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

Unified Diff: chrome/browser/ui/browser.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, add tests 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/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 059efd26b506f7cdef195a44c7245636f0498256..607ee0043bbf542f1cf58518c102bc1d82fb60a9 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -133,6 +133,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
#include "chrome/browser/ui/unload_controller.h"
+#include "chrome/browser/ui/web_applications/hosted_app_tab_helper.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
@@ -523,13 +524,16 @@ bool Browser::is_devtools() const {
///////////////////////////////////////////////////////////////////////////////
// Browser, State Storage and Retrieval for UI:
-gfx::Image Browser::GetCurrentPageIcon() const {
+const gfx::Image* Browser::GetCurrentPageIcon(int dimension) const {
benwells 2013/11/13 21:55:17 Maybe this function can move off browser? It just
calamity 2013/11/15 04:25:50 Done.
WebContents* web_contents = 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).
- FaviconTabHelper* favicon_tab_helper =
- web_contents ? FaviconTabHelper::FromWebContents(web_contents) : NULL;
- return favicon_tab_helper ? favicon_tab_helper->GetFavicon() : gfx::Image();
+ HostedAppTabHelper* hosted_app_tab_helper =
+ web_contents ? HostedAppTabHelper::FromWebContents(web_contents)
+ : NULL;
+ return hosted_app_tab_helper
+ ? hosted_app_tab_helper->image_family().GetBest(dimension, dimension)
+ : NULL;
}
string16 Browser::GetWindowTitleForCurrentTab() const {
@@ -1741,6 +1745,14 @@ void Browser::URLStarredChanged(content::WebContents* web_contents,
}
///////////////////////////////////////////////////////////////////////////////
+// Browser, HostedAppTabHelperDelegate implementation:
+
+void Browser::OnWindowIconLoaded(content::WebContents* source) {
+ window_->UpdateLoadingAnimations(tab_strip_model_->TabsAreLoading());
+ window_->UpdateTitleBar();
+}
+
+///////////////////////////////////////////////////////////////////////////////
// Browser, ZoomObserver implementation:
void Browser::OnZoomChanged(content::WebContents* source,
@@ -2079,6 +2091,14 @@ void Browser::SetAsDelegate(WebContents* web_contents, Browser* delegate) {
TranslateTabHelper::FromWebContents(web_contents);
translate_tab_helper->language_state().set_observer(
delegate ? delegate->language_state_observer_.get() : NULL);
+#if defined(OS_WIN)
tapted 2013/11/13 07:44:53 If it's still needed, maybe move this #ifdef to Ho
benwells 2013/11/13 21:55:17 Yeah no ifdefs in here please. There is browser_wi
calamity 2013/11/15 04:25:50 Moved the #ifdef into HostedAppTabHelper::SetDeleg
+ if (is_app()) {
+ // We need the window icon for hosted apps running as a window on Windows.
+ HostedAppTabHelper::FromWebContents(web_contents)->
+ SetDelegate(delegate, true /* fetch_icons_immediately*/);
benwells 2013/11/13 21:55:17 Is it ever called with fetch_icons_immediately fal
calamity 2013/11/15 04:25:50 Nope. Moved the setting of this into HostedAppTabH
+ }
+#endif
+
}
void Browser::CloseFrame() {

Powered by Google App Engine
This is Rietveld 408576698