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

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

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 9 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
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/notifications/notification.h" 21 #include "chrome/browser/notifications/notification.h"
22 #include "chrome/browser/notifications/notification_ui_manager.h" 22 #include "chrome/browser/notifications/notification_ui_manager.h"
23 #include "chrome/browser/prefs/scoped_user_pref_update.h" 23 #include "chrome/browser/prefs/scoped_user_pref_update.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_finder.h" 26 #include "chrome/browser/ui/browser_finder.h"
27 #include "chrome/browser/ui/browser_tabstrip.h" 27 #include "chrome/browser/ui/browser_tabstrip.h"
28 #include "chrome/browser/ui/host_desktop.h" 28 #include "chrome/browser/ui/host_desktop.h"
29 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/extensions/api/icons/icons_handler.h"
31 #include "chrome/common/extensions/extension.h" 32 #include "chrome/common/extensions/extension.h"
32 #include "chrome/common/extensions/extension_constants.h" 33 #include "chrome/common/extensions/extension_constants.h"
33 #include "chrome/common/extensions/extension_icon_set.h" 34 #include "chrome/common/extensions/extension_icon_set.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
36 #include "content/public/browser/site_instance.h" 37 #include "content/public/browser/site_instance.h"
37 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
38 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
39 #include "ipc/ipc_message.h" 40 #include "ipc/ipc_message.h"
40 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 DISALLOW_COPY_AND_ASSIGN(CrashNotificationDelegate); 117 DISALLOW_COPY_AND_ASSIGN(CrashNotificationDelegate);
117 }; 118 };
118 119
119 void ShowBalloon(const Extension* extension, Profile* profile) { 120 void ShowBalloon(const Extension* extension, Profile* profile) {
120 #if defined(ENABLE_NOTIFICATIONS) 121 #if defined(ENABLE_NOTIFICATIONS)
121 string16 title; // no notifiaction title 122 string16 title; // no notifiaction title
122 string16 message = l10n_util::GetStringFUTF16( 123 string16 message = l10n_util::GetStringFUTF16(
123 extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE : 124 extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE :
124 IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE, 125 IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE,
125 UTF8ToUTF16(extension->name())); 126 UTF8ToUTF16(extension->name()));
126 GURL icon_url(extension->GetIconURL(extension_misc::EXTENSION_ICON_SMALLISH, 127 GURL icon_url(extensions::IconsInfo::GetIconURL(
127 ExtensionIconSet::MATCH_BIGGER)); 128 extension,
129 extension_misc::EXTENSION_ICON_SMALLISH,
130 ExtensionIconSet::MATCH_BIGGER));
128 DesktopNotificationService::AddNotification( 131 DesktopNotificationService::AddNotification(
129 extension->url(), title, message, icon_url, string16(), 132 extension->url(), title, message, icon_url, string16(),
130 new CrashNotificationDelegate(profile, extension), profile); 133 new CrashNotificationDelegate(profile, extension), profile);
131 #endif 134 #endif
132 } 135 }
133 136
134 } 137 }
135 138
136 // Keys for the information we store about individual BackgroundContents in 139 // Keys for the information we store about individual BackgroundContents in
137 // prefs. There is one top-level DictionaryValue (stored at 140 // prefs. There is one top-level DictionaryValue (stored at
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 bool user_gesture, 632 bool user_gesture,
630 bool* was_blocked) { 633 bool* was_blocked) {
631 Browser* browser = chrome::FindLastActiveWithProfile( 634 Browser* browser = chrome::FindLastActiveWithProfile(
632 Profile::FromBrowserContext(new_contents->GetBrowserContext()), 635 Profile::FromBrowserContext(new_contents->GetBrowserContext()),
633 chrome::GetActiveDesktop()); 636 chrome::GetActiveDesktop());
634 if (browser) { 637 if (browser) {
635 chrome::AddWebContents(browser, NULL, new_contents, disposition, 638 chrome::AddWebContents(browser, NULL, new_contents, disposition,
636 initial_pos, user_gesture, was_blocked); 639 initial_pos, user_gesture, was_blocked);
637 } 640 }
638 } 641 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698