Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(), | |
|
Yaron
2016/08/01 02:22:58
these should still be freed at the end, shouldn't
Reilly Grant (use Gerrit)
2016/08/01 19:00:49
You're right. Thanks.
| |
| 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 Loading... | |
| 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 (const 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 } | |
| 144 | |
| 139 Java_WebsiteSettingsPopup_updatePermissionDisplay(env, popup_jobject_.obj()); | 145 Java_WebsiteSettingsPopup_updatePermissionDisplay(env, popup_jobject_.obj()); |
| 140 } | 146 } |
| 141 | 147 |
| 142 void WebsiteSettingsPopupAndroid::SetSelectedTab( | 148 void WebsiteSettingsPopupAndroid::SetSelectedTab( |
| 143 WebsiteSettingsUI::TabId tab_id) { | 149 WebsiteSettingsUI::TabId tab_id) { |
| 144 // There's no tab UI on Android - only connection info is shown. | 150 // There's no tab UI on Android - only connection info is shown. |
| 145 NOTIMPLEMENTED(); | 151 NOTIMPLEMENTED(); |
| 146 } | 152 } |
| 147 | 153 |
| 148 // static | 154 // static |
| 149 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( | 155 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( |
| 150 JNIEnv* env) { | 156 JNIEnv* env) { |
| 151 return RegisterNativesImpl(env); | 157 return RegisterNativesImpl(env); |
| 152 } | 158 } |
| OLD | NEW |