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 #include "chrome/common/extensions/permissions/socket_permission_data.h" | 5 #include "chrome/common/extensions/permissions/socket_permission_data.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 if (pattern_.port != request.port && pattern_.port != kWildcardPortNumber) | 150 if (pattern_.port != request.port && pattern_.port != kWildcardPortNumber) |
151 return false; | 151 return false; |
152 | 152 |
153 return true; | 153 return true; |
154 } | 154 } |
155 | 155 |
156 scoped_ptr<base::Value> SocketPermissionData::ToValue() const { | 156 scoped_ptr<base::Value> SocketPermissionData::ToValue() const { |
157 return scoped_ptr<base::Value>(base::Value::CreateStringValue(GetAsString())); | 157 return scoped_ptr<base::Value>(new base::StringValue(GetAsString())); |
158 } | 158 } |
159 | 159 |
160 bool SocketPermissionData::FromValue(const base::Value* value) { | 160 bool SocketPermissionData::FromValue(const base::Value* value) { |
161 std::string spec; | 161 std::string spec; |
162 if (!value->GetAsString(&spec)) | 162 if (!value->GetAsString(&spec)) |
163 return false; | 163 return false; |
164 | 164 |
165 return Parse(spec); | 165 return Parse(spec); |
166 } | 166 } |
167 | 167 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 void SocketPermissionData::Reset() { | 269 void SocketPermissionData::Reset() { |
270 pattern_.type = SocketPermissionRequest::NONE; | 270 pattern_.type = SocketPermissionRequest::NONE; |
271 pattern_.host.clear(); | 271 pattern_.host.clear(); |
272 match_subdomains_ = false; | 272 match_subdomains_ = false; |
273 pattern_.port = kInvalidPort; | 273 pattern_.port = kInvalidPort; |
274 spec_.clear(); | 274 spec_.clear(); |
275 } | 275 } |
276 | 276 |
277 } // namespace extensions | 277 } // namespace extensions |
OLD | NEW |