OLD | NEW |
---|---|
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_uma_util.h" | 7 #include "chrome/browser/permissions/permission_uma_util.h" |
8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
10 #include "components/url_formatter/elide_url.h" | 10 #include "components/url_formatter/elide_url.h" |
11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
12 | 12 |
13 PermissionInfobarDelegate::~PermissionInfobarDelegate() { | 13 PermissionInfobarDelegate::~PermissionInfobarDelegate() { |
14 // TODO(stefanocs): Pass the actual user_gesture value to PermissionUmaUtil. | |
15 if (!action_taken_) | 14 if (!action_taken_) |
raymes
2016/07/19 05:25:30
nit: add {}
stefanocs
2016/07/19 07:45:27
Done.
| |
16 PermissionUmaUtil::PermissionIgnored(permission_type_, | 15 PermissionUmaUtil::PermissionIgnored(permission_type_, user_gesture_, |
17 false /* user_gesture */, | |
18 requesting_origin_, profile_); | 16 requesting_origin_, profile_); |
19 } | 17 } |
20 | 18 |
21 PermissionInfobarDelegate::PermissionInfobarDelegate( | 19 PermissionInfobarDelegate::PermissionInfobarDelegate( |
22 const GURL& requesting_origin, | 20 const GURL& requesting_origin, |
23 content::PermissionType permission_type, | 21 content::PermissionType permission_type, |
24 ContentSettingsType content_settings_type, | 22 ContentSettingsType content_settings_type, |
23 bool user_gesture, | |
25 Profile* profile, | 24 Profile* profile, |
26 const base::Callback<void(bool, bool)>& callback) | 25 const base::Callback<void(bool, bool)>& callback) |
27 : requesting_origin_(requesting_origin), | 26 : requesting_origin_(requesting_origin), |
28 action_taken_(false), | 27 action_taken_(false), |
29 permission_type_(permission_type), | 28 permission_type_(permission_type), |
30 content_settings_type_(content_settings_type), | 29 content_settings_type_(content_settings_type), |
30 user_gesture_(user_gesture), | |
31 profile_(profile), | 31 profile_(profile), |
32 callback_(callback) {} | 32 callback_(callback) {} |
33 | 33 |
34 base::string16 PermissionInfobarDelegate::GetMessageText() const { | 34 base::string16 PermissionInfobarDelegate::GetMessageText() const { |
35 return l10n_util::GetStringFUTF16( | 35 return l10n_util::GetStringFUTF16( |
36 GetMessageResourceId(), | 36 GetMessageResourceId(), |
37 url_formatter::FormatUrlForSecurityDisplay( | 37 url_formatter::FormatUrlForSecurityDisplay( |
38 requesting_origin_, | 38 requesting_origin_, |
39 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); | 39 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); |
40 } | 40 } |
(...skipping 26 matching lines...) Expand all Loading... | |
67 bool PermissionInfobarDelegate::Cancel() { | 67 bool PermissionInfobarDelegate::Cancel() { |
68 SetPermission(true, false); | 68 SetPermission(true, false); |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, | 72 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, |
73 bool allowed) { | 73 bool allowed) { |
74 action_taken_ = true; | 74 action_taken_ = true; |
75 callback_.Run(update_content_setting, allowed); | 75 callback_.Run(update_content_setting, allowed); |
76 } | 76 } |
OLD | NEW |