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

Side by Side Diff: extensions/common/permissions/socket_permission_data.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 <sstream> 9 #include <sstream>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "extensions/common/permissions/api_permission.h" 16 #include "extensions/common/permissions/api_permission.h"
17 #include "extensions/common/permissions/socket_permission.h" 17 #include "extensions/common/permissions/socket_permission.h"
18 #include "url/url_canon.h" 18 #include "url/url_canon.h"
19 19
20 namespace { 20 namespace {
21 21
22 using content::SocketPermissionRequest; 22 using content::SocketPermissionRequest;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool SocketPermissionData::Check(const APIPermission::CheckParam* param) const { 95 bool SocketPermissionData::Check(const APIPermission::CheckParam* param) const {
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 scoped_ptr<base::Value> SocketPermissionData::ToValue() const { 105 std::unique_ptr<base::Value> SocketPermissionData::ToValue() const {
106 return scoped_ptr<base::Value>(new base::StringValue(GetAsString())); 106 return std::unique_ptr<base::Value>(new base::StringValue(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
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
OLDNEW
« no previous file with comments | « extensions/common/permissions/socket_permission_data.h ('k') | extensions/common/permissions/socket_permission_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698