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

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

Issue 2726853007: Views/Permissions: Update desktop UI to display BLOCK for embargoed permissions. (Closed)
Patch Set: Created 3 years, 9 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 "build/build_config.h" 7 #include "build/build_config.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 128 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
129 } else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) { 129 } else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) {
130 *out = PermissionType::PROTECTED_MEDIA_IDENTIFIER; 130 *out = PermissionType::PROTECTED_MEDIA_IDENTIFIER;
131 #endif 131 #endif
132 } else { 132 } else {
133 return false; 133 return false;
134 } 134 }
135 return true; 135 return true;
136 } 136 }
137 137
138 bool PermissionUtil::IsPermission(ContentSettingsType type) {
139 switch (type) {
140 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
141 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
142 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
143 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
144 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE:
145 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
146 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
147 case CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC:
148 case CONTENT_SETTINGS_TYPE_PLUGINS:
149 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
150 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
151 #endif
152 return true;
153 default:
154 return false;
155 }
156 }
157
138 bool PermissionUtil::ShouldShowPersistenceToggle() { 158 bool PermissionUtil::ShouldShowPersistenceToggle() {
139 return base::FeatureList::IsEnabled( 159 return base::FeatureList::IsEnabled(
140 features::kDisplayPersistenceToggleInPermissionPrompts); 160 features::kDisplayPersistenceToggleInPermissionPrompts);
141 } 161 }
142 162
143 PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter( 163 PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter(
144 Profile* profile, 164 Profile* profile,
145 const GURL& primary_url, 165 const GURL& primary_url,
146 const GURL& secondary_url, 166 const GURL& secondary_url,
147 ContentSettingsType content_type, 167 ContentSettingsType content_type,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return; 203 return;
184 HostContentSettingsMap* settings_map = 204 HostContentSettingsMap* settings_map =
185 HostContentSettingsMapFactory::GetForProfile(profile_); 205 HostContentSettingsMapFactory::GetForProfile(profile_);
186 ContentSetting final_content_setting = settings_map->GetContentSetting( 206 ContentSetting final_content_setting = settings_map->GetContentSetting(
187 primary_url_, secondary_url_, content_type_, std::string()); 207 primary_url_, secondary_url_, content_type_, std::string());
188 if (final_content_setting != CONTENT_SETTING_ALLOW) { 208 if (final_content_setting != CONTENT_SETTING_ALLOW) {
189 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, 209 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_,
190 primary_url_, profile_); 210 primary_url_, profile_);
191 } 211 }
192 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698