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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.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
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/platform_notification_service_impl.h" 5 #include "chrome/browser/notifications/platform_notification_service_impl.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 10 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 BrowserContext* browser_context, 310 BrowserContext* browser_context,
311 std::set<std::string>* displayed_notifications) { 311 std::set<std::string>* displayed_notifications) {
312 DCHECK(displayed_notifications); 312 DCHECK(displayed_notifications);
313 313
314 #if !defined(OS_ANDROID) 314 #if !defined(OS_ANDROID)
315 Profile* profile = Profile::FromBrowserContext(browser_context); 315 Profile* profile = Profile::FromBrowserContext(browser_context);
316 if (!profile || profile->AsTestingProfile()) 316 if (!profile || profile->AsTestingProfile())
317 return false; // Tests will not have a message center. 317 return false; // Tests will not have a message center.
318 318
319 // TODO(peter): Filter for persistent notifications only. 319 // TODO(peter): Filter for persistent notifications only.
320 *displayed_notifications = 320 *displayed_notifications = GetNotificationUIManager()->GetAllIdsByProfile(
321 GetNotificationUIManager()->GetAllIdsByProfile(profile); 321 NotificationUIManager::GetProfileID(profile));
322 322
323 return true; 323 return true;
324 #else 324 #else
325 // Android cannot reliably return the notifications that are currently being 325 // Android cannot reliably return the notifications that are currently being
326 // displayed on the platform, see the comment in NotificationUIManagerAndroid. 326 // displayed on the platform, see the comment in NotificationUIManagerAndroid.
327 return false; 327 return false;
328 #endif // !defined(OS_ANDROID) 328 #endif // !defined(OS_ANDROID)
329 } 329 }
330 330
331 Notification PlatformNotificationServiceImpl::CreateNotificationFromData( 331 Notification PlatformNotificationServiceImpl::CreateNotificationFromData(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 formatted_origin.push_back(':'); 407 formatted_origin.push_back(':');
408 formatted_origin.append(base::UTF8ToUTF16(origin.port())); 408 formatted_origin.append(base::UTF8ToUTF16(origin.port()));
409 } 409 }
410 return formatted_origin; 410 return formatted_origin;
411 } 411 }
412 412
413 // TODO(dewittj): Once file:// URLs are passed in to the origin 413 // TODO(dewittj): Once file:// URLs are passed in to the origin
414 // GURL here, begin returning the path as the display name. 414 // GURL here, begin returning the path as the display name.
415 return net::FormatUrl(origin, languages); 415 return net::FormatUrl(origin, languages);
416 } 416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698