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

Side by Side Diff: chrome/common/extensions/permissions/socket_permission_data.h

Issue 10692160: Support socket endpoint permissions for AppsV2 Socket API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix compile issues.wq Created 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_DATA_H_
5 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_DATA_H_
6
7 #include <string>
8
9 namespace extensions {
10
11 // A pattern that can be used to match socket permission.
12 // <socket-permission-pattern>
13 // := <op> | <op> ':' <host> | <op> ':' ':' <port> |
14 // <op> ':' <host> ':' <port>
15 // <op> := 'tcp-connect' | 'tcp-listen' | 'udp-bind' | 'udp-send-to'
16 // <host> := '*' | '*.' <anychar except '/' and '*'>+
17 // <port> := '*' | <port number between 0 and 65535>)
18 class SocketPermissionData {
19 public:
20 enum OperationType {
21 NONE = 0,
22 TCP_CONNECT,
23 TCP_LISTEN,
24 UDP_BIND,
25 UDP_SEND_TO,
26 };
27
28 SocketPermissionData();
29 ~SocketPermissionData();
30
31 bool operator<(const SocketPermissionData& rhs) const;
Mihai Parparita -not on Chrome 2012/08/10 00:16:16 The C++ style guide says " In particular, do not o
Peng 2012/08/13 16:26:10 Done. Have to keep them. They are also used by std
32 bool operator==(const SocketPermissionData& rhs) const;
33
34 bool Match(OperationType type, const std::string& host, int port) const;
35
36 bool Parse(const std::string& permission);
37
38 const std::string& GetAsString() const;
39
40 private:
41 void Reset();
42
43 OperationType type_;
44 std::string host_;
45 bool match_subdomains_;
46 int port_;
47 mutable std::string spec_;
48 };
49
50 } // namespace extensions
51
52 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698