| 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 "chromeos/dbus/lorgnette_manager_client.h" | 5 #include "chromeos/dbus/lorgnette_manager_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual ~ScanToStringCompletion() {} | 99 virtual ~ScanToStringCompletion() {} |
| 100 | 100 |
| 101 // Creates a file stream in |file| that will stream image data to | 101 // Creates a file stream in |file| that will stream image data to |
| 102 // a string that will be supplied to |callback|. Passes ownership | 102 // a string that will be supplied to |callback|. Passes ownership |
| 103 // of |this| to a returned callback. | 103 // of |this| to a returned callback. |
| 104 CompletionCallback Start(const ScanImageToStringCallback& callback, | 104 CompletionCallback Start(const ScanImageToStringCallback& callback, |
| 105 base::ScopedFD* fd) { | 105 base::ScopedFD* fd) { |
| 106 CHECK(!pipe_reader_.get()); | 106 CHECK(!pipe_reader_.get()); |
| 107 pipe_reader_.reset(new chromeos::PipeReaderForString( | 107 pipe_reader_.reset(new chromeos::PipeReaderForString( |
| 108 base::CreateTaskRunnerWithTraits( | 108 base::CreateTaskRunnerWithTraits( |
| 109 base::TaskTraits().MayBlock().WithShutdownBehavior( | 109 {base::MayBlock(), |
| 110 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)), | 110 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}), |
| 111 base::Bind(&ScanToStringCompletion::OnScanToStringDataCompleted, | 111 base::Bind(&ScanToStringCompletion::OnScanToStringDataCompleted, |
| 112 base::Unretained(this)))); | 112 base::Unretained(this)))); |
| 113 *fd = pipe_reader_->StartIO(); | 113 *fd = pipe_reader_->StartIO(); |
| 114 | 114 |
| 115 return base::Bind(&ScanToStringCompletion::OnScanToStringCompleted, | 115 return base::Bind(&ScanToStringCompletion::OnScanToStringCompleted, |
| 116 base::Owned(this), callback); | 116 base::Owned(this), callback); |
| 117 } | 117 } |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 // Called when a |pipe_reader_| completes reading scan data to a string. | 120 // Called when a |pipe_reader_| completes reading scan data to a string. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 LorgnetteManagerClient::~LorgnetteManagerClient() { | 213 LorgnetteManagerClient::~LorgnetteManagerClient() { |
| 214 } | 214 } |
| 215 | 215 |
| 216 // static | 216 // static |
| 217 LorgnetteManagerClient* LorgnetteManagerClient::Create() { | 217 LorgnetteManagerClient* LorgnetteManagerClient::Create() { |
| 218 return new LorgnetteManagerClientImpl(); | 218 return new LorgnetteManagerClientImpl(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace chromeos | 221 } // namespace chromeos |
| OLD | NEW |