OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_contents_service.h" | 5 #include "chrome/browser/background_contents_service.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 std::string extension_id_; | 93 std::string extension_id_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(CrashNotificationDelegate); | 95 DISALLOW_COPY_AND_ASSIGN(CrashNotificationDelegate); |
96 }; | 96 }; |
97 | 97 |
98 void ShowBalloon(const Extension* extension, Profile* profile) { | 98 void ShowBalloon(const Extension* extension, Profile* profile) { |
99 string16 message = l10n_util::GetStringFUTF16( | 99 string16 message = l10n_util::GetStringFUTF16( |
100 extension->is_hosted_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : | 100 extension->is_hosted_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : |
101 IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, | 101 IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, |
102 UTF8ToUTF16(extension->name())); | 102 UTF8ToUTF16(extension->name())); |
103 string16 content_url = DesktopNotificationService::CreateDataUrl( | 103 DesktopNotificationService::ShowBalloon( |
| 104 extension->url(), |
104 extension->GetIconURL(Extension::EXTENSION_ICON_SMALLISH, | 105 extension->GetIconURL(Extension::EXTENSION_ICON_SMALLISH, |
105 ExtensionIconSet::MATCH_BIGGER), | 106 ExtensionIconSet::MATCH_BIGGER), |
106 string16(), message, WebKit::WebTextDirectionDefault); | 107 string16(), message, new CrashNotificationDelegate(profile, extension), |
107 Notification notification( | 108 profile); |
108 extension->url(), GURL(content_url), string16(), string16(), | |
109 new CrashNotificationDelegate(profile, extension)); | |
110 g_browser_process->notification_ui_manager()->Add(notification, profile); | |
111 } | 109 } |
112 | 110 |
113 } | 111 } |
114 | 112 |
115 // Keys for the information we store about individual BackgroundContents in | 113 // Keys for the information we store about individual BackgroundContents in |
116 // prefs. There is one top-level DictionaryValue (stored at | 114 // prefs. There is one top-level DictionaryValue (stored at |
117 // prefs::kRegisteredBackgroundContents). Information about each | 115 // prefs::kRegisteredBackgroundContents). Information about each |
118 // BackgroundContents is stored under that top-level DictionaryValue, keyed | 116 // BackgroundContents is stored under that top-level DictionaryValue, keyed |
119 // by the parent application ID for easy lookup. | 117 // by the parent application ID for easy lookup. |
120 // | 118 // |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 TabContents* new_contents, | 569 TabContents* new_contents, |
572 WindowOpenDisposition disposition, | 570 WindowOpenDisposition disposition, |
573 const gfx::Rect& initial_pos, | 571 const gfx::Rect& initial_pos, |
574 bool user_gesture) { | 572 bool user_gesture) { |
575 Browser* browser = BrowserList::GetLastActiveWithProfile( | 573 Browser* browser = BrowserList::GetLastActiveWithProfile( |
576 new_contents->profile()); | 574 new_contents->profile()); |
577 if (!browser) | 575 if (!browser) |
578 return; | 576 return; |
579 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 577 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
580 } | 578 } |
OLD | NEW |