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

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

Issue 2033093003: [Notification] Make HTML5 Notification use ActionCenter on Windows 10, behind Flags. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and merge. Created 3 years, 7 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 "base/win/windows_version.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/notifications/message_center_display_service.h" 11 #include "chrome/browser/notifications/message_center_display_service.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)
(...skipping 19 matching lines...) Expand all
38 BrowserContextDependencyManager::GetInstance()) {} 39 BrowserContextDependencyManager::GetInstance()) {}
39 40
40 // Selection of the implementation works as follows: 41 // Selection of the implementation works as follows:
41 // - Android always uses the NativeNotificationDisplayService. 42 // - Android always uses the NativeNotificationDisplayService.
42 // - Mac uses the NativeNotificationDisplayService by default but 43 // - Mac uses the NativeNotificationDisplayService by default but
43 // can revert to MessageCenterDisplayService via 44 // can revert to MessageCenterDisplayService via
44 // chrome://flags#enable-native-notifications or Finch 45 // chrome://flags#enable-native-notifications or Finch
45 // - Linux uses MessageCenterDisplayService by default but can switch 46 // - Linux uses MessageCenterDisplayService by default but can switch
46 // to NativeNotificationDisplayService via 47 // to NativeNotificationDisplayService via
47 // chrome://flags#enable-native-notifications 48 // chrome://flags#enable-native-notifications
49 // - Windows 10 update 2016/07 and above use MessageCenterDisplayService by
50 // default but can switch to NativeNotificationDisplayService via
51 // chrome://flags#enable-native-notifications
48 // - All other platforms always use the MessageCenterDisplayService. 52 // - All other platforms always use the MessageCenterDisplayService.
49 KeyedService* NotificationDisplayServiceFactory::BuildServiceInstanceFor( 53 KeyedService* NotificationDisplayServiceFactory::BuildServiceInstanceFor(
50 content::BrowserContext* context) const { 54 content::BrowserContext* context) const {
51 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 55 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
52 #if defined(OS_ANDROID) 56 #if defined(OS_WIN)
57 DCHECK(base::FeatureList::IsEnabled(features::kNativeNotifications));
58 if (base::win::GetVersion() >= base::win::VERSION_WIN10_R1 &&
59 base::FeatureList::IsEnabled(features::kNativeNotifications)) {
60 return new NativeNotificationDisplayService(
61 Profile::FromBrowserContext(context),
62 g_browser_process->notification_platform_bridge());
63 }
64 #elif defined(OS_ANDROID)
53 DCHECK(base::FeatureList::IsEnabled(features::kNativeNotifications)); 65 DCHECK(base::FeatureList::IsEnabled(features::kNativeNotifications));
54 return new NativeNotificationDisplayService( 66 return new NativeNotificationDisplayService(
55 Profile::FromBrowserContext(context), 67 Profile::FromBrowserContext(context),
56 g_browser_process->notification_platform_bridge()); 68 g_browser_process->notification_platform_bridge());
57 #endif 69 #endif
58 if (base::FeatureList::IsEnabled(features::kNativeNotifications) && 70 if (base::FeatureList::IsEnabled(features::kNativeNotifications) &&
59 g_browser_process->notification_platform_bridge()) { 71 g_browser_process->notification_platform_bridge()) {
60 return new NativeNotificationDisplayService( 72 return new NativeNotificationDisplayService(
61 Profile::FromBrowserContext(context), 73 Profile::FromBrowserContext(context),
62 g_browser_process->notification_platform_bridge()); 74 g_browser_process->notification_platform_bridge());
63 } 75 }
64 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 76 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
65 return new MessageCenterDisplayService( 77 return new MessageCenterDisplayService(
66 Profile::FromBrowserContext(context), 78 Profile::FromBrowserContext(context),
67 g_browser_process->notification_ui_manager()); 79 g_browser_process->notification_ui_manager());
68 } 80 }
69 81
70 content::BrowserContext* 82 content::BrowserContext*
71 NotificationDisplayServiceFactory::GetBrowserContextToUse( 83 NotificationDisplayServiceFactory::GetBrowserContextToUse(
72 content::BrowserContext* context) const { 84 content::BrowserContext* context) const {
73 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 85 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
74 } 86 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/notifications/notification_platform_bridge_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698