OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "extensions/common/permissions/socket_permission_data.h" | 5 #include "extensions/common/permissions/socket_permission_data.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <vector> | 10 #include <vector> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (!param) | 96 if (!param) |
97 return false; | 97 return false; |
98 const SocketPermission::CheckParam& specific_param = | 98 const SocketPermission::CheckParam& specific_param = |
99 *static_cast<const SocketPermission::CheckParam*>(param); | 99 *static_cast<const SocketPermission::CheckParam*>(param); |
100 const SocketPermissionRequest& request = specific_param.request; | 100 const SocketPermissionRequest& request = specific_param.request; |
101 | 101 |
102 return entry_.Check(request); | 102 return entry_.Check(request); |
103 } | 103 } |
104 | 104 |
105 std::unique_ptr<base::Value> SocketPermissionData::ToValue() const { | 105 std::unique_ptr<base::Value> SocketPermissionData::ToValue() const { |
106 return std::unique_ptr<base::Value>(new base::StringValue(GetAsString())); | 106 return std::unique_ptr<base::Value>(new base::Value(GetAsString())); |
107 } | 107 } |
108 | 108 |
109 bool SocketPermissionData::FromValue(const base::Value* value) { | 109 bool SocketPermissionData::FromValue(const base::Value* value) { |
110 std::string spec; | 110 std::string spec; |
111 if (!value->GetAsString(&spec)) | 111 if (!value->GetAsString(&spec)) |
112 return false; | 112 return false; |
113 | 113 |
114 return Parse(spec); | 114 return Parse(spec); |
115 } | 115 } |
116 | 116 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 return spec_; | 151 return spec_; |
152 } | 152 } |
153 | 153 |
154 void SocketPermissionData::Reset() { | 154 void SocketPermissionData::Reset() { |
155 entry_ = SocketPermissionEntry(); | 155 entry_ = SocketPermissionEntry(); |
156 spec_.clear(); | 156 spec_.clear(); |
157 } | 157 } |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |