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

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

Issue 1715683002: chrome: Use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing non ContainsValue changes Created 4 years, 9 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 "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ssl/chrome_security_state_model_client.h" 13 #include "chrome/browser/ssl/chrome_security_state_model_client.h"
13 #include "chrome/browser/ui/website_settings/website_settings.h" 14 #include "chrome/browser/ui/website_settings/website_settings.h"
14 #include "chrome/browser/ui/website_settings/website_settings_ui.h" 15 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
15 #include "components/content_settings/core/common/content_settings.h" 16 #include "components/content_settings/core/common/content_settings.h"
16 #include "components/content_settings/core/common/content_settings_types.h" 17 #include "components/content_settings/core/common/content_settings_types.h"
17 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/cert_store.h" 19 #include "content/public/browser/cert_store.h"
19 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); 106 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
106 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_IMAGES); 107 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_IMAGES);
107 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_JAVASCRIPT); 108 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_JAVASCRIPT);
108 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_POPUPS); 109 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_POPUPS);
109 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_KEYGEN); 110 permissions_to_display.push_back(CONTENT_SETTINGS_TYPE_KEYGEN);
110 111
111 std::map<ContentSettingsType, ContentSetting> 112 std::map<ContentSettingsType, ContentSetting>
112 user_specified_settings_to_display; 113 user_specified_settings_to_display;
113 114
114 for (const auto& permission : permission_info_list) { 115 for (const auto& permission : permission_info_list) {
115 if (std::find(permissions_to_display.begin(), 116 if (ContainsValue(permissions_to_display, permission.type) &&
116 permissions_to_display.end(),
117 permission.type) != permissions_to_display.end() &&
118 permission.setting != CONTENT_SETTING_DEFAULT) { 117 permission.setting != CONTENT_SETTING_DEFAULT) {
119 user_specified_settings_to_display[permission.type] = permission.setting; 118 user_specified_settings_to_display[permission.type] = permission.setting;
120 } 119 }
121 } 120 }
122 121
123 for (const auto& permission : permissions_to_display) { 122 for (const auto& permission : permissions_to_display) {
124 if (ContainsKey(user_specified_settings_to_display, permission)) { 123 if (ContainsKey(user_specified_settings_to_display, permission)) {
125 base::string16 setting_title = 124 base::string16 setting_title =
126 WebsiteSettingsUI::PermissionTypeToUIString(permission); 125 WebsiteSettingsUI::PermissionTypeToUIString(permission);
127 126
(...skipping 13 matching lines...) Expand all
141 WebsiteSettingsUI::TabId tab_id) { 140 WebsiteSettingsUI::TabId tab_id) {
142 // There's no tab UI on Android - only connection info is shown. 141 // There's no tab UI on Android - only connection info is shown.
143 NOTIMPLEMENTED(); 142 NOTIMPLEMENTED();
144 } 143 }
145 144
146 // static 145 // static
147 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( 146 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid(
148 JNIEnv* env) { 147 JNIEnv* env) {
149 return RegisterNativesImpl(env); 148 return RegisterNativesImpl(env);
150 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698