OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/content_settings/content_settings_details.h" | 10 #include "chrome/browser/content_settings/content_settings_details.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 return profile_->GetHostContentSettingsMap()->IsDefaultContentSettingManaged( | 287 return profile_->GetHostContentSettingsMap()->IsDefaultContentSettingManaged( |
288 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 288 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
289 } | 289 } |
290 | 290 |
291 void DesktopNotificationService::ResetToDefaultContentSetting() { | 291 void DesktopNotificationService::ResetToDefaultContentSetting() { |
292 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting( | 292 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting( |
293 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_DEFAULT); | 293 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_DEFAULT); |
294 } | 294 } |
295 | 295 |
296 void DesktopNotificationService::GetNotificationsSettings( | 296 void DesktopNotificationService::GetNotificationsSettings( |
297 HostContentSettingsMap::SettingsForOneType* settings) { | 297 ContentSettingsForOneType* settings) { |
298 profile_->GetHostContentSettingsMap()->GetSettingsForOneType( | 298 profile_->GetHostContentSettingsMap()->GetSettingsForOneType( |
299 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 299 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
300 NO_RESOURCE_IDENTIFIER, | 300 NO_RESOURCE_IDENTIFIER, |
| 301 content_settings::ProviderInterface::Rule::LexicographicalSort, |
301 settings); | 302 settings); |
302 } | 303 } |
303 | 304 |
304 void DesktopNotificationService::ClearSetting( | 305 void DesktopNotificationService::ClearSetting( |
305 const ContentSettingsPattern& pattern) { | 306 const ContentSettingsPattern& pattern) { |
306 profile_->GetHostContentSettingsMap()->SetContentSetting( | 307 profile_->GetHostContentSettingsMap()->SetContentSetting( |
307 pattern, | 308 pattern, |
308 ContentSettingsPattern::Wildcard(), | 309 ContentSettingsPattern::Wildcard(), |
309 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 310 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
310 NO_RESOURCE_IDENTIFIER, | 311 NO_RESOURCE_IDENTIFIER, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 432 |
432 if (setting == CONTENT_SETTING_ALLOW) | 433 if (setting == CONTENT_SETTING_ALLOW) |
433 return WebKit::WebNotificationPresenter::PermissionAllowed; | 434 return WebKit::WebNotificationPresenter::PermissionAllowed; |
434 if (setting == CONTENT_SETTING_BLOCK) | 435 if (setting == CONTENT_SETTING_BLOCK) |
435 return WebKit::WebNotificationPresenter::PermissionDenied; | 436 return WebKit::WebNotificationPresenter::PermissionDenied; |
436 if (setting == CONTENT_SETTING_ASK) | 437 if (setting == CONTENT_SETTING_ASK) |
437 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 438 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
438 NOTREACHED() << "Invalid notifications settings value: " << setting; | 439 NOTREACHED() << "Invalid notifications settings value: " << setting; |
439 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 440 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
440 } | 441 } |
OLD | NEW |