Atomic: Notify Watcher to observe device fd
[chromium-blink-merge.git] / extensions / common / permissions / permission_message_util.h
blob995d22663e8051c867b50233eceb996c03e20ded
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 PermissionMessage;
17 class URLPatternSet;
20 namespace permission_message_util {
22 enum PermissionMessageProperties { kReadOnly, kReadWrite };
24 // Get a list of hosts to display in a permission message from the given list of
25 // hosts from the manifest.
26 // TODO(sashab): Merge this into AddHostPermissions() once CreateFromHostList()
27 // is deprecated.
28 std::vector<base::string16> GetHostListFromHosts(
29 const std::set<std::string>& hosts,
30 PermissionMessageProperties properties);
32 // Creates the corresponding permission message for a list of hosts.
33 // The messages change depending on how many hosts are present, and whether
34 // |read_only| is true.
35 // TODO(sashab): Deprecate this, prefer AddHostPermissions() instead.
36 extensions::PermissionMessage CreateFromHostList(
37 const std::set<std::string>& hosts,
38 PermissionMessageProperties);
40 // Adds the appropriate permissions from given hosts to |permissions|.
41 void AddHostPermissions(extensions::PermissionIDSet* permissions,
42 const std::set<std::string>& hosts,
43 PermissionMessageProperties properties);
45 std::set<std::string> GetDistinctHosts(
46 const extensions::URLPatternSet& host_patterns,
47 bool include_rcd,
48 bool exclude_file_scheme);
50 } // namespace permission_message_util
52 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_UTIL_H_