Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / notifications / profile_notification.cc
blob8c1b7ac83cd2d498346221eb1b6a469e93add97f
1 // Copyright 2014 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.
5 #include "chrome/browser/notifications/profile_notification.h"
7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
10 // static
11 std::string ProfileNotification::GetProfileNotificationId(
12 const std::string& delegate_id,
13 ProfileID profile_id) {
14 DCHECK(profile_id);
15 return base::StringPrintf("notification-ui-manager#%p#%s",
16 profile_id, // Each profile has its unique instance
17 // including incognito profile.
18 delegate_id.c_str());
21 ProfileNotification::ProfileNotification(Profile* profile,
22 const Notification& notification)
23 : profile_id_(NotificationUIManager::GetProfileID(profile)),
24 notification_(
25 // Uses Notification's copy constructor to assign the message center
26 // id, which should be unique for every profile + Notification pair.
27 GetProfileNotificationId(
28 notification.delegate_id(),
29 NotificationUIManager::GetProfileID(profile)),
30 notification) {
31 DCHECK(profile);
32 #if defined(OS_CHROMEOS)
33 notification_.set_profile_id(multi_user_util::GetUserIDFromProfile(profile));
34 #endif
37 ProfileNotification::~ProfileNotification() {}