OLD | NEW |
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/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 SerialWriteFunction::~SerialWriteFunction() { | 230 SerialWriteFunction::~SerialWriteFunction() { |
231 } | 231 } |
232 | 232 |
233 bool SerialWriteFunction::Prepare() { | 233 bool SerialWriteFunction::Prepare() { |
234 set_work_thread_id(BrowserThread::FILE); | 234 set_work_thread_id(BrowserThread::FILE); |
235 | 235 |
236 params_ = api::experimental_serial::Write::Params::Create(*args_); | 236 params_ = api::experimental_serial::Write::Params::Create(*args_); |
237 EXTENSION_FUNCTION_VALIDATE(params_.get()); | 237 EXTENSION_FUNCTION_VALIDATE(params_.get()); |
238 | 238 |
239 io_buffer_size_ = params_->data->GetSize(); | 239 io_buffer_size_ = params_->data.size(); |
240 io_buffer_ = new net::WrappedIOBuffer(params_->data->GetBuffer()); | 240 io_buffer_ = new net::WrappedIOBuffer(params_->data.data()); |
241 | 241 |
242 return true; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 void SerialWriteFunction::Work() { | 245 void SerialWriteFunction::Work() { |
246 int bytes_written = -1; | 246 int bytes_written = -1; |
247 SerialConnection* serial_connection = manager_->Get(params_->connection_id); | 247 SerialConnection* serial_connection = manager_->Get(params_->connection_id); |
248 if (serial_connection) | 248 if (serial_connection) |
249 bytes_written = serial_connection->Write(io_buffer_, io_buffer_size_); | 249 bytes_written = serial_connection->Write(io_buffer_, io_buffer_size_); |
250 else | 250 else |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 error_ = kSerialConnectionNotFoundError; | 365 error_ = kSerialConnectionNotFoundError; |
366 SetResult(Value::CreateBooleanValue(false)); | 366 SetResult(Value::CreateBooleanValue(false)); |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 bool SerialSetControlSignalsFunction::Respond() { | 370 bool SerialSetControlSignalsFunction::Respond() { |
371 return true; | 371 return true; |
372 } | 372 } |
373 | 373 |
374 } // namespace extensions | 374 } // namespace extensions |
OLD | NEW |