| Index: chrome/common/extensions/permissions/socket_permission_data.h
|
| diff --git a/chrome/common/extensions/permissions/socket_permission_data.h b/chrome/common/extensions/permissions/socket_permission_data.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..783f433122c4e1ef7579235952a0d1b4772426b5
|
| --- /dev/null
|
| +++ b/chrome/common/extensions/permissions/socket_permission_data.h
|
| @@ -0,0 +1,50 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +#ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_DATA_H_
|
| +#define CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_DATA_H_
|
| +
|
| +#include <string>
|
| +
|
| +namespace extensions {
|
| +
|
| +// A pattern that can be used to match socket permission.
|
| +// <socket-permission-pattern>
|
| +// := <op> | <op> ':' <host> | <op> ':' ':' <port> |
|
| +// <op> ':' <host> ':' <port>
|
| +// <op> := 'tcp-connect' | 'tcp-listen' | 'udp-bind' | 'udp-send-to'
|
| +// <host> := '*' | '*.' <anychar except '/' and '*'>+
|
| +// <port> := '*' | <port number between 0 and 65535>)
|
| +class SocketPermissionData {
|
| + public:
|
| + enum OperationType {
|
| + NONE = 0,
|
| + TCP_CONNECT,
|
| + TCP_LISTEN,
|
| + UDP_BIND,
|
| + UDP_SEND_TO,
|
| + };
|
| +
|
| + SocketPermissionData();
|
| + ~SocketPermissionData();
|
| +
|
| + bool operator<(const SocketPermissionData& rhs) const;
|
| + bool operator==(const SocketPermissionData& rhs) const;
|
| +
|
| + bool Match(OperationType type, const std::string& host, int port) const;
|
| +
|
| + bool Parse(const std::string& permission);
|
| +
|
| + const std::string& GetAsString() const;
|
| +
|
| + private:
|
| + OperationType type_;
|
| + std::string host_;
|
| + bool match_subdomains_;
|
| + int port_;
|
| + mutable std::string spec_;
|
| +};
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_DATA_H_
|
|
|