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

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

Issue 2807093002: Fix the Update Permissions infobar for geolocation. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_update_infobar_delegate_android. h" 5 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/jni_array.h" 9 #include "base/android/jni_array.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 29 matching lines...) Expand all
40 int message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT; 40 int message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
41 41
42 for (ContentSettingsType content_settings_type : content_settings_types) { 42 for (ContentSettingsType content_settings_type : content_settings_types) {
43 int previous_size = permissions.size(); 43 int previous_size = permissions.size();
44 PrefServiceBridge::GetAndroidPermissionsForContentSetting( 44 PrefServiceBridge::GetAndroidPermissionsForContentSetting(
45 content_settings_type, &permissions); 45 content_settings_type, &permissions);
46 46
47 if (missing_permission_count > 1) 47 if (missing_permission_count > 1)
48 continue; 48 continue;
49 49
50 bool has_all_permissions = true;
50 for (auto it = permissions.begin() + previous_size; it != permissions.end(); 51 for (auto it = permissions.begin() + previous_size; it != permissions.end();
51 ++it) { 52 ++it) {
52 if (window_android->HasPermission(*it)) 53 has_all_permissions &= window_android->HasPermission(*it);
53 continue; 54 }
54 55
56 if (!has_all_permissions) {
55 missing_permission_count++; 57 missing_permission_count++;
56 if (missing_permission_count > 1) { 58 if (missing_permission_count > 1) {
57 message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT; 59 message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
58 } else if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { 60 } else if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
59 message_id = IDS_INFOBAR_MISSING_LOCATION_PERMISSION_TEXT; 61 message_id = IDS_INFOBAR_MISSING_LOCATION_PERMISSION_TEXT;
60 } else if (content_settings_type == 62 } else if (content_settings_type ==
61 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { 63 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
62 message_id = IDS_INFOBAR_MISSING_MICROPHONE_PERMISSION_TEXT; 64 message_id = IDS_INFOBAR_MISSING_MICROPHONE_PERMISSION_TEXT;
63 } else if (content_settings_type == 65 } else if (content_settings_type ==
64 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { 66 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 186 }
185 187
186 bool PermissionUpdateInfoBarDelegate::Cancel() { 188 bool PermissionUpdateInfoBarDelegate::Cancel() {
187 base::ResetAndReturn(&callback_).Run(false); 189 base::ResetAndReturn(&callback_).Run(false);
188 return true; 190 return true;
189 } 191 }
190 192
191 void PermissionUpdateInfoBarDelegate::InfoBarDismissed() { 193 void PermissionUpdateInfoBarDelegate::InfoBarDismissed() {
192 base::ResetAndReturn(&callback_).Run(false); 194 base::ResetAndReturn(&callback_).Run(false);
193 } 195 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698