OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ | |
6 #define CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "chrome/utility/utility_message_handler.h" | |
11 #include "media/base/data_source.h" | |
12 | |
13 namespace metadata { | |
14 | |
15 // Provides the metadata parser with bytes from the browser process via IPC. | |
16 class IPCDataSource: public media::DataSource, | |
17 public chrome::UtilityMessageHandler { | |
18 public: | |
19 explicit IPCDataSource(int64 total_size); | |
20 virtual ~IPCDataSource(); | |
21 | |
22 // Implementation of DataSource. | |
23 virtual void set_host(media::DataSourceHost* host) OVERRIDE; | |
24 virtual void Stop(const base::Closure& callback) OVERRIDE; | |
25 virtual void Read(int64 position, int size, uint8* data, | |
26 const ReadCB& read_cb) OVERRIDE; | |
27 virtual bool GetSize(int64* size_out) OVERRIDE; | |
28 virtual bool IsStreaming() OVERRIDE; | |
29 virtual void SetBitrate(int bitrate) OVERRIDE; | |
30 | |
31 // Implementation of UtilityMessageHandler. | |
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
33 | |
34 private: | |
35 struct Request { | |
36 Request(); | |
37 ~Request(); | |
38 uint8* destination; | |
39 ReadCB callback; | |
40 }; | |
41 | |
42 void OnRequestBlobBytesFinished(int64 request_id, | |
43 const std::string& bytes); | |
44 | |
45 int64 total_size_; | |
Lei Zhang
2014/01/10 20:46:09
const
tommycli
2014/01/10 22:41:08
Done.
| |
46 std::map<int64, Request> pending_requests_; | |
47 int64 next_request_id_; | |
48 }; | |
49 | |
50 } // namespace metadata | |
51 | |
52 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IPC_DATA_SOURCE_H_ | |
OLD | NEW |