OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/notifications/message_center_settings_controller.h" | 5 #include "chrome/browser/notifications/message_center_settings_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/string_compare.h" | 10 #include "base/i18n/string_compare.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
28 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
29 #include "chrome/common/extensions/api/notifications.h" | 29 #include "chrome/common/extensions/api/notifications.h" |
30 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
31 #include "components/favicon_base/favicon_types.h" | 31 #include "components/favicon_base/favicon_types.h" |
32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/notification_source.h" | 33 #include "content/public/browser/notification_source.h" |
34 #include "extensions/browser/event_router.h" | 34 #include "extensions/browser/event_router.h" |
35 #include "extensions/browser/extension_system.h" | 35 #include "extensions/browser/extension_system.h" |
| 36 #include "extensions/browser/extension_util.h" |
36 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
37 #include "grit/ui_strings.h" | 38 #include "grit/ui_strings.h" |
38 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
39 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
40 #include "ui/gfx/image/image.h" | 41 #include "ui/gfx/image/image.h" |
41 #include "ui/message_center/message_center_style.h" | 42 #include "ui/message_center/message_center_style.h" |
42 | 43 |
43 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
44 #include "ash/system/system_notifier.h" | 45 #include "ash/system/system_notifier.h" |
45 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 46 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 for (extensions::ExtensionSet::const_iterator iter = extension_set->begin(); | 225 for (extensions::ExtensionSet::const_iterator iter = extension_set->begin(); |
225 iter != extension_set->end(); | 226 iter != extension_set->end(); |
226 ++iter) { | 227 ++iter) { |
227 const extensions::Extension* extension = iter->get(); | 228 const extensions::Extension* extension = iter->get(); |
228 if (!extension->HasAPIPermission( | 229 if (!extension->HasAPIPermission( |
229 extensions::APIPermission::kNotification)) { | 230 extensions::APIPermission::kNotification)) { |
230 continue; | 231 continue; |
231 } | 232 } |
232 | 233 |
233 // Exclude cached ephemeral apps that are not currently running. | 234 // Exclude cached ephemeral apps that are not currently running. |
234 if (extension->is_ephemeral() && | 235 if (extensions::util::IsEphemeralApp(extension->id(), profile) && |
235 extensions::util::IsExtensionIdle(extension->id(), profile)) { | 236 extensions::util::IsExtensionIdle(extension->id(), profile)) { |
236 continue; | 237 continue; |
237 } | 238 } |
238 | 239 |
239 NotifierId notifier_id(NotifierId::APPLICATION, extension->id()); | 240 NotifierId notifier_id(NotifierId::APPLICATION, extension->id()); |
240 notifiers->push_back(new Notifier( | 241 notifiers->push_back(new Notifier( |
241 notifier_id, | 242 notifier_id, |
242 base::UTF8ToUTF16(extension->name()), | 243 base::UTF8ToUTF16(extension->name()), |
243 notification_service->IsNotifierEnabled(notifier_id))); | 244 notification_service->IsNotifierEnabled(notifier_id))); |
244 app_icon_loader_->FetchImage(extension->id()); | 245 app_icon_loader_->FetchImage(extension->id()); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // creating a primary profile, and causes an infinite loop. | 539 // creating a primary profile, and causes an infinite loop. |
539 // Thus, it would be better to delay creating group for guest login. | 540 // Thus, it would be better to delay creating group for guest login. |
540 base::MessageLoopProxy::current()->PostTask( | 541 base::MessageLoopProxy::current()->PostTask( |
541 FROM_HERE, | 542 FROM_HERE, |
542 base::Bind( | 543 base::Bind( |
543 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, | 544 &MessageCenterSettingsController::CreateNotifierGroupForGuestLogin, |
544 weak_factory_.GetWeakPtr())); | 545 weak_factory_.GetWeakPtr())); |
545 } | 546 } |
546 #endif | 547 #endif |
547 } | 548 } |
OLD | NEW |