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

Unified Diff: chrome/common/extensions/permissions/socket_permission_entry.h

Issue 201203006: Move basic API permissions code out of //chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move moar things Created 6 years, 9 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: chrome/common/extensions/permissions/socket_permission_entry.h
diff --git a/chrome/common/extensions/permissions/socket_permission_entry.h b/chrome/common/extensions/permissions/socket_permission_entry.h
deleted file mode 100644
index 5d2eb9b2e6ab92620e4a0a472a5c9c08a6e803e7..0000000000000000000000000000000000000000
--- a/chrome/common/extensions/permissions/socket_permission_entry.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2013 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_ENTRY_H_
-#define CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_ENTRY_H_
-
-#include <string>
-#include <vector>
-
-#include "content/public/common/socket_permission_request.h"
-#include "ipc/ipc_param_traits.h"
-
-namespace ipc_fuzzer {
-template <class T> struct FuzzTraits;
-template <class T> struct GenerateTraits;
-} // namespace ipc_fuzzer
-
-namespace extensions {
-
-// Internal representation of a socket permission for a specific operation, such
-// as UDP "bind", host 127.0.0.1, port *.
-class SocketPermissionEntry {
- public:
- enum HostType {
- ANY_HOST,
- HOSTS_IN_DOMAINS,
- SPECIFIC_HOSTS,
- };
-
- SocketPermissionEntry();
- ~SocketPermissionEntry();
-
- // operators <, == are needed by container std::set and algorithms
- // std::set_includes and std::set_differences.
- bool operator<(const SocketPermissionEntry& rhs) const;
- bool operator==(const SocketPermissionEntry& rhs) const;
-
- bool Check(const content::SocketPermissionRequest& request) const;
-
- // Parse a host:port pattern for a given operation type.
- // <pattern> := '' |
- // <host> |
- // ':' <port> |
- // <host> ':' <port> |
- //
- // <host> := '*' |
- // '*.' <anychar except '/' and '*'>+ |
- // <anychar except '/' and '*'>+
- //
- // <port> := '*' |
- // <port number between 0 and 65535>)
- static bool ParseHostPattern(
- content::SocketPermissionRequest::OperationType type,
- const std::string& pattern,
- SocketPermissionEntry* entry);
-
- static bool ParseHostPattern(
- content::SocketPermissionRequest::OperationType type,
- const std::vector<std::string>& pattern_tokens,
- SocketPermissionEntry* entry);
-
- // Returns true if the permission type can be bound to a host or port.
- bool IsAddressBoundType() const;
-
- std::string GetHostPatternAsString() const;
- HostType GetHostType() const;
-
- const content::SocketPermissionRequest& pattern() const { return pattern_; }
- bool match_subdomains() const { return match_subdomains_; }
-
- private:
- // Friend so ParamTraits can serialize us.
- friend struct IPC::ParamTraits<SocketPermissionEntry>;
- friend struct ipc_fuzzer::FuzzTraits<SocketPermissionEntry>;
- friend struct ipc_fuzzer::GenerateTraits<SocketPermissionEntry>;
-
- // The permission type, host and port.
- content::SocketPermissionRequest pattern_;
-
- // True if there was a wildcard in the host name.
- bool match_subdomains_;
-};
-
-} // namespace extensions
-
-#endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_ENTRY_H_

Powered by Google App Engine
This is Rietveld 408576698