OLD | NEW |
---|---|
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 gfx::Image notification_icon(icon); | 162 gfx::Image notification_icon(icon); |
163 if (notification_icon.IsEmpty()) { | 163 if (notification_icon.IsEmpty()) { |
164 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 164 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
165 notification_icon = rb.GetImageNamed(IDR_EXTENSION_DEFAULT_ICON); | 165 notification_icon = rb.GetImageNamed(IDR_EXTENSION_DEFAULT_ICON); |
166 } | 166 } |
167 | 167 |
168 // Origin URL must be different from the crashed extension to avoid the | 168 // Origin URL must be different from the crashed extension to avoid the |
169 // conflict. NotificationSystemObserver will cancel all notifications from | 169 // conflict. NotificationSystemObserver will cancel all notifications from |
170 // the same origin when NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED. | 170 // the same origin when NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED. |
171 // TODO(mukai, dewittj): remove this and switch to message center | 171 // TODO(mukai, dewittj): remove this and switch to message center |
172 // notifications. | 172 // notifications. |
Peter Beverloo
2014/12/02 16:13:41
Is this TODO still relevant? The NotificationUIMan
dewittj
2014/12/02 17:25:12
yeah, plz remove :)
Peter Beverloo
2014/12/03 15:50:39
Done.
| |
173 DesktopNotificationService::AddIconNotification( | 173 Notification notification(GURL("chrome://extension-crash"), |
174 GURL("chrome://extension-crash"), // Origin URL. | 174 base::string16(), |
175 base::string16(), // Title of notification. | 175 message, |
176 message, | 176 notification_icon, |
177 notification_icon, | 177 base::string16(), |
178 base::UTF8ToUTF16(delegate->id()), // Replace ID. | 178 base::UTF8ToUTF16(delegate->id()), |
179 delegate.get(), | 179 delegate.get()); |
180 profile); | 180 |
181 g_browser_process->notification_ui_manager()->Add(notification, profile); | |
181 } | 182 } |
182 #endif | 183 #endif |
183 | 184 |
184 // Show a popup notification balloon with a crash message for a given app/ | 185 // Show a popup notification balloon with a crash message for a given app/ |
185 // extension. | 186 // extension. |
186 void ShowBalloon(const Extension* extension, Profile* profile) { | 187 void ShowBalloon(const Extension* extension, Profile* profile) { |
187 #if defined(ENABLE_NOTIFICATIONS) | 188 #if defined(ENABLE_NOTIFICATIONS) |
188 const base::string16 message = l10n_util::GetStringFUTF16( | 189 const base::string16 message = l10n_util::GetStringFUTF16( |
189 extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : | 190 extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : |
190 IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, | 191 IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
768 bool user_gesture, | 769 bool user_gesture, |
769 bool* was_blocked) { | 770 bool* was_blocked) { |
770 Browser* browser = chrome::FindLastActiveWithProfile( | 771 Browser* browser = chrome::FindLastActiveWithProfile( |
771 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 772 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
772 chrome::GetActiveDesktop()); | 773 chrome::GetActiveDesktop()); |
773 if (browser) { | 774 if (browser) { |
774 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 775 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
775 initial_pos, user_gesture, was_blocked); | 776 initial_pos, user_gesture, was_blocked); |
776 } | 777 } |
777 } | 778 } |
OLD | NEW |