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

Side by Side Diff: chrome/browser/ui/android/page_info/page_info_popup_android.cc

Issue 2874073002: [subresource_filter] Always display the default setting in Android Page Info (Closed)
Patch Set: Created 3 years, 7 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/android/page_info/page_info_popup_android.h" 5 #include "chrome/browser/ui/android/page_info/page_info_popup_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 NOTIMPLEMENTED(); 101 NOTIMPLEMENTED();
102 } 102 }
103 103
104 void PageInfoPopupAndroid::SetPermissionInfo( 104 void PageInfoPopupAndroid::SetPermissionInfo(
105 const PermissionInfoList& permission_info_list, 105 const PermissionInfoList& permission_info_list,
106 ChosenObjectInfoList chosen_object_info_list) { 106 ChosenObjectInfoList chosen_object_info_list) {
107 JNIEnv* env = base::android::AttachCurrentThread(); 107 JNIEnv* env = base::android::AttachCurrentThread();
108 108
109 // On Android, we only want to display a subset of the available options in a 109 // On Android, we only want to display a subset of the available options in a
110 // particular order, but only if their value is different from the default. 110 // particular order, but only if their value is different from the default.
111 // This order comes from https://crbug.com/610358.
111 std::vector<ContentSettingsType> permissions_to_display; 112 std::vector<ContentSettingsType> permissions_to_display;
112 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION); 113 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION);
113 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 114 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
114 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 115 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
115 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); 116 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
116 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_IMAGES); 117 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_IMAGES);
117 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_JAVASCRIPT); 118 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_JAVASCRIPT);
118 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_POPUPS); 119 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_POPUPS);
120 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER);
119 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_AUTOPLAY); 121 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_AUTOPLAY);
raymes 2017/05/11 00:09:42 Hmm, not sure I understand. I don't see autoplay o
Charlie Harrison 2017/05/11 00:15:34 Sorry, the bug links to a document with all the re
raymes 2017/05/11 00:32:46 Ah I see, thanks.
120 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER);
121 122
122 std::map<ContentSettingsType, ContentSetting> 123 std::map<ContentSettingsType, ContentSetting>
123 user_specified_settings_to_display; 124 user_specified_settings_to_display;
124 125
125 for (const auto& permission : permission_info_list) { 126 for (const auto& permission : permission_info_list) {
126 if (base::ContainsValue(permissions_to_display, permission.type)) { 127 if (base::ContainsValue(permissions_to_display, permission.type)) {
127 if (permission.setting != CONTENT_SETTING_DEFAULT) { 128 if (permission.setting != CONTENT_SETTING_DEFAULT) {
128 user_specified_settings_to_display[permission.type] = 129 user_specified_settings_to_display[permission.type] =
129 permission.setting; 130 permission.setting;
130 } else if (permission.type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { 131 } else if (permission.type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
131 if (search_geolocation_service_ && 132 if (search_geolocation_service_ &&
132 search_geolocation_service_->UseDSEGeolocationSetting( 133 search_geolocation_service_->UseDSEGeolocationSetting(
133 url::Origin(url_))) { 134 url::Origin(url_))) {
134 user_specified_settings_to_display[permission.type] = 135 user_specified_settings_to_display[permission.type] =
135 search_geolocation_service_->GetDSEGeolocationSetting() 136 search_geolocation_service_->GetDSEGeolocationSetting()
136 ? CONTENT_SETTING_ALLOW 137 ? CONTENT_SETTING_ALLOW
137 : CONTENT_SETTING_BLOCK; 138 : CONTENT_SETTING_BLOCK;
138 } 139 }
140 } else if (permission.type == CONTENT_SETTINGS_TYPE_SUBRESOURCE_FILTER) {
141 // The subresource filter permission should always display the default
142 // setting, if it is showing up in Page Info. Logic for whether the
143 // setting should show up in Page Info is in ShouldShowPermission in
144 // page_info.cc.
145 user_specified_settings_to_display[permission.type] =
146 permission.default_setting;
raymes 2017/05/11 00:09:42 Not quite sure I understand this either? Shouldn't
Charlie Harrison 2017/05/11 00:15:34 That's what I'm attempting to do :) As far as I u
raymes 2017/05/11 00:32:46 Ah I see - thanks. It's quite subtle and I'm not s
139 } 147 }
140 } 148 }
141 } 149 }
142 150
143 for (const auto& permission : permissions_to_display) { 151 for (const auto& permission : permissions_to_display) {
144 if (base::ContainsKey(user_specified_settings_to_display, permission)) { 152 if (base::ContainsKey(user_specified_settings_to_display, permission)) {
145 base::string16 setting_title = 153 base::string16 setting_title =
146 PageInfoUI::PermissionTypeToUIString(permission); 154 PageInfoUI::PermissionTypeToUIString(permission);
147 155
148 Java_PageInfoPopup_addPermissionSection( 156 Java_PageInfoPopup_addPermissionSection(
(...skipping 13 matching lines...) Expand all
162 static_cast<jint>(CONTENT_SETTING_ALLOW)); 170 static_cast<jint>(CONTENT_SETTING_ALLOW));
163 } 171 }
164 172
165 Java_PageInfoPopup_updatePermissionDisplay(env, popup_jobject_); 173 Java_PageInfoPopup_updatePermissionDisplay(env, popup_jobject_);
166 } 174 }
167 175
168 // static 176 // static
169 bool PageInfoPopupAndroid::RegisterPageInfoPopupAndroid(JNIEnv* env) { 177 bool PageInfoPopupAndroid::RegisterPageInfoPopupAndroid(JNIEnv* env) {
170 return RegisterNativesImpl(env); 178 return RegisterNativesImpl(env);
171 } 179 }
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