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

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

Issue 1843063002: Don't show scheme in permission prompts if it is HTTPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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_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 "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
11 12
12 PermissionInfobarDelegate::~PermissionInfobarDelegate() { 13 PermissionInfobarDelegate::~PermissionInfobarDelegate() {
13 if (!action_taken_) 14 if (!action_taken_)
14 PermissionUmaUtil::PermissionIgnored(permission_type_, requesting_origin_); 15 PermissionUmaUtil::PermissionIgnored(permission_type_, requesting_origin_);
15 } 16 }
16 17
17 PermissionInfobarDelegate::PermissionInfobarDelegate( 18 PermissionInfobarDelegate::PermissionInfobarDelegate(
18 const GURL& requesting_origin, 19 const GURL& requesting_origin,
19 content::PermissionType permission_type, 20 content::PermissionType permission_type,
20 ContentSettingsType content_settings_type, 21 ContentSettingsType content_settings_type,
21 const base::Callback<void(bool, bool)>& callback) 22 const base::Callback<void(bool, bool)>& callback)
22 : requesting_origin_(requesting_origin), 23 : requesting_origin_(requesting_origin),
23 action_taken_(false), 24 action_taken_(false),
24 permission_type_(permission_type), 25 permission_type_(permission_type),
25 content_settings_type_(content_settings_type), 26 content_settings_type_(content_settings_type),
26 callback_(callback) {} 27 callback_(callback) {}
27 28
28 infobars::InfoBarDelegate::Type 29 base::string16 PermissionInfobarDelegate::GetMessageText() const {
29 PermissionInfobarDelegate::GetInfoBarType() const { 30 return l10n_util::GetStringFUTF16(
31 GetMessageResourceId(),
32 url_formatter::FormatUrlForSecurityDisplay(
33 requesting_origin_,
34 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
35 }
36
37 infobars::InfoBarDelegate::Type PermissionInfobarDelegate::GetInfoBarType()
38 const {
30 return PAGE_ACTION_TYPE; 39 return PAGE_ACTION_TYPE;
31 } 40 }
32 41
33 void PermissionInfobarDelegate::InfoBarDismissed() { 42 void PermissionInfobarDelegate::InfoBarDismissed() {
34 SetPermission(false, false); 43 SetPermission(false, false);
35 } 44 }
36 45
37 PermissionInfobarDelegate* 46 PermissionInfobarDelegate*
38 PermissionInfobarDelegate::AsPermissionInfobarDelegate() { 47 PermissionInfobarDelegate::AsPermissionInfobarDelegate() {
39 return this; 48 return this;
(...skipping 13 matching lines...) Expand all
53 bool PermissionInfobarDelegate::Cancel() { 62 bool PermissionInfobarDelegate::Cancel() {
54 SetPermission(true, false); 63 SetPermission(true, false);
55 return true; 64 return true;
56 } 65 }
57 66
58 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, 67 void PermissionInfobarDelegate::SetPermission(bool update_content_setting,
59 bool allowed) { 68 bool allowed) {
60 action_taken_ = true; 69 action_taken_ = true;
61 callback_.Run(update_content_setting, allowed); 70 callback_.Run(update_content_setting, allowed);
62 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698