Index: chrome/browser/background_application_list_model.cc |
=================================================================== |
--- chrome/browser/background_application_list_model.cc (revision 85937) |
+++ chrome/browser/background_application_list_model.cc (working copy) |
@@ -48,7 +48,8 @@ |
: public ImageLoadingTracker::Observer { |
public: |
Application(BackgroundApplicationListModel* model, |
- const Extension* an_extension); |
+ const Extension* an_extension, |
+ Profile* profile_); |
Miranda Callahan
2011/05/20 15:16:53
nit: remove trailing _
rpetterson
2011/05/23 03:23:19
Done.
|
virtual ~Application(); |
@@ -65,6 +66,7 @@ |
scoped_ptr<SkBitmap> icon_; |
BackgroundApplicationListModel* model_; |
ImageLoadingTracker tracker_; |
+ Profile* profile_; |
}; |
namespace { |
@@ -96,11 +98,12 @@ |
void |
BackgroundApplicationListModel::Observer::OnApplicationDataChanged( |
- const Extension* extension) { |
+ const Extension* extension, Profile* profile) { |
} |
void |
-BackgroundApplicationListModel::Observer::OnApplicationListChanged() { |
+BackgroundApplicationListModel::Observer::OnApplicationListChanged( |
+ Profile* profile) { |
} |
BackgroundApplicationListModel::Observer::~Observer() { |
@@ -111,10 +114,12 @@ |
BackgroundApplicationListModel::Application::Application( |
BackgroundApplicationListModel* model, |
- const Extension* extension) |
+ const Extension* extension, |
+ Profile* profile) |
: extension_(extension), |
icon_(NULL), |
model_(model), |
+ profile_(profile), |
ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { |
} |
@@ -125,7 +130,7 @@ |
if (!image) |
return; |
icon_.reset(new SkBitmap(*image)); |
- model_->OnApplicationDataChanged(extension_); |
+ model_->OnApplicationDataChanged(extension_, profile_); |
} |
void BackgroundApplicationListModel::Application::RequestIcon( |
@@ -174,7 +179,7 @@ |
<< " exceeded. Ignoring."; |
return; |
} |
- application = new Application(this, extension); |
+ application = new Application(this, extension, profile_); |
applications_[extension->id()] = application; |
application->RequestIcon(Extension::EXTENSION_ICON_BITTY); |
} |
@@ -239,6 +244,10 @@ |
return HasBackgroundAppPermission(extension.api_permissions()); |
} |
+bool BackgroundApplicationListModel::HasBackgroundApp() { |
+ return (applications_.size() > 0); |
+} |
+ |
void BackgroundApplicationListModel::Observe( |
NotificationType type, |
const NotificationSource& source, |
@@ -264,8 +273,10 @@ |
} |
void BackgroundApplicationListModel::OnApplicationDataChanged( |
- const Extension* extension) { |
- FOR_EACH_OBSERVER(Observer, observers_, OnApplicationDataChanged(extension)); |
+ const Extension* extension, Profile* profile) { |
+ DCHECK(profile == profile_); |
Andrew T Wilson (Slow)
2011/05/20 16:52:46
Keep in mind that this is *not* an implementation
rpetterson
2011/05/23 03:23:19
Thanks for clearing up this confusion. I am renami
|
+ FOR_EACH_OBSERVER(Observer, observers_, OnApplicationDataChanged(extension, |
+ profile)); |
} |
void BackgroundApplicationListModel::OnExtensionLoaded(Extension* extension) { |
@@ -310,6 +321,6 @@ |
} |
if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
extensions_ = extensions; |
- FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged()); |
+ FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
} |
} |