OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/extensions/permissions/chrome_permission_message_provide
r.h" | 5 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // TODO(treib,devlin): Remove this for M56, when hopefully all users will have | 188 // TODO(treib,devlin): Remove this for M56, when hopefully all users will have |
189 // updated prefs. | 189 // updated prefs. |
190 const APIPermission::ID kSettingsOverrideIDs[] = { | 190 const APIPermission::ID kSettingsOverrideIDs[] = { |
191 APIPermission::kHomepage, APIPermission::kSearchProvider, | 191 APIPermission::kHomepage, APIPermission::kSearchProvider, |
192 APIPermission::kStartupPages}; | 192 APIPermission::kStartupPages}; |
193 for (auto id : kSettingsOverrideIDs) { | 193 for (auto id : kSettingsOverrideIDs) { |
194 DropPermissionParameter(id, &old_ids); | 194 DropPermissionParameter(id, &old_ids); |
195 DropPermissionParameter(id, &new_ids); | 195 DropPermissionParameter(id, &new_ids); |
196 } | 196 } |
197 | 197 |
| 198 // For M62, we added a new permission ID for new tab page overrides. Consider |
| 199 // the addition of this permission to not result in a privilege increase for |
| 200 // the time being. |
| 201 // TODO(robertshield): Remove this once most of the population is on M62+ |
| 202 new_ids.erase(APIPermission::kNewTabPageOverride); |
| 203 |
198 // If all the IDs were already there, it's not a privilege increase. | 204 // If all the IDs were already there, it's not a privilege increase. |
199 if (old_ids.Includes(new_ids)) | 205 if (old_ids.Includes(new_ids)) |
200 return false; | 206 return false; |
201 | 207 |
202 // Otherwise, check the actual messages - not all IDs result in a message, | 208 // Otherwise, check the actual messages - not all IDs result in a message, |
203 // and some messages can suppress others. | 209 // and some messages can suppress others. |
204 PermissionMessages old_messages = GetPermissionMessages(old_ids); | 210 PermissionMessages old_messages = GetPermissionMessages(old_ids); |
205 PermissionMessages new_messages = GetPermissionMessages(new_ids); | 211 PermissionMessages new_messages = GetPermissionMessages(new_ids); |
206 | 212 |
207 ComparablePermissions old_strings(old_messages.begin(), old_messages.end()); | 213 ComparablePermissions old_strings(old_messages.begin(), old_messages.end()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 std::set<std::string> old_hosts_set( | 248 std::set<std::string> old_hosts_set( |
243 permission_message_util::GetDistinctHosts(old_list, false, false)); | 249 permission_message_util::GetDistinctHosts(old_list, false, false)); |
244 std::set<std::string> new_hosts_only = | 250 std::set<std::string> new_hosts_only = |
245 base::STLSetDifference<std::set<std::string> >(new_hosts_set, | 251 base::STLSetDifference<std::set<std::string> >(new_hosts_set, |
246 old_hosts_set); | 252 old_hosts_set); |
247 | 253 |
248 return !new_hosts_only.empty(); | 254 return !new_hosts_only.empty(); |
249 } | 255 } |
250 | 256 |
251 } // namespace extensions | 257 } // namespace extensions |
OLD | NEW |