| 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/common/extensions/permissions/permission_set.h" | 5 #include "chrome/common/extensions/permissions/permission_set.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 continue; | 301 continue; |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 messages.push_back(i->message()); | 305 messages.push_back(i->message()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 return messages; | 308 return messages; |
| 309 } | 309 } |
| 310 | 310 |
| 311 std::vector<string16> PermissionSet::GetWarningMessagesDetails( |
| 312 Manifest::Type extension_type) const { |
| 313 std::vector<string16> messages; |
| 314 PermissionMessages permissions = GetPermissionMessages(extension_type); |
| 315 |
| 316 for (PermissionMessages::const_iterator i = permissions.begin(); |
| 317 i != permissions.end(); ++i) |
| 318 messages.push_back(i->details()); |
| 319 |
| 320 return messages; |
| 321 } |
| 322 |
| 311 bool PermissionSet::IsEmpty() const { | 323 bool PermissionSet::IsEmpty() const { |
| 312 // Not default if any host permissions are present. | 324 // Not default if any host permissions are present. |
| 313 if (!(explicit_hosts().is_empty() && scriptable_hosts().is_empty())) | 325 if (!(explicit_hosts().is_empty() && scriptable_hosts().is_empty())) |
| 314 return false; | 326 return false; |
| 315 | 327 |
| 316 // Or if it has no api permissions. | 328 // Or if it has no api permissions. |
| 317 return apis().empty(); | 329 return apis().empty(); |
| 318 } | 330 } |
| 319 | 331 |
| 320 bool PermissionSet::HasAPIPermission( | 332 bool PermissionSet::HasAPIPermission( |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 std::set<std::string> new_hosts_only; | 622 std::set<std::string> new_hosts_only; |
| 611 | 623 |
| 612 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 624 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 613 old_hosts_set.begin(), old_hosts_set.end(), | 625 old_hosts_set.begin(), old_hosts_set.end(), |
| 614 std::inserter(new_hosts_only, new_hosts_only.begin())); | 626 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 615 | 627 |
| 616 return !new_hosts_only.empty(); | 628 return !new_hosts_only.empty(); |
| 617 } | 629 } |
| 618 | 630 |
| 619 } // namespace extensions | 631 } // namespace extensions |
| OLD | NEW |