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

Side by Side Diff: chrome/browser/background/background_contents_service.cc

Issue 294473002: Allow extension crash notifications to replace each other. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better patch. Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/background/background_contents_service.h" 5 #include "chrome/browser/background/background_contents_service.h"
6 6
7 #include "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 170 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
171 notification_icon = rb.GetImageNamed(IDR_EXTENSION_DEFAULT_ICON); 171 notification_icon = rb.GetImageNamed(IDR_EXTENSION_DEFAULT_ICON);
172 } 172 }
173 173
174 // Origin URL must be different from the crashed extension to avoid the 174 // Origin URL must be different from the crashed extension to avoid the
175 // conflict. NotificationSystemObserver will cancel all notifications from 175 // conflict. NotificationSystemObserver will cancel all notifications from
176 // the same origin when NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED. 176 // the same origin when NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED.
177 // TODO(mukai, dewittj): remove this and switch to message center 177 // TODO(mukai, dewittj): remove this and switch to message center
178 // notifications. 178 // notifications.
179 DesktopNotificationService::AddIconNotification( 179 DesktopNotificationService::AddIconNotification(
180 GURL() /* empty origin */, 180 GURL("chrome://extension-crash"),
181 base::string16(), 181 base::string16(),
182 message, 182 message,
183 notification_icon, 183 notification_icon,
184 base::string16(), 184 base::UTF8ToUTF16(delegate->id()),
Andrew T Wilson (Slow) 2014/05/19 14:02:27 Maybe some inline comment that this is the replace
dewittj 2014/05/20 18:18:22 Done.
185 delegate.get(), 185 delegate.get(),
186 profile); 186 profile);
187 } 187 }
188 #endif 188 #endif
189 189
190 // Show a popup notification balloon with a crash message for a given app/ 190 // Show a popup notification balloon with a crash message for a given app/
191 // extension. 191 // extension.
192 void ShowBalloon(const Extension* extension, Profile* profile) { 192 void ShowBalloon(const Extension* extension, Profile* profile) {
193 #if defined(ENABLE_NOTIFICATIONS) 193 #if defined(ENABLE_NOTIFICATIONS)
194 const base::string16 message = l10n_util::GetStringFUTF16( 194 const base::string16 message = l10n_util::GetStringFUTF16(
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 bool user_gesture, 786 bool user_gesture,
787 bool* was_blocked) { 787 bool* was_blocked) {
788 Browser* browser = chrome::FindLastActiveWithProfile( 788 Browser* browser = chrome::FindLastActiveWithProfile(
789 Profile::FromBrowserContext(new_contents->GetBrowserContext()), 789 Profile::FromBrowserContext(new_contents->GetBrowserContext()),
790 chrome::GetActiveDesktop()); 790 chrome::GetActiveDesktop());
791 if (browser) { 791 if (browser) {
792 chrome::AddWebContents(browser, NULL, new_contents, disposition, 792 chrome::AddWebContents(browser, NULL, new_contents, disposition,
793 initial_pos, user_gesture, was_blocked); 793 initial_pos, user_gesture, was_blocked);
794 } 794 }
795 } 795 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698