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

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

Issue 2856753002: Linux native notifications: Add server capabilities metrics (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/native_notification_display_service.h" 5 #include "chrome/browser/notifications/native_notification_display_service.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/nullable_string16.h" 12 #include "base/strings/nullable_string16.h"
10 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/notifications/message_center_display_service.h" 15 #include "chrome/browser/notifications/message_center_display_service.h"
13 #include "chrome/browser/notifications/non_persistent_notification_handler.h" 16 #include "chrome/browser/notifications/non_persistent_notification_handler.h"
14 #include "chrome/browser/notifications/notification.h" 17 #include "chrome/browser/notifications/notification.h"
15 #include "chrome/browser/notifications/notification_delegate.h" 18 #include "chrome/browser/notifications/notification_delegate.h"
16 #include "chrome/browser/notifications/notification_handler.h" 19 #include "chrome/browser/notifications/notification_handler.h"
17 #include "chrome/browser/notifications/notification_platform_bridge.h" 20 #include "chrome/browser/notifications/notification_platform_bridge.h"
18 #include "chrome/browser/notifications/persistent_notification_handler.h" 21 #include "chrome/browser/notifications/persistent_notification_handler.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #if BUILDFLAG(ENABLE_EXTENSIONS) 62 #if BUILDFLAG(ENABLE_EXTENSIONS)
60 AddNotificationHandler(NotificationCommon::EXTENSION, 63 AddNotificationHandler(NotificationCommon::EXTENSION,
61 base::MakeUnique<ExtensionNotificationHandler>()); 64 base::MakeUnique<ExtensionNotificationHandler>());
62 #endif 65 #endif
63 } 66 }
64 67
65 NativeNotificationDisplayService::~NativeNotificationDisplayService() = default; 68 NativeNotificationDisplayService::~NativeNotificationDisplayService() = default;
66 69
67 void NativeNotificationDisplayService::OnNotificationPlatformBridgeReady( 70 void NativeNotificationDisplayService::OnNotificationPlatformBridgeReady(
68 bool success) { 71 bool success) {
72 UMA_HISTOGRAM_BOOLEAN("Notifications.UsingNativeNotificationCenter", success);
69 if (success) { 73 if (success) {
70 notification_bridge_ready_ = true; 74 notification_bridge_ready_ = true;
71 } else { 75 } else {
72 message_center_display_service_ = 76 message_center_display_service_ =
73 base::MakeUnique<MessageCenterDisplayService>( 77 base::MakeUnique<MessageCenterDisplayService>(
74 profile_, g_browser_process->notification_ui_manager()); 78 profile_, g_browser_process->notification_ui_manager());
75 } 79 }
76 80
77 while (!actions_.empty()) { 81 while (!actions_.empty()) {
78 std::move(actions_.front()).Run(); 82 std::move(actions_.front()).Run();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 notification_handlers_.erase(notification_type); 175 notification_handlers_.erase(notification_type);
172 } 176 }
173 177
174 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( 178 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler(
175 NotificationCommon::Type notification_type) { 179 NotificationCommon::Type notification_type) {
176 DCHECK(notification_handlers_.find(notification_type) != 180 DCHECK(notification_handlers_.find(notification_type) !=
177 notification_handlers_.end()) 181 notification_handlers_.end())
178 << notification_type << " is not registered."; 182 << notification_type << " is not registered.";
179 return notification_handlers_[notification_type].get(); 183 return notification_handlers_[notification_type].get();
180 } 184 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698