| 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 #ifndef CHROMEOS_DBUS_PIPE_READER_H_ | 5 #ifndef CHROMEOS_DBUS_PIPE_READER_H_ |
| 6 #define CHROMEOS_DBUS_PIPE_READER_H_ | 6 #define CHROMEOS_DBUS_PIPE_READER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(PipeReader); | 68 DISALLOW_COPY_AND_ASSIGN(PipeReader); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // PipeReader subclass which accepts incoming data to a string. | 71 // PipeReader subclass which accepts incoming data to a string. |
| 72 class PipeReaderForString : public PipeReader { | 72 class PipeReaderForString : public PipeReader { |
| 73 public: | 73 public: |
| 74 PipeReaderForString(const scoped_refptr<base::TaskRunner>& task_runner, | 74 PipeReaderForString(const scoped_refptr<base::TaskRunner>& task_runner, |
| 75 const IOCompleteCallback& callback); | 75 const IOCompleteCallback& callback); |
| 76 | 76 |
| 77 virtual void AcceptData(const char *data, int length) OVERRIDE; | 77 virtual void AcceptData(const char *data, int length) override; |
| 78 | 78 |
| 79 // Destructively returns collected data, by swapping |data_| with |data|. | 79 // Destructively returns collected data, by swapping |data_| with |data|. |
| 80 void GetData(std::string* data); | 80 void GetData(std::string* data); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 std::string data_; | 83 std::string data_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(PipeReaderForString); | 85 DISALLOW_COPY_AND_ASSIGN(PipeReaderForString); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace chromeos | 88 } // namespace chromeos |
| 89 | 89 |
| 90 #endif // CHROMEOS_DBUS_PIPE_READER_H_ | 90 #endif // CHROMEOS_DBUS_PIPE_READER_H_ |
| OLD | NEW |