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
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_
6 #define CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_
11 #include "chrome/utility/utility_message_handler.h"
12 #include "media/base/data_source.h"
16 // Provides the metadata parser with bytes from the browser process via IPC.
17 class IPCDataSource
: public media::DataSource
,
18 public chrome::UtilityMessageHandler
{
20 explicit IPCDataSource(int64 total_size
);
21 virtual ~IPCDataSource();
23 // Implementation of DataSource.
24 virtual void set_host(media::DataSourceHost
* host
) OVERRIDE
;
25 virtual void Stop(const base::Closure
& callback
) OVERRIDE
;
26 virtual void Read(int64 position
, int size
, uint8
* data
,
27 const ReadCB
& read_cb
) OVERRIDE
;
28 virtual bool GetSize(int64
* size_out
) OVERRIDE
;
29 virtual bool IsStreaming() OVERRIDE
;
30 virtual void SetBitrate(int bitrate
) OVERRIDE
;
32 // Implementation of UtilityMessageHandler.
33 virtual bool OnMessageReceived(const IPC::Message
& message
) OVERRIDE
;
43 void OnRequestBlobBytesFinished(int64 request_id
,
44 const std::string
& bytes
);
46 const int64 total_size_
;
47 std::map
<int64
, Request
> pending_requests_
;
48 int64 next_request_id_
;
51 } // namespace metadata
53 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_