diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 14:17:59 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 14:17:59 +0000 |
commit | 74e51408fd3361b11d3e981cab925a6ed960c905 (patch) | |
tree | 207f46b92ac628f1b50fea7ebf34b17febb66cf5 | |
parent | aff6cda58f0574ccd44342d644d890beef2ac24f (diff) | |
download | chromium_src-74e51408fd3361b11d3e981cab925a6ed960c905.zip chromium_src-74e51408fd3361b11d3e981cab925a6ed960c905.tar.gz chromium_src-74e51408fd3361b11d3e981cab925a6ed960c905.tar.bz2 |
Last of the app icons.
Move the non-extension app icon code to extension_tab_helper, merge with extension app code.
BUG=71097
TEST=no visible change
Review URL: http://codereview.chromium.org/6792059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80622 0039d316-1c4b-4281-b951-d872f2087c98
10 files changed, 23 insertions, 23 deletions
diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index ad22905..6f44f6c 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -148,6 +148,11 @@ void ExtensionTabHelper::UpdateExtensionAppIcon(const Extension* extension) { } } +void ExtensionTabHelper::SetAppIcon(const SkBitmap& app_icon) { + extension_app_icon_ = app_icon; + tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); +} + void ExtensionTabHelper::OnImageLoaded(SkBitmap* image, const ExtensionResource& resource, int index) { diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h index 790f0ac..46b0348 100644 --- a/chrome/browser/extensions/extension_tab_helper.h +++ b/chrome/browser/extensions/extension_tab_helper.h @@ -15,7 +15,7 @@ class Extension; class TabContentsWrapper; struct WebApplicationInfo; -// Per-tab extension helper. +// Per-tab extension helper. Also handles non-extension apps. class ExtensionTabHelper : public TabContentsObserver, public ImageLoadingTracker::Observer { public: @@ -66,6 +66,10 @@ class ExtensionTabHelper : public TabContentsObserver, return TabContentsObserver::tab_contents(); } + // Sets a non-extension app icon associated with TabContents and fires an + // INVALIDATE_TITLE navigation state change to trigger repaint of title. + void SetAppIcon(const SkBitmap& app_icon); + private: // TabContentsObserver overrides. virtual void DidNavigateMainFramePostCommit( @@ -93,7 +97,8 @@ class ExtensionTabHelper : public TabContentsObserver, // created for. const Extension* extension_app_; - // Icon for extension_app_ (if non-null). + // Icon for extension_app_ (if non-null) or a manually-set icon for + // non-extension apps. SkBitmap extension_app_icon_; // Used for loading extension_app_icon_. diff --git a/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm b/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm index 4338cc3..74778a0 100644 --- a/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_html_delegate_mac.mm @@ -4,13 +4,15 @@ #include "chrome/browser/ui/webui/constrained_html_ui.h" +#import <Cocoa/Cocoa.h> + #include "base/memory/scoped_nsobject.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/cocoa/constrained_window_mac.h" #include "chrome/browser/ui/webui/html_dialog_ui.h" #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents.h" -#import <Cocoa/Cocoa.h> +#include "ui/gfx/size.h" class ConstrainedHtmlDelegateMac : public ConstrainedWindowMacDelegateCustomSheet, diff --git a/chrome/browser/ui/login/login_prompt_ui.cc b/chrome/browser/ui/login/login_prompt_ui.cc index 318fcbf..d1d9592 100644 --- a/chrome/browser/ui/login/login_prompt_ui.cc +++ b/chrome/browser/ui/login/login_prompt_ui.cc @@ -20,6 +20,7 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/size.h" class LoginHandlerSource : public ChromeURLDataManager::DataSource { public: diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 43c057d..2692552 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -436,7 +436,7 @@ bool CreateUrlApplicationShortcutView::Accept() { if (!CreateApplicationShortcutView::Accept()) return false; - tab_contents_->tab_contents()->SetAppIcon(shortcut_info_.favicon); + tab_contents_->extension_tab_helper()->SetAppIcon(shortcut_info_.favicon); if (tab_contents_->tab_contents()->delegate()) { tab_contents_->tab_contents()->delegate()->ConvertContentsToApplication( tab_contents_->tab_contents()); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 237b91a..d3e4797 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -22,6 +22,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/download/download_manager.h" +#include "chrome/browser/extensions/extension_tab_helper.h" #include "chrome/browser/extensions/extension_tts_api.h" #include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/metrics/user_metrics.h" @@ -1407,9 +1408,9 @@ bool BrowserView::ShouldShowWindowTitle() const { SkBitmap BrowserView::GetWindowAppIcon() { if (browser_->type() & Browser::TYPE_APP) { - TabContents* contents = browser_->GetSelectedTabContents(); - if (contents && !contents->app_icon().isNull()) - return contents->app_icon(); + TabContentsWrapper* contents = browser_->GetSelectedTabContentsWrapper(); + if (contents && contents->extension_tab_helper()->GetExtensionAppIcon()) + return *contents->extension_tab_helper()->GetExtensionAppIcon(); } return GetWindowIcon(); diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index f776fa3..cbd2c74 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -153,7 +153,7 @@ void UpdateShortcutWorker::OnIconDownloaded(int download_id, if (!errored && !image.isNull()) { // Update icon with download image and update shortcut. shortcut_info_.favicon = image; - tab_contents_->tab_contents()->SetAppIcon(image); + tab_contents_->extension_tab_helper()->SetAppIcon(image); UpdateShortcuts(); } else { // Try the next icon otherwise. diff --git a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc index b2063fc..8b41fb3 100644 --- a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc +++ b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc @@ -20,6 +20,7 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/size.h" namespace { diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index d0ff14b..5ae27de 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -2513,11 +2513,6 @@ void TabContents::set_encoding(const std::string& encoding) { encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); } -void TabContents::SetAppIcon(const SkBitmap& app_icon) { - app_icon_ = app_icon; - NotifyNavigationStateChanged(INVALIDATE_TITLE); -} - void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { render_manager_.SwapInRenderViewHost(rvh); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 1ef7c86..09187c4 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -21,7 +21,6 @@ #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" #include "chrome/common/instant_types.h" #include "chrome/common/translate_errors.h" -#include "chrome/common/web_apps.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/tab_contents/constrained_window.h" #include "content/browser/tab_contents/language_state.h" @@ -219,12 +218,6 @@ class TabContents : public PageNavigator, encoding_.clear(); } - const SkBitmap& app_icon() const { return app_icon_; } - - // Sets an app icon associated with TabContents and fires an INVALIDATE_TITLE - // navigation state change to trigger repaint of title. - void SetAppIcon(const SkBitmap& app_icon); - bool displayed_insecure_content() const { return displayed_insecure_content_; } @@ -960,9 +953,6 @@ class TabContents : public PageNavigator, // Handles drag and drop event forwarding to extensions. BookmarkDrag* bookmark_drag_; - // Cached web app icon. - SkBitmap app_icon_; - // RenderViewHost::ContentSettingsDelegate. scoped_ptr<TabSpecificContentSettings> content_settings_delegate_; |