1
// vim:expandtab:shiftwidth=2:tabstop=2:
2
// Copyright (C) 2015 Canonical Ltd.
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.
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.
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
18
#ifndef _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_
19
#define _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_
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"
35
class CertificateError;
36
class CertificateErrorDispatcherClient;
38
// A helper class for dispatching certificate errors from Chromium to
39
// CertificateErrorDispatcherClient
40
class CertificateErrorDispatcher
41
: public content::WebContentsUserData<CertificateErrorDispatcher> {
43
~CertificateErrorDispatcher();
45
static void CreateForWebContents(content::WebContents* contents);
47
// Entry point from Chromium
48
static void AllowCertificateError(
49
int render_process_id,
52
const net::SSLInfo& ssl_info,
53
const GURL& request_url,
54
content::ResourceType resource_type,
56
bool strict_enforcement,
57
const base::Callback<void(bool)>& callback,
58
content::CertificateRequestResultType* result);
60
void set_client(CertificateErrorDispatcherClient* client) {
65
CertificateErrorDispatcher();
67
bool CanDispatch() const;
68
void Dispatch(scoped_ptr<CertificateError> error);
70
CertificateErrorDispatcherClient* client_;
72
DISALLOW_COPY_AND_ASSIGN(CertificateErrorDispatcher);
77
#endif // _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_