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

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

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/notifications/native_notification_display_service.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/notifications/notification_platform_bridge.h"
9 #include "chrome/browser/profiles/profile.h"
10
11 namespace {
12
13 std::string GetProfileId(Profile* profile) {
14 #if defined(OS_WIN)
15 std::string profile_id =
16 base::WideToUTF8(profile->GetPath().BaseName().value());
17 #elif defined(OS_POSIX)
18 std::string profile_id = profile->GetPath().BaseName().value();
19 #endif
20 return profile_id;
21 }
22
23 } // namespace
24
25 NativeNotificationDisplayService::NativeNotificationDisplayService(
26 Profile* profile,
27 NotificationPlatformBridge* notification_bridge)
28 : profile_(profile), notification_bridge_(notification_bridge) {
29 DCHECK(profile_);
30 DCHECK(notification_bridge_);
31 }
32
33 NativeNotificationDisplayService::~NativeNotificationDisplayService() {}
34
35 void NativeNotificationDisplayService::Display(
36 const std::string& notification_id,
37 const Notification& notification) {
38 notification_bridge_->Display(notification_id, GetProfileId(profile_),
39 profile_->IsOffTheRecord(), notification);
40 }
41
42 void NativeNotificationDisplayService::Close(
43 const std::string& notification_id) {
44 notification_bridge_->Close(GetProfileId(profile_), notification_id);
45 }
46
47 bool NativeNotificationDisplayService::GetDisplayed(
48 std::set<std::string>* notifications) const {
49 return notification_bridge_->GetDisplayed(
50 GetProfileId(profile_), profile_->IsOffTheRecord(), notifications);
51 }
52
53 bool NativeNotificationDisplayService::SupportsNotificationCenter() const {
54 return notification_bridge_->SupportsNotificationCenter();
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698