| Index: webkit/browser/blob/content_url_stream_reader_android.h
|
| diff --git a/webkit/browser/blob/content_url_stream_reader_android.h b/webkit/browser/blob/content_url_stream_reader_android.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c8925d56802fba57433fbe4922913724dafebce8
|
| --- /dev/null
|
| +++ b/webkit/browser/blob/content_url_stream_reader_android.h
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 2013 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.
|
| +
|
| +#ifndef WEBKIT_BROWSER_BLOB_CONTENT_URL_STREAM_READER_ANDROID_H_
|
| +#define WEBKIT_BROWSER_BLOB_CONTENT_URL_STREAM_READER_ANDROID_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "base/platform_file.h"
|
| +#include "base/time/time.h"
|
| +#include "url/gurl.h"
|
| +#include "webkit/browser/blob/file_stream_reader.h"
|
| +#include "webkit/browser/webkit_storage_browser_export.h"
|
| +
|
| +namespace base {
|
| +class TaskRunner;
|
| +}
|
| +
|
| +namespace net {
|
| +class FileStream;
|
| +}
|
| +
|
| +namespace webkit_blob {
|
| +
|
| +// A thin wrapper of net::FileStream to handle content url reading.
|
| +class WEBKIT_STORAGE_BROWSER_EXPORT ContentUrlStreamReader
|
| + : public NON_EXPORTED_BASE(FileStreamReader) {
|
| + public:
|
| + virtual ~ContentUrlStreamReader();
|
| +
|
| + // FileStreamReader overrides.
|
| + virtual int Read(net::IOBuffer* buf, int buf_len,
|
| + const net::CompletionCallback& callback) OVERRIDE;
|
| + virtual int64 GetLength(
|
| + const net::Int64CompletionCallback& callback) OVERRIDE;
|
| +
|
| + private:
|
| + friend class FileStreamReader;
|
| +
|
| + ContentUrlStreamReader(base::TaskRunner* task_runner,
|
| + const GURL& content_url_,
|
| + int64 initial_offset);
|
| +
|
| + // Methods to for handling file operations.
|
| + int Open(const net::CompletionCallback& callback);
|
| + void DidOpenContentUrl(
|
| + const net::CompletionCallback& callback,
|
| + int result);
|
| + void DidOpenForRead(
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| + const net::CompletionCallback& callback,
|
| + int open_result);
|
| + void DidSeekContentUrl(
|
| + const net::CompletionCallback& callback,
|
| + int64 seek_result);
|
| +
|
| + scoped_refptr<base::TaskRunner> task_runner_;
|
| + const GURL content_url_;
|
| + const int64 initial_offset_;
|
| + scoped_ptr<net::FileStream> stream_impl_;
|
| + base::WeakPtrFactory<ContentUrlStreamReader> weak_factory_;
|
| +};
|
| +
|
| +} // namespace webkit_blob
|
| +
|
| +#endif // WEBKIT_BROWSER_BLOB_CONTENT_URL_STREAM_READER_ANDROID_H_
|
|
|