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

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

Issue 1391893003: NOT FOR REVIEW: Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 "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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 bool SerialGetDevicesFunction::Prepare() { 80 bool SerialGetDevicesFunction::Prepare() {
81 set_work_thread_id(BrowserThread::FILE); 81 set_work_thread_id(BrowserThread::FILE);
82 return true; 82 return true;
83 } 83 }
84 84
85 void SerialGetDevicesFunction::Work() { 85 void SerialGetDevicesFunction::Work() {
86 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 86 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
87 87
88 #if !defined(OS_ANDROID)
88 scoped_ptr<device::SerialDeviceEnumerator> enumerator = 89 scoped_ptr<device::SerialDeviceEnumerator> enumerator =
89 device::SerialDeviceEnumerator::Create(); 90 device::SerialDeviceEnumerator::Create();
90 mojo::Array<device::serial::DeviceInfoPtr> devices = enumerator->GetDevices(); 91 mojo::Array<device::serial::DeviceInfoPtr> devices = enumerator->GetDevices();
91 results_ = serial::GetDevices::Results::Create( 92 results_ = serial::GetDevices::Results::Create(
92 devices.To<std::vector<linked_ptr<serial::DeviceInfo> > >()); 93 devices.To<std::vector<linked_ptr<serial::DeviceInfo> > >());
94 #endif
93 } 95 }
94 96
95 SerialConnectFunction::SerialConnectFunction() { 97 SerialConnectFunction::SerialConnectFunction() {
96 } 98 }
97 99
98 SerialConnectFunction::~SerialConnectFunction() { 100 SerialConnectFunction::~SerialConnectFunction() {
99 } 101 }
100 102
101 bool SerialConnectFunction::Prepare() { 103 bool SerialConnectFunction::Prepare() {
102 params_ = serial::Connect::Params::Create(*args_); 104 params_ = serial::Connect::Params::Create(*args_);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 if (device->has_vendor_id) 488 if (device->has_vendor_id)
487 info->vendor_id.reset(new int(static_cast<int>(device->vendor_id))); 489 info->vendor_id.reset(new int(static_cast<int>(device->vendor_id)));
488 if (device->has_product_id) 490 if (device->has_product_id)
489 info->product_id.reset(new int(static_cast<int>(device->product_id))); 491 info->product_id.reset(new int(static_cast<int>(device->product_id)));
490 if (device->display_name) 492 if (device->display_name)
491 info->display_name.reset(new std::string(device->display_name)); 493 info->display_name.reset(new std::string(device->display_name));
492 return info; 494 return info;
493 } 495 }
494 496
495 } // namespace mojo 497 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698