| OLD | NEW |
| 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/permissions/permission_context_base.h" | 5 #include "chrome/browser/permissions/permission_context_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 108 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 109 false /* persist */, CONTENT_SETTING_BLOCK); | 109 false /* persist */, CONTENT_SETTING_BLOCK); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Synchronously check the content setting to see if the user has already made | 113 // Synchronously check the content setting to see if the user has already made |
| 114 // a decision, or if the origin is under embargo. If so, respect that | 114 // a decision, or if the origin is under embargo. If so, respect that |
| 115 // decision. | 115 // decision. |
| 116 PermissionResult result = | 116 PermissionResult result = |
| 117 GetPermissionStatus(requesting_origin, embedding_origin); | 117 GetPermissionStatus(requesting_origin, embedding_origin); |
| 118 if (result.content_setting == CONTENT_SETTING_ALLOW) { | |
| 119 HostContentSettingsMapFactory::GetForProfile(profile_)->UpdateLastUsage( | |
| 120 requesting_origin, embedding_origin, content_settings_storage_type()); | |
| 121 } | |
| 122 | 118 |
| 123 if (result.content_setting == CONTENT_SETTING_ALLOW || | 119 if (result.content_setting == CONTENT_SETTING_ALLOW || |
| 124 result.content_setting == CONTENT_SETTING_BLOCK) { | 120 result.content_setting == CONTENT_SETTING_BLOCK) { |
| 125 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 121 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 126 false /* persist */, result.content_setting); | 122 false /* persist */, result.content_setting); |
| 127 return; | 123 return; |
| 128 } | 124 } |
| 129 | 125 |
| 130 // Asynchronously check whether the origin should be blocked from making this | 126 // Asynchronously check whether the origin should be blocked from making this |
| 131 // permission request. It may be on the Safe Browsing API blacklist, or it may | 127 // permission request. It may be on the Safe Browsing API blacklist, or it may |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 content_settings_storage_type(), | 383 content_settings_storage_type(), |
| 388 std::string(), content_setting); | 384 std::string(), content_setting); |
| 389 } | 385 } |
| 390 | 386 |
| 391 ContentSettingsType PermissionContextBase::content_settings_storage_type() | 387 ContentSettingsType PermissionContextBase::content_settings_storage_type() |
| 392 const { | 388 const { |
| 393 if (content_settings_type_ == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) | 389 if (content_settings_type_ == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) |
| 394 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; | 390 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| 395 return content_settings_type_; | 391 return content_settings_type_; |
| 396 } | 392 } |
| OLD | NEW |