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

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

Issue 2697473002: Remove last usage functions from HostContentSettingsMap and clean up prefs (Closed)
Patch Set: fix up unit test Created 3 years, 10 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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 #if defined(OS_WIN) 312 #if defined(OS_WIN)
313 std::string profile_id = 313 std::string profile_id =
314 base::WideToUTF8(profile->GetPath().BaseName().value()); 314 base::WideToUTF8(profile->GetPath().BaseName().value());
315 #elif defined(OS_POSIX) 315 #elif defined(OS_POSIX)
316 std::string profile_id = profile->GetPath().BaseName().value(); 316 std::string profile_id = profile->GetPath().BaseName().value();
317 #endif 317 #endif
318 *cancel_callback = 318 *cancel_callback =
319 base::Bind(&CancelNotification, notification.delegate_id(), profile_id, 319 base::Bind(&CancelNotification, notification.delegate_id(), profile_id,
320 profile->IsOffTheRecord()); 320 profile->IsOffTheRecord());
321 } 321 }
322
323 HostContentSettingsMapFactory::GetForProfile(profile)->UpdateLastUsage(
324 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
325 } 322 }
326 323
327 void PlatformNotificationServiceImpl::DisplayPersistentNotification( 324 void PlatformNotificationServiceImpl::DisplayPersistentNotification(
328 BrowserContext* browser_context, 325 BrowserContext* browser_context,
329 const std::string& notification_id, 326 const std::string& notification_id,
330 const GURL& service_worker_scope, 327 const GURL& service_worker_scope,
331 const GURL& origin, 328 const GURL& origin,
332 const content::PlatformNotificationData& notification_data, 329 const content::PlatformNotificationData& notification_data,
333 const content::NotificationResources& notification_resources) { 330 const content::NotificationResources& notification_resources) {
334 DCHECK_CURRENTLY_ON(BrowserThread::UI); 331 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 14 matching lines...) Expand all
349 browser_context, notification_id, origin, settings_button_index); 346 browser_context, notification_id, origin, settings_button_index);
350 347
351 Notification notification = CreateNotificationFromData( 348 Notification notification = CreateNotificationFromData(
352 profile, service_worker_scope, origin, notification_data, 349 profile, service_worker_scope, origin, notification_data,
353 notification_resources, delegate); 350 notification_resources, delegate);
354 351
355 GetNotificationDisplayService(profile)->Display( 352 GetNotificationDisplayService(profile)->Display(
356 NotificationCommon::PERSISTENT, notification_id, notification); 353 NotificationCommon::PERSISTENT, notification_id, notification);
357 content::RecordAction( 354 content::RecordAction(
358 base::UserMetricsAction("Notifications.Persistent.Shown")); 355 base::UserMetricsAction("Notifications.Persistent.Shown"));
359
360 HostContentSettingsMapFactory::GetForProfile(profile)->UpdateLastUsage(
361 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
362 } 356 }
363 357
364 void PlatformNotificationServiceImpl::ClosePersistentNotification( 358 void PlatformNotificationServiceImpl::ClosePersistentNotification(
365 BrowserContext* browser_context, 359 BrowserContext* browser_context,
366 const std::string& notification_id) { 360 const std::string& notification_id) {
367 DCHECK_CURRENTLY_ON(BrowserThread::UI); 361 DCHECK_CURRENTLY_ON(BrowserThread::UI);
368 362
369 Profile* profile = Profile::FromBrowserContext(browser_context); 363 Profile* profile = Profile::FromBrowserContext(browser_context);
370 DCHECK(profile); 364 DCHECK(profile);
371 365
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 } 512 }
519 #endif 513 #endif
520 514
521 return base::string16(); 515 return base::string16();
522 } 516 }
523 517
524 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( 518 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting(
525 NotificationDisplayService* display_service) { 519 NotificationDisplayService* display_service) {
526 test_display_service_ = display_service; 520 test_display_service_ = display_service;
527 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698