Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_decision_auto_blocker.h" | 5 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 return GetActionCount(url, permission, kPromptIgnoreCountKey, profile_); | 273 return GetActionCount(url, permission, kPromptIgnoreCountKey, profile_); |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool PermissionDecisionAutoBlocker::RecordDismissAndEmbargo( | 276 bool PermissionDecisionAutoBlocker::RecordDismissAndEmbargo( |
| 277 const GURL& url, | 277 const GURL& url, |
| 278 ContentSettingsType permission) { | 278 ContentSettingsType permission) { |
| 279 int current_dismissal_count = RecordActionInWebsiteSettings( | 279 int current_dismissal_count = RecordActionInWebsiteSettings( |
| 280 url, permission, kPromptDismissCountKey, profile_); | 280 url, permission, kPromptDismissCountKey, profile_); |
| 281 | 281 |
| 282 if (base::FeatureList::IsEnabled(features::kBlockPromptsIfDismissedOften) && | 282 if (base::FeatureList::IsEnabled(features::kBlockPromptsIfDismissedOften) && |
| 283 permission != CONTENT_SETTINGS_TYPE_PLUGINS && | |
|
benwells
2017/03/23 04:39:25
I think it would be cleaner to place this in Permi
dominickn
2017/03/23 04:45:22
That would mean also placing the logic in Permissi
| |
| 283 current_dismissal_count >= g_prompt_dismissals_before_block) { | 284 current_dismissal_count >= g_prompt_dismissals_before_block) { |
| 284 PlaceUnderEmbargo(url, permission, kPermissionDismissalEmbargoKey); | 285 PlaceUnderEmbargo(url, permission, kPermissionDismissalEmbargoKey); |
| 285 return true; | 286 return true; |
| 286 } | 287 } |
| 287 return false; | 288 return false; |
| 288 } | 289 } |
| 289 | 290 |
| 290 int PermissionDecisionAutoBlocker::RecordIgnore( | 291 int PermissionDecisionAutoBlocker::RecordIgnore( |
| 291 const GURL& url, | 292 const GURL& url, |
| 292 ContentSettingsType permission) { | 293 ContentSettingsType permission) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager, | 364 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager, |
| 364 int timeout) { | 365 int timeout) { |
| 365 db_manager_ = db_manager; | 366 db_manager_ = db_manager; |
| 366 safe_browsing_timeout_ = timeout; | 367 safe_browsing_timeout_ = timeout; |
| 367 } | 368 } |
| 368 | 369 |
| 369 void PermissionDecisionAutoBlocker::SetClockForTesting( | 370 void PermissionDecisionAutoBlocker::SetClockForTesting( |
| 370 std::unique_ptr<base::Clock> clock) { | 371 std::unique_ptr<base::Clock> clock) { |
| 371 clock_ = std::move(clock); | 372 clock_ = std::move(clock); |
| 372 } | 373 } |
| OLD | NEW |