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

Side by Side Diff: chrome/browser/permissions/permission_util.cc

Issue 2250053002: Clean up the PermissionInfoBarDelegate hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-infobar-remember-decision
Patch Set: Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_util.h" 5 #include "chrome/browser/permissions/permission_util.h"
6 6
7 #include "base/feature_list.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 10 #include "chrome/browser/permissions/permission_uma_util.h"
11 #include "chrome/common/chrome_features.h"
10 #include "components/content_settings/core/browser/host_content_settings_map.h" 12 #include "components/content_settings/core/browser/host_content_settings_map.h"
11 #include "content/public/browser/permission_type.h" 13 #include "content/public/browser/permission_type.h"
12 14
13 using content::PermissionType; 15 using content::PermissionType;
14 16
15 std::size_t PermissionTypeHash::operator()( 17 std::size_t PermissionTypeHash::operator()(
16 const content::PermissionType& type) const { 18 const content::PermissionType& type) const {
17 return static_cast<size_t>(type); 19 return static_cast<size_t>(type);
18 } 20 }
19 21
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 71 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
70 } else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) { 72 } else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) {
71 *out = PermissionType::PROTECTED_MEDIA_IDENTIFIER; 73 *out = PermissionType::PROTECTED_MEDIA_IDENTIFIER;
72 #endif 74 #endif
73 } else { 75 } else {
74 return false; 76 return false;
75 } 77 }
76 return true; 78 return true;
77 } 79 }
78 80
81 bool PermissionUtil::ShouldShowPersistenceToggle() {
82 return base::FeatureList::IsEnabled(
83 features::kDisplayPersistenceToggleInPermissionPrompts);
84 }
85
79 PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter( 86 PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter(
80 Profile* profile, 87 Profile* profile,
81 const GURL& primary_url, 88 const GURL& primary_url,
82 const GURL& secondary_url, 89 const GURL& secondary_url,
83 ContentSettingsType content_type, 90 ContentSettingsType content_type,
84 PermissionSourceUI source_ui) 91 PermissionSourceUI source_ui)
85 : profile_(profile), 92 : profile_(profile),
86 primary_url_(primary_url), 93 primary_url_(primary_url),
87 secondary_url_(secondary_url), 94 secondary_url_(secondary_url),
88 content_type_(content_type), 95 content_type_(content_type),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ContentSetting final_content_setting = settings_map->GetContentSetting( 129 ContentSetting final_content_setting = settings_map->GetContentSetting(
123 primary_url_, secondary_url_, content_type_, std::string()); 130 primary_url_, secondary_url_, content_type_, std::string());
124 if (final_content_setting != CONTENT_SETTING_ALLOW) { 131 if (final_content_setting != CONTENT_SETTING_ALLOW) {
125 PermissionType permission_type; 132 PermissionType permission_type;
126 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) { 133 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) {
127 PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_, 134 PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_,
128 primary_url_, profile_); 135 primary_url_, profile_);
129 } 136 }
130 } 137 }
131 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698