summaryrefslogtreecommitdiffstats
path: root/extensions/common
diff options
context:
space:
mode:
authortreib <treib@chromium.org>2016-01-18 03:41:46 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-18 11:42:56 +0000
commit1ec595593569502139b7c3876828565d4325aa70 (patch)
treece920575431741b420089bc7fdb53411acc1a950 /extensions/common
parent047fbb3b71842c87dd1d9803c3c671723bf623e6 (diff)
downloadchromium_src-1ec595593569502139b7c3876828565d4325aa70.zip
chromium_src-1ec595593569502139b7c3876828565d4325aa70.tar.gz
chromium_src-1ec595593569502139b7c3876828565d4325aa70.tar.bz2
Host permission messages: Move formatting into an actual Formatter
as it should be in the new permission message system BUG=none Review URL: https://codereview.chromium.org/1585913006 Cr-Commit-Position: refs/heads/master@{#370012}
Diffstat (limited to 'extensions/common')
-rw-r--r--extensions/common/permissions/permission_message_util.cc45
-rw-r--r--extensions/common/permissions/permission_message_util.h8
2 files changed, 0 insertions, 53 deletions
diff --git a/extensions/common/permissions/permission_message_util.cc b/extensions/common/permissions/permission_message_util.cc
index b69e65b..0ee3abf 100644
--- a/extensions/common/permissions/permission_message_util.cc
+++ b/extensions/common/permissions/permission_message_util.cc
@@ -7,14 +7,9 @@
#include <stddef.h>
#include <vector>
-#include "base/strings/string16.h"
#include "base/strings/string_split.h"
-#include "base/strings/utf_string_conversions.h"
-#include "extensions/common/permissions/api_permission_set.h"
#include "extensions/common/url_pattern_set.h"
-#include "grit/extensions_strings.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
-#include "ui/base/l10n/l10n_util.h"
#include "url/url_constants.h"
using extensions::URLPatternSet;
@@ -38,46 +33,6 @@ bool RcdBetterThan(const std::string& a, const std::string& b) {
namespace permission_message_util {
-// The number of host messages supported. The first N - 1 of these messages are
-// specific for the number of hosts; the last one is a catch-all for N or more
-// hosts.
-static const int kNumMessages = 4;
-
-// Gets a list of hosts to display in a permission message from the given list
-// of hosts from the manifest.
-std::vector<base::string16> GetHostListFromHosts(
- const std::set<std::string>& hosts) {
- int host_msg_id = hosts.size() < kNumMessages
- ? IDS_EXTENSION_PROMPT_WARNING_HOST_AND_SUBDOMAIN
- : IDS_EXTENSION_PROMPT_WARNING_HOST_AND_SUBDOMAIN_LIST;
- std::vector<base::string16> host_list;
- for (const std::string& host : hosts) {
- host_list.push_back(
- host[0] == '*' && host[1] == '.'
- ? l10n_util::GetStringFUTF16(host_msg_id,
- base::UTF8ToUTF16(host.substr(2)))
- : base::UTF8ToUTF16(host));
- }
- DCHECK(host_list.size());
- return host_list;
-}
-
-void AddHostPermissions(extensions::PermissionIDSet* permissions,
- const std::set<std::string>& hosts,
- PermissionMessageProperties properties) {
- std::vector<base::string16> host_list = GetHostListFromHosts(hosts);
-
- // Create a separate permission for each host, and add it to the permissions
- // list.
- // TODO(sashab): Add coalescing rules for kHostReadOnly and kHostReadWrite
- // to mimic the current behavior of GetHostListFromHosts() above.
- extensions::APIPermission::ID permission_id =
- properties == kReadOnly ? extensions::APIPermission::kHostReadOnly
- : extensions::APIPermission::kHostReadWrite;
- for (const auto& host : host_list)
- permissions->insert(permission_id, host);
-}
-
std::set<std::string> GetDistinctHosts(const URLPatternSet& host_patterns,
bool include_rcd,
bool exclude_file_scheme) {
diff --git a/extensions/common/permissions/permission_message_util.h b/extensions/common/permissions/permission_message_util.h
index 5e33c07..66dd01d 100644
--- a/extensions/common/permissions/permission_message_util.h
+++ b/extensions/common/permissions/permission_message_util.h
@@ -9,19 +9,11 @@
#include <string>
namespace extensions {
-class PermissionIDSet;
class URLPatternSet;
}
namespace permission_message_util {
-enum PermissionMessageProperties { kReadOnly, kReadWrite };
-
-// Adds the appropriate permissions from the given |hosts| to |permissions|.
-void AddHostPermissions(extensions::PermissionIDSet* permissions,
- const std::set<std::string>& hosts,
- PermissionMessageProperties properties);
-
std::set<std::string> GetDistinctHosts(
const extensions::URLPatternSet& host_patterns,
bool include_rcd,