summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/pipe_reader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/pipe_reader.cc')
-rw-r--r--chrome/browser/chromeos/pipe_reader.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/pipe_reader.cc b/chrome/browser/chromeos/pipe_reader.cc
index 2ed5e7c..8664e35 100644
--- a/chrome/browser/chromeos/pipe_reader.cc
+++ b/chrome/browser/chromeos/pipe_reader.cc
@@ -1,13 +1,28 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/pipe_reader.h"
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "base/file_path.h"
#include "base/scoped_ptr.h"
namespace chromeos {
+PipeReader::PipeReader(const FilePath& pipe_name)
+ : pipe_(NULL),
+ pipe_name_(pipe_name.value()) {
+}
+
+PipeReader::~PipeReader() {
+ if (pipe_)
+ fclose(pipe_);
+}
+
std::string PipeReader::Read(const uint32 bytes_to_read) {
scoped_array<char> buffer(new char[bytes_to_read]);
if (pipe_ || (pipe_ = fopen(pipe_name_.c_str(), "r"))) {