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

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

Issue 1155453002: Passing ProfileID instead of Profile* to clarify that profile should not be used for making any cal… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 6 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 | « chrome/browser/notifications/profile_notification.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/profile_notification.h" 5 #include "chrome/browser/notifications/profile_notification.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 8 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
9 9
10 // static 10 // static
11 std::string ProfileNotification::GetProfileNotificationId( 11 std::string ProfileNotification::GetProfileNotificationId(
12 const std::string& delegate_id, 12 const std::string& delegate_id,
13 ProfileID profile_id) { 13 ProfileID profile_id) {
14 DCHECK(profile_id); 14 DCHECK(profile_id);
15 return base::StringPrintf("notification-ui-manager#%p#%s", 15 return base::StringPrintf("notification-ui-manager#%p#%s",
16 profile_id, // Each profile has its unique instance 16 profile_id, // Each profile has its unique instance
17 // including incognito profile. 17 // including incognito profile.
18 delegate_id.c_str()); 18 delegate_id.c_str());
19 } 19 }
20 20
21 ProfileNotification::ProfileNotification( 21 ProfileNotification::ProfileNotification(ProfileID profile_id,
22 Profile* profile, 22 const Notification& notification)
23 const Notification& notification) 23 : profile_id_(profile_id),
24 : profile_(profile),
25 notification_( 24 notification_(
26 // Uses Notification's copy constructor to assign the message center 25 // Uses Notification's copy constructor to assign the message center
27 // id, which should be unique for every profile + Notification pair. 26 // id, which should be unique for every profile + Notification pair.
28 GetProfileNotificationId( 27 GetProfileNotificationId(notification.delegate_id(), profile_id),
29 notification.delegate_id(),
30 NotificationUIManager::GetProfileID(profile)),
31 notification) { 28 notification) {
32 DCHECK(profile); 29 DCHECK(profile_id);
33 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
34 notification_.set_profile_id(multi_user_util::GetUserIDFromProfile(profile)); 31 notification_.set_profile_id(
32 multi_user_util::GetUserIDFromProfile(profile_id));
dewittj 2015/05/29 16:44:30 I'm surprised that this compiles; it takes a Profi
Deepak 2015/05/30 05:38:05 Done.
35 #endif 33 #endif
36 } 34 }
37 35
38 ProfileNotification::~ProfileNotification() {} 36 ProfileNotification::~ProfileNotification() {}
39 37
OLDNEW
« no previous file with comments | « chrome/browser/notifications/profile_notification.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698