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

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: Rebase Created 6 years, 1 month 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 "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
10 #include "extensions/common/extensions_client.h" 10 #include "extensions/common/extensions_client.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 PermissionMessage::kHostsAll, 375 PermissionMessage::kHostsAll,
376 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS))); 376 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS)));
377 } else { 377 } else {
378 URLPatternSet regular_hosts; 378 URLPatternSet regular_hosts;
379 ExtensionsClient::Get()->FilterHostPermissions( 379 ExtensionsClient::Get()->FilterHostPermissions(
380 permissions->effective_hosts(), &regular_hosts, &messages); 380 permissions->effective_hosts(), &regular_hosts, &messages);
381 381
382 std::set<std::string> hosts = 382 std::set<std::string> hosts =
383 permission_message_util::GetDistinctHosts(regular_hosts, true, true); 383 permission_message_util::GetDistinctHosts(regular_hosts, true, true);
384 if (!hosts.empty()) 384 if (!hosts.empty())
385 messages.insert(permission_message_util::CreateFromHostList(hosts)); 385 messages.insert(permission_message_util::CreateFromHostList(
386 hosts, permission_message_util::kReadWrite));
386 } 387 }
387 return messages; 388 return messages;
388 } 389 }
389 390
390 bool ChromePermissionMessageProvider::IsAPIPrivilegeIncrease( 391 bool ChromePermissionMessageProvider::IsAPIPrivilegeIncrease(
391 const PermissionSet* old_permissions, 392 const PermissionSet* old_permissions,
392 const PermissionSet* new_permissions) const { 393 const PermissionSet* new_permissions) const {
393 if (new_permissions == NULL) 394 if (new_permissions == NULL)
394 return false; 395 return false;
395 396
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 std::set<std::string> old_hosts_set( 459 std::set<std::string> old_hosts_set(
459 permission_message_util::GetDistinctHosts(old_list, false, false)); 460 permission_message_util::GetDistinctHosts(old_list, false, false));
460 std::set<std::string> new_hosts_only = 461 std::set<std::string> new_hosts_only =
461 base::STLSetDifference<std::set<std::string> >(new_hosts_set, 462 base::STLSetDifference<std::set<std::string> >(new_hosts_set,
462 old_hosts_set); 463 old_hosts_set);
463 464
464 return !new_hosts_only.empty(); 465 return !new_hosts_only.empty();
465 } 466 }
466 467
467 } // namespace extensions 468 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698