Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / permissions / permission_message_util.h
blobfc006d7c85ccdc555b074f1f25d4bdf8d6df0590
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_UTIL_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_UTIL_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/strings/string16.h"
14 namespace extensions {
15 class PermissionIDSet;
16 class URLPatternSet;
19 namespace permission_message_util {
21 enum PermissionMessageProperties { kReadOnly, kReadWrite };
23 // Get a list of hosts to display in a permission message from the given list of
24 // hosts from the manifest.
25 // TODO(sashab): Merge this into AddHostPermissions().
26 std::vector<base::string16> GetHostListFromHosts(
27 const std::set<std::string>& hosts,
28 PermissionMessageProperties properties);
30 // Adds the appropriate permissions from given hosts to |permissions|.
31 void AddHostPermissions(extensions::PermissionIDSet* permissions,
32 const std::set<std::string>& hosts,
33 PermissionMessageProperties properties);
35 std::set<std::string> GetDistinctHosts(
36 const extensions::URLPatternSet& host_patterns,
37 bool include_rcd,
38 bool exclude_file_scheme);
40 } // namespace permission_message_util
42 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_UTIL_H_