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

Side by Side Diff: chrome/browser/extensions/api/serial/serial_api.cc

Issue 10700194: Represent BINARY properties using std::string instead of BinaryValue, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo values.h change. Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/usb/usb_device_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/api/serial/serial_api.h" 5 #include "chrome/browser/extensions/api/serial/serial_api.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/api/api_resource_controller.h" 8 #include "chrome/browser/extensions/api/api_resource_controller.h"
9 #include "chrome/browser/extensions/api/serial/serial_connection.h" 9 #include "chrome/browser/extensions/api/serial/serial_connection.h"
10 #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h" 10 #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 SerialWriteFunction::~SerialWriteFunction() { 209 SerialWriteFunction::~SerialWriteFunction() {
210 } 210 }
211 211
212 bool SerialWriteFunction::Prepare() { 212 bool SerialWriteFunction::Prepare() {
213 set_work_thread_id(BrowserThread::FILE); 213 set_work_thread_id(BrowserThread::FILE);
214 214
215 params_ = api::experimental_serial::Write::Params::Create(*args_); 215 params_ = api::experimental_serial::Write::Params::Create(*args_);
216 EXTENSION_FUNCTION_VALIDATE(params_.get()); 216 EXTENSION_FUNCTION_VALIDATE(params_.get());
217 217
218 io_buffer_size_ = params_->data->GetSize(); 218 io_buffer_size_ = params_->data.size();
219 io_buffer_ = new net::WrappedIOBuffer(params_->data->GetBuffer()); 219 io_buffer_ = new net::WrappedIOBuffer(params_->data.data());
220 220
221 return true; 221 return true;
222 } 222 }
223 223
224 void SerialWriteFunction::Work() { 224 void SerialWriteFunction::Work() {
225 int bytes_written = -1; 225 int bytes_written = -1;
226 SerialConnection* serial_connection = 226 SerialConnection* serial_connection =
227 controller()->GetSerialConnection(params_->connection_id); 227 controller()->GetSerialConnection(params_->connection_id);
228 if (serial_connection) 228 if (serial_connection)
229 bytes_written = serial_connection->Write(io_buffer_, io_buffer_size_); 229 bytes_written = serial_connection->Write(io_buffer_, io_buffer_size_);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 result_.reset(Value::CreateBooleanValue(flush_result)); 265 result_.reset(Value::CreateBooleanValue(flush_result));
266 } 266 }
267 267
268 bool SerialFlushFunction::Respond() { 268 bool SerialFlushFunction::Respond() {
269 return true; 269 return true;
270 } 270 }
271 271
272 } // namespace extensions 272 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/usb/usb_device_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698