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

Unified Diff: extensions/common/permissions/permission_message_util.cc

Issue 1213623006: Extensions: Remove PermissionMessage (permission_message.h/cc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kill_getmessages
Patch Set: fix app_shell build, rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: extensions/common/permissions/permission_message_util.cc
diff --git a/extensions/common/permissions/permission_message_util.cc b/extensions/common/permissions/permission_message_util.cc
index 2358ac49343c7c0417c671d266dbfc77c51bdbf2..ccd472297e4772a2c186adc10989a7c45b26ca5a 100644
--- a/extensions/common/permissions/permission_message_util.cc
+++ b/extensions/common/permissions/permission_message_util.cc
@@ -9,7 +9,6 @@
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "extensions/common/permissions/coalesced_permission_message.h"
-#include "extensions/common/permissions/permission_message.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/url_pattern_set.h"
#include "grit/extensions_strings.h"
@@ -17,7 +16,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "url/url_constants.h"
-using extensions::PermissionMessage;
using extensions::URLPatternSet;
namespace {
@@ -65,58 +63,6 @@ std::vector<base::string16> GetHostListFromHosts(
return host_list;
}
-PermissionMessage CreateFromHostList(const std::set<std::string>& hosts,
- PermissionMessageProperties properties) {
- typedef std::pair<PermissionMessage::ID, int> MsgPair;
- static const MsgPair kReadWriteMessagesList[] = {
- std::make_pair(PermissionMessage::kHosts1,
- IDS_EXTENSION_PROMPT_WARNING_1_HOST),
- std::make_pair(PermissionMessage::kHosts2,
- IDS_EXTENSION_PROMPT_WARNING_2_HOSTS),
- std::make_pair(PermissionMessage::kHosts3,
- IDS_EXTENSION_PROMPT_WARNING_3_HOSTS),
- std::make_pair(PermissionMessage::kHosts4OrMore,
- IDS_EXTENSION_PROMPT_WARNING_HOSTS_LIST)};
- static const MsgPair kReadOnlyMessagesList[] = {
- std::make_pair(PermissionMessage::kHosts1ReadOnly,
- IDS_EXTENSION_PROMPT_WARNING_1_HOST_READ_ONLY),
- std::make_pair(PermissionMessage::kHosts2ReadOnly,
- IDS_EXTENSION_PROMPT_WARNING_2_HOSTS_READ_ONLY),
- std::make_pair(PermissionMessage::kHosts3ReadOnly,
- IDS_EXTENSION_PROMPT_WARNING_3_HOSTS_READ_ONLY),
- std::make_pair(PermissionMessage::kHosts4OrMoreReadOnly,
- IDS_EXTENSION_PROMPT_WARNING_HOSTS_LIST_READ_ONLY)};
- static_assert(
- arraysize(kReadWriteMessagesList) == arraysize(kReadOnlyMessagesList),
- "message lists should be of different size");
- static_assert(kNumMessages == arraysize(kReadWriteMessagesList),
- "messages array should be of different size");
-
- const MsgPair(&messages_list)[kNumMessages] =
- properties == kReadOnly ? kReadOnlyMessagesList : kReadWriteMessagesList;
- std::vector<base::string16> host_list =
- GetHostListFromHosts(hosts, properties);
-
- if (host_list.size() < kNumMessages) {
- return PermissionMessage(
- messages_list[host_list.size() - 1].first,
- l10n_util::GetStringFUTF16(messages_list[host_list.size() - 1].second,
- host_list, NULL));
- }
-
- base::string16 details;
- for (size_t i = 0; i < host_list.size(); ++i) {
- if (i > 0)
- details += base::ASCIIToUTF16("\n");
- details += host_list[i];
- }
- return PermissionMessage(
- messages_list[arraysize(messages_list) - 1].first,
- l10n_util::GetStringUTF16(
- messages_list[arraysize(messages_list) - 1].second),
- details);
-}
-
void AddHostPermissions(extensions::PermissionIDSet* permissions,
const std::set<std::string>& hosts,
PermissionMessageProperties properties) {
« no previous file with comments | « extensions/common/permissions/permission_message_util.h ('k') | extensions/common/permissions/permissions_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698