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

Unified Diff: chrome/browser/ui/panels/panel.cc

Issue 11886029: Use ImageLoader instead of ImageLoadingTracker (Part 9) (Closed) Base URL: https://git.chromium.org/chromium/src.git@Issue_163929
Patch Set: Created 7 years, 11 months 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
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel.cc
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 35900ca68d4845adbbeb4120fc7f36f96116905f..370b508513593bb866cb5e741ea59d1b7e79b205 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_tab_util.h"
+#include "chrome/browser/extensions/image_loader.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/extensions/window_controller_list.h"
#include "chrome/browser/lifetime/application_lifetime.h"
@@ -148,7 +149,8 @@ Panel::Panel(const std::string& app_name,
native_panel_(NULL),
attention_mode_(USE_PANEL_ATTENTION),
expansion_state_(EXPANDED),
- command_updater_(this) {
+ command_updater_(this),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
}
Panel::~Panel() {
@@ -223,7 +225,6 @@ void Panel::InitCommandState() {
}
void Panel::OnNativePanelClosed() {
- app_icon_loader_.reset();
jianli 2013/01/15 01:58:04 Do we need to do the similar thing here by calling
rpaquay 2013/01/16 20:49:11 I believe you are correct. Fixed.
registrar_.RemoveAll();
manager()->OnPanelClosed(this);
DCHECK(!collection_);
@@ -822,24 +823,21 @@ void Panel::UpdateAppIcon() {
if (!extension)
return;
- app_icon_loader_.reset(new ImageLoadingTracker(this));
- app_icon_loader_->LoadImage(
+ extensions::ImageLoader* loader = extensions::ImageLoader::Get(profile());
+ loader->LoadImageAsync(
extension,
extension->GetIconResource(extension_misc::EXTENSION_ICON_SMALL,
ExtensionIconSet::MATCH_BIGGER),
gfx::Size(extension_misc::EXTENSION_ICON_SMALL,
extension_misc::EXTENSION_ICON_SMALL),
- ImageLoadingTracker::CACHE);
+ base::Bind(&Panel::OnImageLoaded, weak_ptr_factory_.GetWeakPtr()));
}
-void Panel::OnImageLoaded(const gfx::Image& image,
- const std::string& extension_id,
- int index) {
+void Panel::OnImageLoaded(const gfx::Image& image) {
if (!image.IsEmpty()) {
app_icon_ = image;
native_panel_->UpdatePanelTitleBar();
}
- app_icon_loader_.reset();
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PANEL_APP_ICON_LOADED,
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698