OLD | NEW |
---|---|
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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 const GURL& origin, | 505 const GURL& origin, |
506 content::RenderFrameHost* render_frame_host, | 506 content::RenderFrameHost* render_frame_host, |
507 const base::Closure& callback) { | 507 const base::Closure& callback) { |
508 // If |origin| hasn't been seen before and the default content setting for | 508 // If |origin| hasn't been seen before and the default content setting for |
509 // notifications is "ask", show an infobar. | 509 // notifications is "ask", show an infobar. |
510 // The cache can only answer queries on the IO thread once it's initialized, | 510 // The cache can only answer queries on the IO thread once it's initialized, |
511 // so don't ask the cache. | 511 // so don't ask the cache. |
512 WebContents* web_contents = WebContents::FromRenderFrameHost( | 512 WebContents* web_contents = WebContents::FromRenderFrameHost( |
513 render_frame_host); | 513 render_frame_host); |
514 ContentSetting setting = GetContentSetting(origin); | 514 ContentSetting setting = GetContentSetting(origin); |
515 | |
516 if (setting == CONTENT_SETTING_ALLOW) { | |
dewittj
2014/06/26 23:17:47
I wonder if this would be better done in ChromeCon
dewittj
2014/06/27 02:52:03
In other words, I'm wary of a special exception ri
Daniel Nishi
2014/06/27 17:25:19
I've moved this into the HostContentSettingsMap to
| |
517 profile_->GetHostContentSettingsMap()->UpdateLastUsage( | |
518 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | |
519 } | |
520 | |
515 if (setting == CONTENT_SETTING_ASK) { | 521 if (setting == CONTENT_SETTING_ASK) { |
516 if (PermissionBubbleManager::Enabled()) { | 522 if (PermissionBubbleManager::Enabled()) { |
517 PermissionBubbleManager* bubble_manager = | 523 PermissionBubbleManager* bubble_manager = |
518 PermissionBubbleManager::FromWebContents(web_contents); | 524 PermissionBubbleManager::FromWebContents(web_contents); |
519 if (bubble_manager) { | 525 if (bubble_manager) { |
520 bubble_manager->AddRequest(new NotificationPermissionRequest( | 526 bubble_manager->AddRequest(new NotificationPermissionRequest( |
521 this, | 527 this, |
522 origin, | 528 origin, |
523 DisplayNameForOriginInProcessId( | 529 DisplayNameForOriginInProcessId( |
524 origin, render_frame_host->GetProcess()->GetID()), | 530 origin, render_frame_host->GetProcess()->GetID()), |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
752 // Tell the IO thread that this extension's permission for notifications | 758 // Tell the IO thread that this extension's permission for notifications |
753 // has changed. | 759 // has changed. |
754 extensions::InfoMap* extension_info_map = | 760 extensions::InfoMap* extension_info_map = |
755 extensions::ExtensionSystem::Get(profile_)->info_map(); | 761 extensions::ExtensionSystem::Get(profile_)->info_map(); |
756 BrowserThread::PostTask( | 762 BrowserThread::PostTask( |
757 BrowserThread::IO, FROM_HERE, | 763 BrowserThread::IO, FROM_HERE, |
758 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 764 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
759 extension_info_map, notifier_id.id, !enabled)); | 765 extension_info_map, notifier_id.id, !enabled)); |
760 #endif | 766 #endif |
761 } | 767 } |
OLD | NEW |