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

Side by Side Diff: extensions/browser/api/web_request/web_request_api_helpers.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (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 "extensions/browser/api/web_request/web_request_api_helpers.h" 5 #include "extensions/browser/api/web_request/web_request_api_helpers.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 // Creates a NetLog callback the returns a Value with the ID of the extension 254 // Creates a NetLog callback the returns a Value with the ID of the extension
255 // that caused an event. |delta| must remain valid for the lifetime of the 255 // that caused an event. |delta| must remain valid for the lifetime of the
256 // callback. 256 // callback.
257 net::NetLog::ParametersCallback CreateNetLogExtensionIdCallback( 257 net::NetLog::ParametersCallback CreateNetLogExtensionIdCallback(
258 const EventResponseDelta* delta) { 258 const EventResponseDelta* delta) {
259 return net::NetLog::StringCallback("extension_id", &delta->extension_id); 259 return net::NetLog::StringCallback("extension_id", &delta->extension_id);
260 } 260 }
261 261
262 // Creates NetLog parameters to indicate that an extension modified a request. 262 // Creates NetLog parameters to indicate that an extension modified a request.
263 scoped_ptr<base::Value> NetLogModificationCallback( 263 std::unique_ptr<base::Value> NetLogModificationCallback(
264 const EventResponseDelta* delta, 264 const EventResponseDelta* delta,
265 net::NetLogCaptureMode capture_mode) { 265 net::NetLogCaptureMode capture_mode) {
266 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 266 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
267 dict->SetString("extension_id", delta->extension_id); 267 dict->SetString("extension_id", delta->extension_id);
268 268
269 base::ListValue* modified_headers = new base::ListValue(); 269 base::ListValue* modified_headers = new base::ListValue();
270 net::HttpRequestHeaders::Iterator modification( 270 net::HttpRequestHeaders::Iterator modification(
271 delta->modified_request_headers); 271 delta->modified_request_headers);
272 while (modification.GetNext()) { 272 while (modification.GetNext()) {
273 std::string line = modification.name() + ": " + modification.value(); 273 std::string line = modification.name() + ": " + modification.value();
274 modified_headers->Append(new base::StringValue(line)); 274 modified_headers->Append(new base::StringValue(line));
275 } 275 }
276 dict->Set("modified_headers", modified_headers); 276 dict->Set("modified_headers", modified_headers);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 422 }
423 } 423 }
424 424
425 return result; 425 return result;
426 } 426 }
427 427
428 EventResponseDelta* CalculateOnAuthRequiredDelta( 428 EventResponseDelta* CalculateOnAuthRequiredDelta(
429 const std::string& extension_id, 429 const std::string& extension_id,
430 const base::Time& extension_install_time, 430 const base::Time& extension_install_time,
431 bool cancel, 431 bool cancel,
432 scoped_ptr<net::AuthCredentials>* auth_credentials) { 432 std::unique_ptr<net::AuthCredentials>* auth_credentials) {
433 EventResponseDelta* result = 433 EventResponseDelta* result =
434 new EventResponseDelta(extension_id, extension_install_time); 434 new EventResponseDelta(extension_id, extension_install_time);
435 result->cancel = cancel; 435 result->cancel = cancel;
436 result->auth_credentials.swap(*auth_credentials); 436 result->auth_credentials.swap(*auth_credentials);
437 return result; 437 return result;
438 } 438 }
439 439
440 void MergeCancelOfResponses( 440 void MergeCancelOfResponses(
441 const EventResponseDeltas& deltas, 441 const EventResponseDeltas& deltas,
442 bool* canceled, 442 bool* canceled,
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { 1318 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) {
1319 if (type_str == kResourceTypeStrings[i]) { 1319 if (type_str == kResourceTypeStrings[i]) {
1320 found = true; 1320 found = true;
1321 types->push_back(kResourceTypeValues[i]); 1321 types->push_back(kResourceTypeValues[i]);
1322 } 1322 }
1323 } 1323 }
1324 return found; 1324 return found;
1325 } 1325 }
1326 1326
1327 } // namespace extension_web_request_api_helpers 1327 } // namespace extension_web_request_api_helpers
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698