| OLD | NEW |
| 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 "extensions/browser/api/serial/serial_api.h" | 5 #include "extensions/browser/api/serial/serial_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 serial_event_dispatcher_ = SerialEventDispatcher::Get(browser_context()); | 125 serial_event_dispatcher_ = SerialEventDispatcher::Get(browser_context()); |
| 126 DCHECK(serial_event_dispatcher_); | 126 DCHECK(serial_event_dispatcher_); |
| 127 | 127 |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void SerialConnectFunction::AsyncWorkStart() { | 131 void SerialConnectFunction::AsyncWorkStart() { |
| 132 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 132 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 133 connection_ = CreateSerialConnection(params_->path, extension_->id()); | 133 connection_ = CreateSerialConnection(params_->path, extension_->id()); |
| 134 connection_->Open(*params_->options.get(), | 134 connection_->Open(*params_->options, |
| 135 base::Bind(&SerialConnectFunction::OnConnected, this)); | 135 base::Bind(&SerialConnectFunction::OnConnected, this)); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void SerialConnectFunction::OnConnected(bool success) { | 138 void SerialConnectFunction::OnConnected(bool success) { |
| 139 DCHECK(connection_); | 139 DCHECK(connection_); |
| 140 | 140 |
| 141 if (!success) { | 141 if (!success) { |
| 142 delete connection_; | 142 delete connection_; |
| 143 connection_ = NULL; | 143 connection_ = NULL; |
| 144 } | 144 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 if (device->has_vendor_id) | 486 if (device->has_vendor_id) |
| 487 info.vendor_id.reset(new int(static_cast<int>(device->vendor_id))); | 487 info.vendor_id.reset(new int(static_cast<int>(device->vendor_id))); |
| 488 if (device->has_product_id) | 488 if (device->has_product_id) |
| 489 info.product_id.reset(new int(static_cast<int>(device->product_id))); | 489 info.product_id.reset(new int(static_cast<int>(device->product_id))); |
| 490 if (device->display_name) | 490 if (device->display_name) |
| 491 info.display_name.reset(new std::string(device->display_name)); | 491 info.display_name.reset(new std::string(device->display_name)); |
| 492 return info; | 492 return info; |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace mojo | 495 } // namespace mojo |
| OLD | NEW |