Index: chrome/browser/background/background_contents_service.cc |
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc |
index 59202dd2ced85ff4e8179bb8e1b665ea87dbfdb9..2caa88772146acbe89bd1b11d5fe72609700d1f3 100644 |
--- a/chrome/browser/background/background_contents_service.cc |
+++ b/chrome/browser/background/background_contents_service.cc |
@@ -140,7 +140,8 @@ class CrashNotificationDelegate : public NotificationDelegate { |
virtual bool HasClickedListener() OVERRIDE { return true; } |
virtual std::string id() const OVERRIDE { |
- return kNotificationPrefix + extension_id_; |
+ return BackgroundContentsService::GetNotificationIdForExtension( |
+ extension_id_); |
} |
virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE { |
@@ -166,7 +167,7 @@ void NotificationImageReady( |
Profile* profile, |
const gfx::Image& icon) { |
gfx::Image notification_icon(icon); |
- if (icon.IsEmpty()) { |
+ if (notification_icon.IsEmpty()) { |
Andrew T Wilson (Slow)
2014/02/17 17:12:32
Why is this changing to use notification_icon inst
Jun Mukai
2014/02/17 19:48:43
suggestion from the other reviewer.
We created 'no
|
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
notification_icon = rb.GetImageNamed(IDR_EXTENSION_DEFAULT_ICON); |
} |
@@ -180,42 +181,13 @@ void NotificationImageReady( |
GURL() /* empty origin */, |
base::string16(), |
message, |
- icon, |
+ notification_icon, |
base::string16(), |
delegate.get(), |
profile); |
} |
#endif |
-// Show a popup notification balloon with a crash message for a given app/ |
-// extension. |
-void ShowBalloon(const Extension* extension, Profile* profile) { |
-#if defined(ENABLE_NOTIFICATIONS) |
- const base::string16 message = l10n_util::GetStringFUTF16( |
- extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : |
- IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, |
- base::UTF8ToUTF16(extension->name())); |
- extension_misc::ExtensionIcons size(extension_misc::EXTENSION_ICON_MEDIUM); |
- extensions::ExtensionResource resource = |
- extensions::IconsInfo::GetIconResource( |
- extension, size, ExtensionIconSet::MATCH_SMALLER); |
- // We can't just load the image in the Observe method below because, despite |
- // what this method is called, it may call the callback synchronously. |
- // However, it's possible that the extension went away during the interim, |
- // so we'll bind all the pertinent data here. |
- extensions::ImageLoader::Get(profile)->LoadImageAsync( |
- extension, |
- resource, |
- gfx::Size(size, size), |
- base::Bind( |
- &NotificationImageReady, |
- extension->name(), |
- message, |
- make_scoped_refptr(new CrashNotificationDelegate(profile, extension)), |
- profile)); |
-#endif |
-} |
- |
void ReloadExtension(const std::string& extension_id, Profile* profile) { |
if (g_browser_process->IsShuttingDown() || |
!g_browser_process->profile_manager()->IsValidProfile(profile)) { |
@@ -280,6 +252,41 @@ void BackgroundContentsService:: |
restart_delay_in_ms_ = restart_delay_in_ms; |
} |
+// static |
+std::string BackgroundContentsService::GetNotificationIdForExtension( |
+ const std::string& extension_id) { |
+ return kNotificationPrefix + extension_id; |
+} |
+ |
+// static |
+void BackgroundContentsService::ShowBalloon(const Extension* extension, |
+ Profile* profile) { |
+#if defined(ENABLE_NOTIFICATIONS) |
+ const base::string16 message = l10n_util::GetStringFUTF16( |
+ extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : |
+ IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, |
+ base::UTF8ToUTF16(extension->name())); |
+ extension_misc::ExtensionIcons size(extension_misc::EXTENSION_ICON_MEDIUM); |
+ extensions::ExtensionResource resource = |
+ extensions::IconsInfo::GetIconResource( |
+ extension, size, ExtensionIconSet::MATCH_SMALLER); |
+ // We can't just load the image in the Observe method below because, despite |
+ // what this method is called, it may call the callback synchronously. |
+ // However, it's possible that the extension went away during the interim, |
+ // so we'll bind all the pertinent data here. |
+ extensions::ImageLoader::Get(profile)->LoadImageAsync( |
+ extension, |
+ resource, |
+ gfx::Size(size, size), |
+ base::Bind( |
+ &NotificationImageReady, |
+ extension->name(), |
+ message, |
+ make_scoped_refptr(new CrashNotificationDelegate(profile, extension)), |
+ profile)); |
+#endif |
+} |
+ |
std::vector<BackgroundContents*> |
BackgroundContentsService::GetBackgroundContents() const |
{ |