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

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

Issue 356543003: Audit the last usage of Geolocation and Notification permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Jam nits. Created 6 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 CONTENT_SETTING_DEFAULT); 474 CONTENT_SETTING_DEFAULT);
475 } 475 }
476 476
477 void DesktopNotificationService::ResetAllOrigins() { 477 void DesktopNotificationService::ResetAllOrigins() {
478 profile_->GetHostContentSettingsMap()->ClearSettingsForOneType( 478 profile_->GetHostContentSettingsMap()->ClearSettingsForOneType(
479 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); 479 CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
480 } 480 }
481 481
482 ContentSetting DesktopNotificationService::GetContentSetting( 482 ContentSetting DesktopNotificationService::GetContentSetting(
483 const GURL& origin) { 483 const GURL& origin) {
484 return profile_->GetHostContentSettingsMap()->GetContentSetting( 484 return profile_->GetHostContentSettingsMap()
485 origin, 485 ->GetContentSettingAndMaybeUpdateLastUsage(
486 origin, 486 origin,
487 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 487 origin,
488 NO_RESOURCE_IDENTIFIER); 488 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
489 NO_RESOURCE_IDENTIFIER);
489 } 490 }
490 491
491 void DesktopNotificationService::RequestPermission( 492 void DesktopNotificationService::RequestPermission(
492 const GURL& origin, 493 const GURL& origin,
493 content::RenderFrameHost* render_frame_host, 494 content::RenderFrameHost* render_frame_host,
494 const base::Closure& callback) { 495 const base::Closure& callback) {
495 // If |origin| hasn't been seen before and the default content setting for 496 // If |origin| hasn't been seen before and the default content setting for
496 // notifications is "ask", show an infobar. 497 // notifications is "ask", show an infobar.
497 // The cache can only answer queries on the IO thread once it's initialized, 498 // The cache can only answer queries on the IO thread once it's initialized,
498 // so don't ask the cache. 499 // so don't ask the cache.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // Tell the IO thread that this extension's permission for notifications 730 // Tell the IO thread that this extension's permission for notifications
730 // has changed. 731 // has changed.
731 extensions::InfoMap* extension_info_map = 732 extensions::InfoMap* extension_info_map =
732 extensions::ExtensionSystem::Get(profile_)->info_map(); 733 extensions::ExtensionSystem::Get(profile_)->info_map();
733 BrowserThread::PostTask( 734 BrowserThread::PostTask(
734 BrowserThread::IO, FROM_HERE, 735 BrowserThread::IO, FROM_HERE,
735 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 736 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
736 extension_info_map, notifier_id.id, !enabled)); 737 extension_info_map, notifier_id.id, !enabled));
737 #endif 738 #endif
738 } 739 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698