OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_H_ |
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/common/extensions/permissions/api_permission.h" | 11 #include "chrome/common/extensions/permissions/api_permission.h" |
12 #include "chrome/common/extensions/permissions/socket_permission_data.h" | 12 #include "chrome/common/extensions/permissions/socket_permission_data.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class Value; | 15 class Value; |
16 } | 16 } |
17 | 17 |
18 namespace IPC { | 18 namespace IPC { |
19 class Message; | 19 class Message; |
20 } | 20 } |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 // There's room to share code with related classes, see http://crbug.com/147531 | 24 // There's room to share code with related classes, see http://crbug.com/147531 |
25 | 25 |
26 class SocketPermission : public APIPermission { | 26 class SocketPermission : public APIPermission { |
27 public: | 27 public: |
28 struct CheckParam : APIPermission::CheckParam { | 28 struct CheckParam : APIPermission::CheckParam { |
29 CheckParam(SocketPermissionData::OperationType type, | 29 CheckParam(content::SocketPermissionRequest::OperationType type, |
30 const std::string& host, | 30 const std::string& host, |
31 int port) | 31 int port) |
32 : type(type), | 32 : request(type, host, port) { } |
33 host(host), | 33 content::SocketPermissionRequest request; |
34 port(port) { } | |
35 SocketPermissionData::OperationType type; | |
36 std::string host; | |
37 int port; | |
38 }; | 34 }; |
39 | 35 |
40 explicit SocketPermission(const APIPermissionInfo* info); | 36 explicit SocketPermission(const APIPermissionInfo* info); |
41 | 37 |
42 virtual ~SocketPermission(); | 38 virtual ~SocketPermission(); |
43 | 39 |
44 // Returns true if this permission has PermissionMessages. | 40 // Returns true if this permission has PermissionMessages. |
45 virtual bool HasMessages() const OVERRIDE; | 41 virtual bool HasMessages() const OVERRIDE; |
46 | 42 |
47 // Returns the localized permission messages of this permission. | 43 // Returns the localized permission messages of this permission. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool AddAnyHostMessage(PermissionMessages& messages) const; | 87 bool AddAnyHostMessage(PermissionMessages& messages) const; |
92 void AddSubdomainHostMessage(PermissionMessages& messages) const; | 88 void AddSubdomainHostMessage(PermissionMessages& messages) const; |
93 void AddSpecificHostMessage(PermissionMessages& messages) const; | 89 void AddSpecificHostMessage(PermissionMessages& messages) const; |
94 | 90 |
95 std::set<SocketPermissionData> data_set_; | 91 std::set<SocketPermissionData> data_set_; |
96 }; | 92 }; |
97 | 93 |
98 } // namespace extensions | 94 } // namespace extensions |
99 | 95 |
100 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_H_ | 96 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_SOCKET_PERMISSION_H_ |
OLD | NEW |