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

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

Issue 2154033003: Add gesture type value from infobar to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-user-gesture-from-permission-layer-to-permission-report
Patch Set: nit 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 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_infobar_delegate.h" 5 #include "chrome/browser/permissions/permission_infobar_delegate.h"
6 6
7 #include "chrome/browser/permissions/permission_request.h" 7 #include "chrome/browser/permissions/permission_request.h"
8 #include "chrome/browser/permissions/permission_uma_util.h" 8 #include "chrome/browser/permissions/permission_uma_util.h"
9 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
10 #include "components/infobars/core/infobar.h" 10 #include "components/infobars/core/infobar.h"
11 #include "components/url_formatter/elide_url.h" 11 #include "components/url_formatter/elide_url.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 13
14 PermissionInfobarDelegate::~PermissionInfobarDelegate() { 14 PermissionInfobarDelegate::~PermissionInfobarDelegate() {
15 // TODO(stefanocs): Pass the actual |gesture_type| value to PermissionUmaUtil.
16 if (!action_taken_) { 15 if (!action_taken_) {
17 PermissionUmaUtil::PermissionIgnored(permission_type_, 16 PermissionUmaUtil::PermissionIgnored(
18 PermissionRequestGestureType::UNKNOWN, 17 permission_type_,
19 requesting_origin_, profile_); 18 user_gesture_ ? PermissionRequestGestureType::GESTURE
19 : PermissionRequestGestureType::NO_GESTURE,
20 requesting_origin_, profile_);
20 } 21 }
21 } 22 }
22 23
23 PermissionInfobarDelegate::PermissionInfobarDelegate( 24 PermissionInfobarDelegate::PermissionInfobarDelegate(
24 const GURL& requesting_origin, 25 const GURL& requesting_origin,
25 content::PermissionType permission_type, 26 content::PermissionType permission_type,
26 ContentSettingsType content_settings_type, 27 ContentSettingsType content_settings_type,
28 bool user_gesture,
27 Profile* profile, 29 Profile* profile,
28 const base::Callback<void(bool, bool)>& callback) 30 const base::Callback<void(bool, bool)>& callback)
29 : requesting_origin_(requesting_origin), 31 : requesting_origin_(requesting_origin),
30 action_taken_(false), 32 action_taken_(false),
31 permission_type_(permission_type), 33 permission_type_(permission_type),
32 content_settings_type_(content_settings_type), 34 content_settings_type_(content_settings_type),
35 user_gesture_(user_gesture),
33 profile_(profile), 36 profile_(profile),
34 callback_(callback) {} 37 callback_(callback) {}
35 38
36 base::string16 PermissionInfobarDelegate::GetMessageText() const { 39 base::string16 PermissionInfobarDelegate::GetMessageText() const {
37 return l10n_util::GetStringFUTF16( 40 return l10n_util::GetStringFUTF16(
38 GetMessageResourceId(), 41 GetMessageResourceId(),
39 url_formatter::FormatUrlForSecurityDisplay( 42 url_formatter::FormatUrlForSecurityDisplay(
40 requesting_origin_, 43 requesting_origin_,
41 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); 44 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
42 } 45 }
(...skipping 26 matching lines...) Expand all
69 bool PermissionInfobarDelegate::Cancel() { 72 bool PermissionInfobarDelegate::Cancel() {
70 SetPermission(true, false); 73 SetPermission(true, false);
71 return true; 74 return true;
72 } 75 }
73 76
74 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, 77 void PermissionInfobarDelegate::SetPermission(bool update_content_setting,
75 bool allowed) { 78 bool allowed) {
76 action_taken_ = true; 79 action_taken_ = true;
77 callback_.Run(update_content_setting, allowed); 80 callback_.Run(update_content_setting, allowed);
78 } 81 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_infobar_delegate.h ('k') | chrome/browser/permissions/permission_queue_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698