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

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

Issue 2726493002: Add a console message when a permission is embargoed due to repeated dismissals. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (result.source == PermissionStatusSource::KILL_SWITCH) { 101 if (result.source == PermissionStatusSource::KILL_SWITCH) {
102 // Block the request and log to the developer console. 102 // Block the request and log to the developer console.
103 web_contents->GetMainFrame()->AddMessageToConsole( 103 web_contents->GetMainFrame()->AddMessageToConsole(
104 content::CONSOLE_MESSAGE_LEVEL_INFO, 104 content::CONSOLE_MESSAGE_LEVEL_INFO,
105 base::StringPrintf( 105 base::StringPrintf(
106 "%s permission has been blocked.", 106 "%s permission has been blocked.",
107 PermissionUtil::GetPermissionString(content_settings_type_) 107 PermissionUtil::GetPermissionString(content_settings_type_)
108 .c_str())); 108 .c_str()));
109 callback.Run(CONTENT_SETTING_BLOCK); 109 callback.Run(CONTENT_SETTING_BLOCK);
110 return; 110 return;
111 } else if (result.source == PermissionStatusSource::MULTIPLE_DISMISSALS) {
112 web_contents->GetMainFrame()->AddMessageToConsole(
113 content::CONSOLE_MESSAGE_LEVEL_INFO,
114 base::StringPrintf(
115 "%s permission has been blocked as the user has dismissed the "
116 "permission prompt several times. See "
117 "https://www.chromestatus.com/features/6443143280984064 for more "
118 "information.",
119 PermissionUtil::GetPermissionString(content_settings_type_)
120 .c_str()));
raymes 2017/02/28 23:44:38 nit: it would be nice to get some of this logging
dominickn 2017/03/01 02:28:44 Done.
111 } 121 }
112 122
113 // If we are under embargo, record the embargo reason for which we have 123 // If we are under embargo, record the embargo reason for which we have
114 // suppressed the prompt. 124 // suppressed the prompt.
115 PermissionUmaUtil::RecordEmbargoPromptSuppressionFromSource(result.source); 125 PermissionUmaUtil::RecordEmbargoPromptSuppressionFromSource(result.source);
116 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, 126 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
117 false /* persist */, result.content_setting); 127 false /* persist */, result.content_setting);
118 return; 128 return;
119 } 129 }
120 130
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 content_settings_storage_type(), 392 content_settings_storage_type(),
383 std::string(), content_setting); 393 std::string(), content_setting);
384 } 394 }
385 395
386 ContentSettingsType PermissionContextBase::content_settings_storage_type() 396 ContentSettingsType PermissionContextBase::content_settings_storage_type()
387 const { 397 const {
388 if (content_settings_type_ == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) 398 if (content_settings_type_ == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING)
389 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; 399 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
390 return content_settings_type_; 400 return content_settings_type_;
391 } 401 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698