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

Side by Side Diff: chrome/common/extensions/permissions/chrome_permission_message_provider.cc

Issue 410023002: Show read-only messages for non-interact non-desktop Automation extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Review comments Created 6 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 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 "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "extensions/common/extensions_client.h" 9 #include "extensions/common/extensions_client.h"
10 #include "extensions/common/permissions/permission_message.h" 10 #include "extensions/common/permissions/permission_message.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 PermissionMessage::kHostsAll, 366 PermissionMessage::kHostsAll,
367 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS))); 367 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS)));
368 } else { 368 } else {
369 URLPatternSet regular_hosts; 369 URLPatternSet regular_hosts;
370 ExtensionsClient::Get()->FilterHostPermissions( 370 ExtensionsClient::Get()->FilterHostPermissions(
371 permissions->effective_hosts(), &regular_hosts, &messages); 371 permissions->effective_hosts(), &regular_hosts, &messages);
372 372
373 std::set<std::string> hosts = 373 std::set<std::string> hosts =
374 permission_message_util::GetDistinctHosts(regular_hosts, true, true); 374 permission_message_util::GetDistinctHosts(regular_hosts, true, true);
375 if (!hosts.empty()) 375 if (!hosts.empty())
376 messages.insert(permission_message_util::CreateFromHostList(hosts)); 376 messages.insert(permission_message_util::CreateFromHostList(
377 hosts, permission_message_util::kReadWrite));
377 } 378 }
378 return messages; 379 return messages;
379 } 380 }
380 381
381 bool ChromePermissionMessageProvider::IsAPIPrivilegeIncrease( 382 bool ChromePermissionMessageProvider::IsAPIPrivilegeIncrease(
382 const PermissionSet* old_permissions, 383 const PermissionSet* old_permissions,
383 const PermissionSet* new_permissions) const { 384 const PermissionSet* new_permissions) const {
384 if (new_permissions == NULL) 385 if (new_permissions == NULL)
385 return false; 386 return false;
386 387
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 std::set<std::string> old_hosts_set( 450 std::set<std::string> old_hosts_set(
450 permission_message_util::GetDistinctHosts(old_list, false, false)); 451 permission_message_util::GetDistinctHosts(old_list, false, false));
451 std::set<std::string> new_hosts_only = 452 std::set<std::string> new_hosts_only =
452 base::STLSetDifference<std::set<std::string> >(new_hosts_set, 453 base::STLSetDifference<std::set<std::string> >(new_hosts_set,
453 old_hosts_set); 454 old_hosts_set);
454 455
455 return !new_hosts_only.empty(); 456 return !new_hosts_only.empty();
456 } 457 }
457 458
458 } // namespace extensions 459 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698