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

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

Issue 2909453002: Support persist toggle in PermissionRequestManager path on Android (Closed)
Patch Set: rebase Created 3 years, 6 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 <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 PermissionUmaUtil::RecordEmbargoStatus(embargo_status); 90 PermissionUmaUtil::RecordEmbargoStatus(embargo_status);
91 } 91 }
92 } 92 }
93 93
94 std::vector<int> PermissionInfoBarDelegate::content_settings_types() const { 94 std::vector<int> PermissionInfoBarDelegate::content_settings_types() const {
95 return std::vector<int>{content_settings_type_}; 95 return std::vector<int>{content_settings_type_};
96 } 96 }
97 97
98 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const { 98 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const {
99 return (content_settings_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION || 99 return PermissionUtil::ShouldShowPersistenceToggle(content_settings_type_);
100 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
101 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) &&
102 PermissionUtil::ShouldShowPersistenceToggle();
103 } 100 }
104 101
105 bool PermissionInfoBarDelegate::Accept() { 102 bool PermissionInfoBarDelegate::Accept() {
106 bool update_content_setting = true; 103 bool update_content_setting = true;
107 if (ShouldShowPersistenceToggle()) { 104 if (ShouldShowPersistenceToggle()) {
108 update_content_setting = persist_; 105 update_content_setting = persist_;
109 PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle( 106 PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle(
110 content_settings_type_, persist_); 107 content_settings_type_, persist_);
111 } 108 }
112 109
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 PermissionInfoBarDelegate* 163 PermissionInfoBarDelegate*
167 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { 164 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() {
168 return this; 165 return this;
169 } 166 }
170 167
171 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, 168 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting,
172 PermissionAction decision) { 169 PermissionAction decision) {
173 action_taken_ = true; 170 action_taken_ = true;
174 callback_.Run(update_content_setting, decision); 171 callback_.Run(update_content_setting, decision);
175 } 172 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_dialog_delegate.cc ('k') | chrome/browser/permissions/permission_prompt_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698