summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 22:35:15 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 22:35:15 +0000
commit0b303cc493d3557b5a5e9e5c8dfc6bdc4953ee73 (patch)
tree807e7e57f0d329087bd1ba12baca7684f8553e5e /chrome/browser/tab_contents
parent12636df0dcf36c769c8a5940d6a0c0b6b6a6647c (diff)
downloadchromium_src-0b303cc493d3557b5a5e9e5c8dfc6bdc4953ee73.zip
chromium_src-0b303cc493d3557b5a5e9e5c8dfc6bdc4953ee73.tar.gz
chromium_src-0b303cc493d3557b5a5e9e5c8dfc6bdc4953ee73.tar.bz2
Use favicon for application shortcut icon.
BUG=22528 Review URL: http://codereview.chromium.org/249023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27422 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc17
-rw-r--r--chrome/browser/tab_contents/tab_contents.h3
2 files changed, 19 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 4dd83dc..73a1fa6 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -534,6 +534,18 @@ SkBitmap TabContents::GetFavIcon() const {
return SkBitmap();
}
+bool TabContents::FavIconIsValid() const {
+ NavigationEntry* entry = controller_.GetTransientEntry();
+ if (entry)
+ return entry->favicon().is_valid();
+
+ entry = controller_.GetLastCommittedEntry();
+ if (entry)
+ return entry->favicon().is_valid();
+
+ return false;
+}
+
bool TabContents::ShouldDisplayFavIcon() {
// Always display a throbber during pending loads.
if (controller_.GetLastCommittedEntry() && controller_.pending_entry())
@@ -766,8 +778,11 @@ void TabContents::CreateShortcut() {
return;
#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
+ SkBitmap bitmap;
+ if (FavIconIsValid())
+ bitmap = GetFavIcon();
CreateApplicationShortcutsDialogGtk::Show(view()->GetTopLevelNativeWindow(),
- GetURL(), GetTitle());
+ GetURL(), GetTitle(), bitmap);
#else
// We only allow one pending install request. By resetting the page id we
// effectively cancel the pending install request.
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 26d69f5..87aeb76 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -221,6 +221,9 @@ class TabContents : public PageNavigator,
// entry.
SkBitmap GetFavIcon() const;
+ // Returns true if we are not using the default favicon.
+ bool FavIconIsValid() const;
+
// Returns whether the favicon should be displayed. If this returns false, no
// space is provided for the favicon, and the favicon is never displayed.
virtual bool ShouldDisplayFavIcon();