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

Side by Side Diff: chrome/browser/ui/android/website_settings_popup_android.cc

Issue 2185213002: Display USB devices in the site settings popup on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced code to free chosen objects. Created 4 years, 4 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 (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/website_settings_popup_android.h" 5 #include "chrome/browser/ui/android/website_settings_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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void WebsiteSettingsPopupAndroid::SetCookieInfo( 88 void WebsiteSettingsPopupAndroid::SetCookieInfo(
89 const CookieInfoList& cookie_info_list) { 89 const CookieInfoList& cookie_info_list) {
90 NOTIMPLEMENTED(); 90 NOTIMPLEMENTED();
91 } 91 }
92 92
93 void WebsiteSettingsPopupAndroid::SetPermissionInfo( 93 void WebsiteSettingsPopupAndroid::SetPermissionInfo(
94 const PermissionInfoList& permission_info_list, 94 const PermissionInfoList& permission_info_list,
95 const ChosenObjectInfoList& chosen_object_info_list) { 95 const ChosenObjectInfoList& chosen_object_info_list) {
96 // TODO(reillyg): Display the contents of |chosen_object_info_list|.
97 // https://crbug.com/424667.
98 STLDeleteContainerPointers(chosen_object_info_list.begin(),
99 chosen_object_info_list.end());
100
101 JNIEnv* env = base::android::AttachCurrentThread(); 96 JNIEnv* env = base::android::AttachCurrentThread();
102 97
103 // On Android, we only want to display a subset of the available options in a 98 // On Android, we only want to display a subset of the available options in a
104 // particular order, but only if their value is different from the default. 99 // particular order, but only if their value is different from the default.
105 std::vector<ContentSettingsType> permissions_to_display; 100 std::vector<ContentSettingsType> permissions_to_display;
106 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION); 101 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION);
107 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 102 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
108 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 103 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
109 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); 104 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
110 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_IMAGES); 105 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_IMAGES);
(...skipping 18 matching lines...) Expand all
129 124
130 Java_WebsiteSettingsPopup_addPermissionSection( 125 Java_WebsiteSettingsPopup_addPermissionSection(
131 env, 126 env,
132 popup_jobject_.obj(), 127 popup_jobject_.obj(),
133 ConvertUTF16ToJavaString(env, setting_title).obj(), 128 ConvertUTF16ToJavaString(env, setting_title).obj(),
134 static_cast<jint>(permission), 129 static_cast<jint>(permission),
135 static_cast<jint>(user_specified_settings_to_display[permission])); 130 static_cast<jint>(user_specified_settings_to_display[permission]));
136 } 131 }
137 } 132 }
138 133
134 for (auto* chosen_object : chosen_object_info_list) {
135 base::string16 object_title =
136 WebsiteSettingsUI::ChosenObjectToUIString(*chosen_object);
137
138 Java_WebsiteSettingsPopup_addPermissionSection(
139 env, popup_jobject_.obj(),
140 ConvertUTF16ToJavaString(env, object_title).obj(),
141 static_cast<jint>(chosen_object->ui_info.content_settings_type),
142 static_cast<jint>(CONTENT_SETTING_ALLOW));
143 delete chosen_object;
144 }
145
139 Java_WebsiteSettingsPopup_updatePermissionDisplay(env, popup_jobject_.obj()); 146 Java_WebsiteSettingsPopup_updatePermissionDisplay(env, popup_jobject_.obj());
140 } 147 }
141 148
142 void WebsiteSettingsPopupAndroid::SetSelectedTab( 149 void WebsiteSettingsPopupAndroid::SetSelectedTab(
143 WebsiteSettingsUI::TabId tab_id) { 150 WebsiteSettingsUI::TabId tab_id) {
144 // There's no tab UI on Android - only connection info is shown. 151 // There's no tab UI on Android - only connection info is shown.
145 NOTIMPLEMENTED(); 152 NOTIMPLEMENTED();
146 } 153 }
147 154
148 // static 155 // static
149 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( 156 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid(
150 JNIEnv* env) { 157 JNIEnv* env) {
151 return RegisterNativesImpl(env); 158 return RegisterNativesImpl(env);
152 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698