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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/write_file.cc

Issue 1870793002: Convert //chrome/browser/chromeos 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 "chrome/browser/chromeos/file_system_provider/operations/write_file.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 30 matching lines...) Expand all
41 41
42 WriteFileRequestedOptions options; 42 WriteFileRequestedOptions options;
43 options.file_system_id = file_system_info_.file_system_id(); 43 options.file_system_id = file_system_info_.file_system_id();
44 options.request_id = request_id; 44 options.request_id = request_id;
45 options.open_request_id = file_handle_; 45 options.open_request_id = file_handle_;
46 options.offset = offset_; 46 options.offset = offset_;
47 // Length is not passed directly since it can be accessed via data.byteLength. 47 // Length is not passed directly since it can be accessed via data.byteLength.
48 48
49 // Set the data directly on base::Value() to avoid an extra string copy. 49 // Set the data directly on base::Value() to avoid an extra string copy.
50 DCHECK(buffer_.get()); 50 DCHECK(buffer_.get());
51 scoped_ptr<base::DictionaryValue> options_as_value = options.ToValue(); 51 std::unique_ptr<base::DictionaryValue> options_as_value = options.ToValue();
52 options_as_value->Set( 52 options_as_value->Set(
53 "data", 53 "data",
54 base::BinaryValue::CreateWithCopiedBuffer(buffer_->data(), length_)); 54 base::BinaryValue::CreateWithCopiedBuffer(buffer_->data(), length_));
55 55
56 scoped_ptr<base::ListValue> event_args(new base::ListValue); 56 std::unique_ptr<base::ListValue> event_args(new base::ListValue);
57 event_args->Append(options_as_value.release()); 57 event_args->Append(options_as_value.release());
58 58
59 return SendEvent( 59 return SendEvent(
60 request_id, 60 request_id,
61 extensions::events::FILE_SYSTEM_PROVIDER_ON_WRITE_FILE_REQUESTED, 61 extensions::events::FILE_SYSTEM_PROVIDER_ON_WRITE_FILE_REQUESTED,
62 extensions::api::file_system_provider::OnWriteFileRequested::kEventName, 62 extensions::api::file_system_provider::OnWriteFileRequested::kEventName,
63 std::move(event_args)); 63 std::move(event_args));
64 } 64 }
65 65
66 void WriteFile::OnSuccess(int /* request_id */, 66 void WriteFile::OnSuccess(int /* request_id */,
67 scoped_ptr<RequestValue> /* result */, 67 std::unique_ptr<RequestValue> /* result */,
68 bool /* has_more */) { 68 bool /* has_more */) {
69 TRACE_EVENT0("file_system_provider", "WriteFile::OnSuccess"); 69 TRACE_EVENT0("file_system_provider", "WriteFile::OnSuccess");
70 callback_.Run(base::File::FILE_OK); 70 callback_.Run(base::File::FILE_OK);
71 } 71 }
72 72
73 void WriteFile::OnError(int /* request_id */, 73 void WriteFile::OnError(int /* request_id */,
74 scoped_ptr<RequestValue> /* result */, 74 std::unique_ptr<RequestValue> /* result */,
75 base::File::Error error) { 75 base::File::Error error) {
76 TRACE_EVENT0("file_system_provider", "WriteFile::OnError"); 76 TRACE_EVENT0("file_system_provider", "WriteFile::OnError");
77 callback_.Run(error); 77 callback_.Run(error);
78 } 78 }
79 79
80 } // namespace operations 80 } // namespace operations
81 } // namespace file_system_provider 81 } // namespace file_system_provider
82 } // namespace chromeos 82 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698