Home | History | Annotate | Download | only in tab_contents
      1 // Copyright (c) 2011 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_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_
      6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_
      7 #pragma once
      8 
      9 #include <map>
     10 
     11 #include "base/memory/linked_ptr.h"
     12 #include "content/browser/renderer_host/render_view_host_delegate.h"
     13 
     14 class SSLAddCertHandler;
     15 class SSLClientAuthHandler;
     16 class TabContents;
     17 
     18 class TabContentsSSLHelper : public RenderViewHostDelegate::SSL {
     19  public:
     20   explicit TabContentsSSLHelper(TabContents* tab_contents);
     21   virtual ~TabContentsSSLHelper();
     22 
     23   // RenderViewHostDelegate::SSL implementation:
     24   virtual void ShowClientCertificateRequestDialog(
     25       scoped_refptr<SSLClientAuthHandler> handler);
     26   virtual void OnVerifyClientCertificateError(
     27       scoped_refptr<SSLAddCertHandler> handler, int error_code);
     28   virtual void AskToAddClientCertificate(
     29       scoped_refptr<SSLAddCertHandler> handler);
     30   virtual void OnAddClientCertificateSuccess(
     31       scoped_refptr<SSLAddCertHandler> handler);
     32   virtual void OnAddClientCertificateError(
     33       scoped_refptr<SSLAddCertHandler> handler, int error_code);
     34   virtual void OnAddClientCertificateFinished(
     35       scoped_refptr<SSLAddCertHandler> handler);
     36 
     37  private:
     38   TabContents* tab_contents_;
     39 
     40   class SSLAddCertData;
     41   std::map<int, linked_ptr<SSLAddCertData> > request_id_to_add_cert_data_;
     42 
     43   SSLAddCertData* GetAddCertData(SSLAddCertHandler* handler);
     44 
     45   DISALLOW_COPY_AND_ASSIGN(TabContentsSSLHelper);
     46 };
     47 
     48 #endif  // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_
     49