Home | History | Annotate | Download | only in loader
      1 // Copyright (c) 2012 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 CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_
      6 #define CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_
      7 
      8 #include "base/memory/scoped_ptr.h"
      9 #include "content/browser/loader/resource_handler.h"
     10 #include "content/common/content_export.h"
     11 
     12 namespace net {
     13 class URLRequest;
     14 }  // namespace net
     15 
     16 namespace content {
     17 
     18 // A ResourceHandler that simply delegates all calls to a next handler.  This
     19 // class is intended to be subclassed.
     20 class CONTENT_EXPORT LayeredResourceHandler : public ResourceHandler {
     21  public:
     22   LayeredResourceHandler(net::URLRequest* request,
     23                          scoped_ptr<ResourceHandler> next_handler);
     24   virtual ~LayeredResourceHandler();
     25 
     26   // ResourceHandler implementation:
     27   virtual void SetController(ResourceController* controller) OVERRIDE;
     28   virtual bool OnUploadProgress(int request_id, uint64 position,
     29                                 uint64 size) OVERRIDE;
     30   virtual bool OnRequestRedirected(int request_id, const GURL& url,
     31                                    ResourceResponse* response,
     32                                    bool* defer) OVERRIDE;
     33   virtual bool OnResponseStarted(int request_id,
     34                                  ResourceResponse* response,
     35                                  bool* defer) OVERRIDE;
     36   virtual bool OnWillStart(int request_id, const GURL& url,
     37                            bool* defer) OVERRIDE;
     38   virtual bool OnWillRead(int request_id,
     39                           scoped_refptr<net::IOBuffer>* buf,
     40                           int* buf_size,
     41                           int min_size) OVERRIDE;
     42   virtual bool OnReadCompleted(int request_id, int bytes_read,
     43                                bool* defer) OVERRIDE;
     44   virtual void OnResponseCompleted(int request_id,
     45                                    const net::URLRequestStatus& status,
     46                                    const std::string& security_info,
     47                                    bool* defer) OVERRIDE;
     48   virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE;
     49 
     50   scoped_ptr<ResourceHandler> next_handler_;
     51 };
     52 
     53 }  // namespace content
     54 
     55 #endif  // CONTENT_BROWSER_LOADER_LAYERED_RESOURCE_HANDLER_H_
     56