Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / browser / loader / doomed_resource_handler.h
blob9533ef1c39301a0e1031b0944eeba4f6e0623920
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.
5 #ifndef CONTENT_BROWSER_LOADER_DOOMED_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_DOOMED_RESOURCE_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/loader/resource_handler.h"
11 namespace content {
13 // ResourceHandler that DCHECKs on all events but canceling and failing of
14 // requests while activated for a URLRequest.
15 class DoomedResourceHandler : public ResourceHandler {
16 public:
17 // As the DoomedResourceHandler is constructed and substituted from code
18 // of another ResourceHandler, we need to make sure that this other handler
19 // does not lose its last reference and gets destroyed by being substituted.
20 // Therefore, we retain a reference to |old_handler| that prevents the
21 // destruction.
22 explicit DoomedResourceHandler(scoped_ptr<ResourceHandler> old_handler);
23 virtual ~DoomedResourceHandler();
25 // ResourceHandler implementation:
26 virtual bool OnUploadProgress(int request_id,
27 uint64 position,
28 uint64 size) OVERRIDE;
29 virtual bool OnRequestRedirected(int request_id,
30 const GURL& new_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,
37 const GURL& url,
38 bool* defer) OVERRIDE;
39 virtual bool OnWillRead(int request_id,
40 net::IOBuffer** buf,
41 int* buf_size,
42 int min_size) OVERRIDE;
43 virtual bool OnReadCompleted(int request_id,
44 int bytes_read,
45 bool* defer) OVERRIDE;
46 virtual bool OnResponseCompleted(int request_id,
47 const net::URLRequestStatus& status,
48 const std::string& security_info) OVERRIDE;
49 virtual void OnDataDownloaded(int request_id,
50 int bytes_downloaded) OVERRIDE;
52 private:
53 scoped_ptr<ResourceHandler> old_handler_;
55 DISALLOW_COPY_AND_ASSIGN(DoomedResourceHandler);
58 } // namespace content
60 #endif // CONTENT_BROWSER_LOADER_DOOMED_RESOURCE_HANDLER_H_