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

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

Issue 1895473002: PlatformNotificationService layering cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@display_manager2
Patch Set: Created 4 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/native_notification_display_service.h" 5 #include "chrome/browser/notifications/native_notification_display_service.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/notifications/notification.h"
8 #include "chrome/browser/notifications/notification_platform_bridge.h" 9 #include "chrome/browser/notifications/notification_platform_bridge.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 11
11 namespace { 12 namespace {
12 13
13 std::string GetProfileId(Profile* profile) { 14 std::string GetProfileId(Profile* profile) {
14 #if defined(OS_WIN) 15 #if defined(OS_WIN)
15 std::string profile_id = 16 std::string profile_id =
16 base::WideToUTF8(profile->GetPath().BaseName().value()); 17 base::WideToUTF8(profile->GetPath().BaseName().value());
17 #elif defined(OS_POSIX) 18 #elif defined(OS_POSIX)
(...skipping 12 matching lines...) Expand all
30 DCHECK(notification_bridge_); 31 DCHECK(notification_bridge_);
31 } 32 }
32 33
33 NativeNotificationDisplayService::~NativeNotificationDisplayService() {} 34 NativeNotificationDisplayService::~NativeNotificationDisplayService() {}
34 35
35 void NativeNotificationDisplayService::Display( 36 void NativeNotificationDisplayService::Display(
36 const std::string& notification_id, 37 const std::string& notification_id,
37 const Notification& notification) { 38 const Notification& notification) {
38 notification_bridge_->Display(notification_id, GetProfileId(profile_), 39 notification_bridge_->Display(notification_id, GetProfileId(profile_),
39 profile_->IsOffTheRecord(), notification); 40 profile_->IsOffTheRecord(), notification);
41 notification.delegate()->Display();
40 } 42 }
41 43
42 void NativeNotificationDisplayService::Close( 44 void NativeNotificationDisplayService::Close(
43 const std::string& notification_id) { 45 const std::string& notification_id) {
44 notification_bridge_->Close(GetProfileId(profile_), notification_id); 46 notification_bridge_->Close(GetProfileId(profile_), notification_id);
45 } 47 }
46 48
47 bool NativeNotificationDisplayService::GetDisplayed( 49 bool NativeNotificationDisplayService::GetDisplayed(
48 std::set<std::string>* notifications) const { 50 std::set<std::string>* notifications) const {
49 return notification_bridge_->GetDisplayed( 51 return notification_bridge_->GetDisplayed(
50 GetProfileId(profile_), profile_->IsOffTheRecord(), notifications); 52 GetProfileId(profile_), profile_->IsOffTheRecord(), notifications);
51 } 53 }
52 54
53 bool NativeNotificationDisplayService::SupportsNotificationCenter() const { 55 bool NativeNotificationDisplayService::SupportsNotificationCenter() const {
54 return notification_bridge_->SupportsNotificationCenter(); 56 return notification_bridge_->SupportsNotificationCenter();
55 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698