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

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

Issue 2415863002: Use PermissionType instead of ContentSettingsType in Android permission infobars (Closed)
Patch Set: Merge branch 'master' into use_permission_type_for_infobar Created 4 years, 2 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_decision_auto_blocker.h" 7 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
8 #include "chrome/browser/permissions/permission_request.h" 8 #include "chrome/browser/permissions/permission_request.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 9 #include "chrome/browser/permissions/permission_uma_util.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.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 if (!action_taken_) { 15 if (!action_taken_) {
16 PermissionUmaUtil::PermissionIgnored( 16 PermissionUmaUtil::PermissionIgnored(
17 permission_type_, 17 permission_type_,
18 user_gesture_ ? PermissionRequestGestureType::GESTURE 18 user_gesture_ ? PermissionRequestGestureType::GESTURE
19 : PermissionRequestGestureType::NO_GESTURE, 19 : PermissionRequestGestureType::NO_GESTURE,
20 requesting_origin_, profile_); 20 requesting_origin_, profile_);
21 } 21 }
22 } 22 }
23 23
24 PermissionInfoBarDelegate::PermissionInfoBarDelegate( 24 PermissionInfoBarDelegate::PermissionInfoBarDelegate(
25 const GURL& requesting_origin, 25 const GURL& requesting_origin,
26 content::PermissionType permission_type, 26 content::PermissionType permission_type,
27 ContentSettingsType content_settings_type,
28 bool user_gesture, 27 bool user_gesture,
29 Profile* profile, 28 Profile* profile,
30 const PermissionSetCallback& callback) 29 const PermissionSetCallback& callback)
31 : requesting_origin_(requesting_origin), 30 : requesting_origin_(requesting_origin),
32 permission_type_(permission_type), 31 permission_type_(permission_type),
33 content_settings_type_(content_settings_type),
34 profile_(profile), 32 profile_(profile),
35 callback_(callback), 33 callback_(callback),
36 action_taken_(false), 34 action_taken_(false),
37 user_gesture_(user_gesture), 35 user_gesture_(user_gesture),
38 persist_(true) {} 36 persist_(true) {}
39 37
40 std::vector<int> PermissionInfoBarDelegate::content_settings() const { 38 std::vector<int> PermissionInfoBarDelegate::permission_types() const {
41 return std::vector<int>{content_settings_type_}; 39 return std::vector<int>{static_cast<int>(permission_type_)};
42 } 40 }
43 41
44 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const { 42 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const {
45 return (permission_type_ == content::PermissionType::GEOLOCATION || 43 return (permission_type_ == content::PermissionType::GEOLOCATION ||
46 permission_type_ == content::PermissionType::AUDIO_CAPTURE || 44 permission_type_ == content::PermissionType::AUDIO_CAPTURE ||
47 permission_type_ == content::PermissionType::VIDEO_CAPTURE) && 45 permission_type_ == content::PermissionType::VIDEO_CAPTURE) &&
48 PermissionUtil::ShouldShowPersistenceToggle(); 46 PermissionUtil::ShouldShowPersistenceToggle();
49 } 47 }
50 48
51 base::string16 PermissionInfoBarDelegate::GetMessageText() const { 49 base::string16 PermissionInfoBarDelegate::GetMessageText() const {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 96
99 SetPermission(update_content_setting, DENIED); 97 SetPermission(update_content_setting, DENIED);
100 return true; 98 return true;
101 } 99 }
102 100
103 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, 101 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting,
104 PermissionAction decision) { 102 PermissionAction decision) {
105 action_taken_ = true; 103 action_taken_ = true;
106 callback_.Run(update_content_setting, decision); 104 callback_.Run(update_content_setting, decision);
107 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698