| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/renderer_host/resource_handler.h" | 12 #include "chrome/browser/renderer_host/resource_handler.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 namespace net { |
| 16 class URLRequest; |
| 17 } // namespace net |
| 18 |
| 15 class ResourceDispatcherHost; | 19 class ResourceDispatcherHost; |
| 16 class URLRequest; | |
| 17 class URLRequestStatus; | 20 class URLRequestStatus; |
| 18 struct DownloadBuffer; | 21 struct DownloadBuffer; |
| 19 | 22 |
| 20 // This class handles the "application/x-x509-user-cert" mime-type | 23 // This class handles the "application/x-x509-user-cert" mime-type |
| 21 // which is a certificate generated by a CA after a previous | 24 // which is a certificate generated by a CA after a previous |
| 22 // <keygen> form post. | 25 // <keygen> form post. |
| 23 | 26 |
| 24 class X509UserCertResourceHandler : public ResourceHandler { | 27 class X509UserCertResourceHandler : public ResourceHandler { |
| 25 public: | 28 public: |
| 26 X509UserCertResourceHandler(ResourceDispatcherHost* host, | 29 X509UserCertResourceHandler(ResourceDispatcherHost* host, |
| 27 URLRequest* request, | 30 net::URLRequest* request, |
| 28 int render_process_host_id, int render_view_id); | 31 int render_process_host_id, int render_view_id); |
| 29 | 32 |
| 30 bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 33 bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 31 | 34 |
| 32 // Not needed, as this event handler ought to be the final resource. | 35 // Not needed, as this event handler ought to be the final resource. |
| 33 bool OnRequestRedirected(int request_id, const GURL& url, | 36 bool OnRequestRedirected(int request_id, const GURL& url, |
| 34 ResourceResponse* resp, bool* defer); | 37 ResourceResponse* resp, bool* defer); |
| 35 | 38 |
| 36 // Check if this indeed an X509 cert. | 39 // Check if this indeed an X509 cert. |
| 37 bool OnResponseStarted(int request_id, ResourceResponse* resp); | 40 bool OnResponseStarted(int request_id, ResourceResponse* resp); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 | 56 |
| 54 void OnRequestClosed(); | 57 void OnRequestClosed(); |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 ~X509UserCertResourceHandler(); | 60 ~X509UserCertResourceHandler(); |
| 58 | 61 |
| 59 void AssembleResource(); | 62 void AssembleResource(); |
| 60 | 63 |
| 61 GURL url_; | 64 GURL url_; |
| 62 ResourceDispatcherHost* host_; | 65 ResourceDispatcherHost* host_; |
| 63 URLRequest* request_; | 66 net::URLRequest* request_; |
| 64 size_t content_length_; | 67 size_t content_length_; |
| 65 scoped_ptr<DownloadBuffer> buffer_; | 68 scoped_ptr<DownloadBuffer> buffer_; |
| 66 scoped_refptr<net::IOBuffer> read_buffer_; | 69 scoped_refptr<net::IOBuffer> read_buffer_; |
| 67 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 70 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. |
| 68 static const int kReadBufSize = 32768; | 71 static const int kReadBufSize = 32768; |
| 69 // The id of the |RenderProcessHost| which started the download. | 72 // The id of the |RenderProcessHost| which started the download. |
| 70 int render_process_host_id_; | 73 int render_process_host_id_; |
| 71 // The id of the |RenderView| which started the download. | 74 // The id of the |RenderView| which started the download. |
| 72 int render_view_id_; | 75 int render_view_id_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); | 77 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 #endif // CHROME_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 80 #endif // CHROME_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ |
| OLD | NEW |