Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / content / browser / loader / certificate_resource_handler.h
blob39f3e0e3b11404a75ad70e707978b84a8ac676d2
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_CERTIFICATE_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "content/browser/loader/resource_handler.h"
13 #include "net/base/mime_util.h"
15 namespace net {
16 class GrowableIOBuffer;
17 class URLRequest;
18 class URLRequestStatus;
19 } // namespace net
21 namespace content {
23 // This class handles certificate mime types such as:
24 // - "application/x-x509-user-cert"
25 // - "application/x-x509-ca-cert"
26 // - "application/x-pkcs12"
28 class CertificateResourceHandler : public ResourceHandler {
29 public:
30 explicit CertificateResourceHandler(net::URLRequest* request);
31 ~CertificateResourceHandler() override;
33 bool OnUploadProgress(uint64 position, uint64 size) override;
35 // Not needed, as this event handler ought to be the final resource.
36 bool OnRequestRedirected(const net::RedirectInfo& redirect_info,
37 ResourceResponse* resp,
38 bool* defer) override;
40 // Check if this indeed an X509 cert.
41 bool OnResponseStarted(ResourceResponse* resp, bool* defer) override;
43 // Pass-through implementation.
44 bool OnWillStart(const GURL& url, bool* defer) override;
46 // Pass-through implementation.
47 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override;
49 // Create a new buffer to store received data.
50 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
51 int* buf_size,
52 int min_size) override;
54 // A read was completed, maybe allocate a new buffer for further data.
55 bool OnReadCompleted(int bytes_read, bool* defer) override;
57 // Done downloading the certificate.
58 void OnResponseCompleted(const net::URLRequestStatus& urs,
59 const std::string& sec_info,
60 bool* defer) override;
62 // N/A to cert downloading.
63 void OnDataDownloaded(int bytes_downloaded) override;
65 private:
66 scoped_refptr<net::GrowableIOBuffer> buffer_;
67 net::CertificateMimeType cert_type_;
69 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler);
72 } // namespace content
74 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_