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

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

Issue 2799093006: Remove base::BinaryValue (Closed)
Patch Set: Rebase Created 3 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::unique_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", base::Value::CreateWithCopiedBuffer(buffer_->data(), length_));
54 base::BinaryValue::CreateWithCopiedBuffer(buffer_->data(), length_));
55 54
56 std::unique_ptr<base::ListValue> event_args(new base::ListValue); 55 std::unique_ptr<base::ListValue> event_args(new base::ListValue);
57 event_args->Append(std::move(options_as_value)); 56 event_args->Append(std::move(options_as_value));
58 57
59 return SendEvent( 58 return SendEvent(
60 request_id, 59 request_id,
61 extensions::events::FILE_SYSTEM_PROVIDER_ON_WRITE_FILE_REQUESTED, 60 extensions::events::FILE_SYSTEM_PROVIDER_ON_WRITE_FILE_REQUESTED,
62 extensions::api::file_system_provider::OnWriteFileRequested::kEventName, 61 extensions::api::file_system_provider::OnWriteFileRequested::kEventName,
63 std::move(event_args)); 62 std::move(event_args));
64 } 63 }
65 64
66 void WriteFile::OnSuccess(int /* request_id */, 65 void WriteFile::OnSuccess(int /* request_id */,
67 std::unique_ptr<RequestValue> /* result */, 66 std::unique_ptr<RequestValue> /* result */,
68 bool /* has_more */) { 67 bool /* has_more */) {
69 TRACE_EVENT0("file_system_provider", "WriteFile::OnSuccess"); 68 TRACE_EVENT0("file_system_provider", "WriteFile::OnSuccess");
70 callback_.Run(base::File::FILE_OK); 69 callback_.Run(base::File::FILE_OK);
71 } 70 }
72 71
73 void WriteFile::OnError(int /* request_id */, 72 void WriteFile::OnError(int /* request_id */,
74 std::unique_ptr<RequestValue> /* result */, 73 std::unique_ptr<RequestValue> /* result */,
75 base::File::Error error) { 74 base::File::Error error) {
76 TRACE_EVENT0("file_system_provider", "WriteFile::OnError"); 75 TRACE_EVENT0("file_system_provider", "WriteFile::OnError");
77 callback_.Run(error); 76 callback_.Run(error);
78 } 77 }
79 78
80 } // namespace operations 79 } // namespace operations
81 } // namespace file_system_provider 80 } // namespace file_system_provider
82 } // namespace chromeos 81 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698