~chrisccoulson/oxide/lp1504853

« back to all changes in this revision

Viewing changes to shared/browser/ssl/oxide_certificate_error_dispatcher.h

  • Committer: Chris Coulson
  • Date: 2015-10-15 08:32:01 UTC
  • Revision ID: chris.coulson@canonical.com-20151015083201-r9m505zjdm3g605c
Navigate to a placeholder transitional page for main frame certificate errors whilst waiting for a response

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// vim:expandtab:shiftwidth=2:tabstop=2:
 
2
// Copyright (C) 2015 Canonical Ltd.
 
3
 
 
4
// This library is free software; you can redistribute it and/or
 
5
// modify it under the terms of the GNU Lesser General Public
 
6
// License as published by the Free Software Foundation; either
 
7
// version 2.1 of the License, or (at your option) any later version.
 
8
 
 
9
// This library is distributed in the hope that it will be useful,
 
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
// Lesser General Public License for more details.
 
13
 
 
14
// You should have received a copy of the GNU Lesser General Public
 
15
// License along with this library; if not, write to the Free Software
 
16
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 
 
18
#ifndef _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_
 
19
#define _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_
 
20
 
 
21
#include "base/callback.h"
 
22
#include "base/macros.h"
 
23
#include "content/public/browser/certificate_request_result_type.h"
 
24
#include "content/public/browser/web_contents_user_data.h"
 
25
#include "content/public/common/resource_type.h"
 
26
 
 
27
class GURL;
 
28
 
 
29
namespace net {
 
30
class SSLInfo;
 
31
}
 
32
 
 
33
namespace oxide {
 
34
 
 
35
class CertificateError;
 
36
class CertificateErrorDispatcherClient;
 
37
 
 
38
// A helper class for dispatching certificate errors from Chromium to
 
39
// CertificateErrorDispatcherClient
 
40
class CertificateErrorDispatcher
 
41
    : public content::WebContentsUserData<CertificateErrorDispatcher> {
 
42
 public:
 
43
  ~CertificateErrorDispatcher();
 
44
 
 
45
  static void CreateForWebContents(content::WebContents* contents);
 
46
 
 
47
  // Entry point from Chromium
 
48
  static void AllowCertificateError(
 
49
      int render_process_id,
 
50
      int render_frame_id,
 
51
      int cert_error,
 
52
      const net::SSLInfo& ssl_info,
 
53
      const GURL& request_url,
 
54
      content::ResourceType resource_type,
 
55
      bool overridable,
 
56
      bool strict_enforcement,
 
57
      const base::Callback<void(bool)>& callback,
 
58
      content::CertificateRequestResultType* result);
 
59
 
 
60
  void set_client(CertificateErrorDispatcherClient* client) {
 
61
    client_ = client;
 
62
  }
 
63
 
 
64
 private:
 
65
  CertificateErrorDispatcher();
 
66
 
 
67
  bool CanDispatch() const;
 
68
  void Dispatch(scoped_ptr<CertificateError> error);
 
69
 
 
70
  CertificateErrorDispatcherClient* client_;
 
71
 
 
72
  DISALLOW_COPY_AND_ASSIGN(CertificateErrorDispatcher);
 
73
};
 
74
 
 
75
} // namespace oxide
 
76
 
 
77
#endif // _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_