diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 22:35:15 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 22:35:15 +0000 |
commit | 0b303cc493d3557b5a5e9e5c8dfc6bdc4953ee73 (patch) | |
tree | 807e7e57f0d329087bd1ba12baca7684f8553e5e /chrome/browser/tab_contents | |
parent | 12636df0dcf36c769c8a5940d6a0c0b6b6a6647c (diff) | |
download | chromium_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.cc | 17 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 3 |
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(); |