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

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_bridge.h"
9 #include "chrome/browser/profiles/profile.h"
10
11 namespace {
12 std::string GetProfileId(Profile* profile) {
Peter Beverloo 2016/04/18 14:57:09 micro nit: blank lines after namespace opening and
Miguel Garcia 2016/04/19 14:24:57 Done.
13 #if defined(OS_WIN)
14 std::string profile_id =
15 base::WideToUTF8(profile->GetPath().BaseName().value());
16 #elif defined(OS_POSIX)
17 std::string profile_id = profile->GetPath().BaseName().value();
18 #endif
19 return profile_id;
20 }
21 } // namespace
22
23 NativeNotificationDisplayService::NativeNotificationDisplayService(
24 Profile* profile,
25 NotificationBridge* notification_bridge)
26 : profile_(profile), notification_bridge_(notification_bridge) {}
27
28 NativeNotificationDisplayService::~NativeNotificationDisplayService() {}
29
30 void NativeNotificationDisplayService::Display(
31 const std::string& notification_id,
32 const Notification& notification) {
33 DCHECK(notification_bridge_);
Peter Beverloo 2016/04/18 14:57:09 nit: DCHECK in the constructor instead? That way w
Miguel Garcia 2016/04/19 14:24:57 Done.
34 notification_bridge_->Display(notification_id, GetProfileId(profile_),
35 profile_->IsOffTheRecord(), notification);
36 }
37
38 void NativeNotificationDisplayService::Close(
39 const std::string& notification_id) {
40 DCHECK(notification_bridge_);
41 notification_bridge_->Close(GetProfileId(profile_), notification_id);
42 }
43
44 bool NativeNotificationDisplayService::GetDisplayed(
45 std::set<std::string>* notifications) const {
46 DCHECK(notification_bridge_);
47 return notification_bridge_->GetDisplayed(
48 GetProfileId(profile_), profile_->IsOffTheRecord(), notifications);
49 }
50
51 bool NativeNotificationDisplayService::SupportsNotificationCenter() const {
52 DCHECK(notification_bridge_);
53 return notification_bridge_->SupportsNotificationCenter();
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698