| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright (c) 2006-2008 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_BROWSER_RENDERER_HOST_MEDIA_RESOURCE_HANDLER_H_ | 
|  | 6 #define CHROME_BROWSER_RENDERER_HOST_MEDIA_RESOURCE_HANDLER_H_ | 
|  | 7 | 
|  | 8 #include "base/process.h" | 
|  | 9 #include "base/platform_file.h" | 
|  | 10 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 
|  | 11 #include "chrome/browser/renderer_host/resource_handler.h" | 
|  | 12 | 
|  | 13 // Used to complete a media resource request in response to resource load events | 
|  | 14 // from the resource dispatcher host. This handler only works asynchronously and | 
|  | 15 // tries to work with file for response data if possible. If a response data | 
|  | 16 // file is not available, it redirects calls to underlying handler. | 
|  | 17 class MediaResourceHandler : public ResourceHandler { | 
|  | 18  public: | 
|  | 19   MediaResourceHandler(ResourceHandler* resource_handler, | 
|  | 20                        ResourceDispatcherHost::Receiver* receiver, | 
|  | 21                        int render_process_host_id, | 
|  | 22                        int routing_id, | 
|  | 23                        base::ProcessHandle render_process, | 
|  | 24                        ResourceDispatcherHost* resource_dispatcher_host); | 
|  | 25 | 
|  | 26   // ResourceHandler implementation: | 
|  | 27   bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 
|  | 28   bool OnRequestRedirected(int request_id, const GURL& new_url); | 
|  | 29   bool OnResponseStarted(int request_id, ResourceResponse* response); | 
|  | 30   bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 
|  | 31                   int min_size); | 
|  | 32   bool OnReadCompleted(int request_id, int* bytes_read); | 
|  | 33   bool OnResponseCompleted(int request_id, const URLRequestStatus& status, | 
|  | 34                            const std::string& security_info); | 
|  | 35 | 
|  | 36  private: | 
|  | 37   ResourceDispatcherHost::Receiver* receiver_; | 
|  | 38   int render_process_host_id_; | 
|  | 39   int routing_id_; | 
|  | 40   base::ProcessHandle render_process_; | 
|  | 41   scoped_refptr<ResourceHandler> handler_; | 
|  | 42   ResourceDispatcherHost* rdh_; | 
|  | 43   bool has_file_handle_; | 
|  | 44   int64 position_; | 
|  | 45   int64 size_; | 
|  | 46 | 
|  | 47   DISALLOW_COPY_AND_ASSIGN(MediaResourceHandler); | 
|  | 48 }; | 
|  | 49 | 
|  | 50 #endif  // CHROME_BROWSER_RENDERER_HOST_MEDIA_RESOURCE_HANDLER_H_ | 
| OLD | NEW | 
|---|