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

Side by Side Diff: chrome/browser/notifications/notification_display_service_factory.cc

Issue 2828503005: Add NotificationDisplayServiceProxy (Closed)
Patch Set: Rebase Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/notification_display_service_factory.h" 5 #include "chrome/browser/notifications/notification_display_service_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/notifications/message_center_display_service.h" 10 #include "chrome/browser/notifications/message_center_display_service.h"
11 #include "chrome/browser/notifications/notification_display_service_proxy.h"
11 #include "chrome/browser/notifications/notification_ui_manager.h" 12 #include "chrome/browser/notifications/notification_ui_manager.h"
12 #include "chrome/browser/profiles/incognito_helpers.h" 13 #include "chrome/browser/profiles/incognito_helpers.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/chrome_features.h" 15 #include "chrome/common/chrome_features.h"
15 #include "chrome/common/features.h" 16 #include "chrome/common/features.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" 17 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 18
18 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 19 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
19 #include "chrome/browser/notifications/native_notification_display_service.h" 20 #include "chrome/browser/notifications/native_notification_display_service.h"
20 #endif 21 #endif
(...skipping 22 matching lines...) Expand all
43 // NativeNotificationDisplayService by using the chrome://flags or via 44 // NativeNotificationDisplayService by using the chrome://flags or via
44 // the --enable-features=NativeNotifications command line flag. 45 // the --enable-features=NativeNotifications command line flag.
45 // - All other platforms always use the MessageCenterDisplayService. 46 // - All other platforms always use the MessageCenterDisplayService.
46 KeyedService* NotificationDisplayServiceFactory::BuildServiceInstanceFor( 47 KeyedService* NotificationDisplayServiceFactory::BuildServiceInstanceFor(
47 content::BrowserContext* context) const { 48 content::BrowserContext* context) const {
48 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 49 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
49 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
50 return new NativeNotificationDisplayService( 51 return new NativeNotificationDisplayService(
51 Profile::FromBrowserContext(context), 52 Profile::FromBrowserContext(context),
52 g_browser_process->notification_platform_bridge()); 53 g_browser_process->notification_platform_bridge());
53 #else // defined(OS_ANDROID) 54 #elif defined(OS_MACOSX)
54 if (base::FeatureList::IsEnabled(features::kNativeNotifications) && 55 if (base::FeatureList::IsEnabled(features::kNativeNotifications)) {
55 g_browser_process->notification_platform_bridge()) {
56 return new NativeNotificationDisplayService( 56 return new NativeNotificationDisplayService(
57 Profile::FromBrowserContext(context), 57 Profile::FromBrowserContext(context),
58 g_browser_process->notification_platform_bridge()); 58 g_browser_process->notification_platform_bridge());
59 } 59 }
60 #endif // defined(OS_ANDROID) 60 #elif defined(OS_LINUX)
61 if (base::FeatureList::IsEnabled(features::kNativeNotifications)) {
62 return new NotificationDisplayServiceProxy(
63 Profile::FromBrowserContext(context));
64 }
65 #endif
61 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 66 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
62 return new MessageCenterDisplayService( 67 return new MessageCenterDisplayService(
63 Profile::FromBrowserContext(context), 68 Profile::FromBrowserContext(context),
64 g_browser_process->notification_ui_manager()); 69 g_browser_process->notification_ui_manager());
65 } 70 }
66 71
67 content::BrowserContext* 72 content::BrowserContext*
68 NotificationDisplayServiceFactory::GetBrowserContextToUse( 73 NotificationDisplayServiceFactory::GetBrowserContextToUse(
69 content::BrowserContext* context) const { 74 content::BrowserContext* context) const {
70 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 75 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
71 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/notifications/notification_display_service_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698