~osomon/oxide/camera-names-i18n

« back to all changes in this revision

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

  • Committer: Chris Coulson
  • Date: 2016-04-20 16:54:36 UTC
  • Revision ID: chris.coulson@canonical.com-20160420165436-4dpm7x985qytm8fl
CertificateErrorDispatcherClient only has a single method, so just convert it in to a callback. In addition to that, add thorough unit tests for CertificateErrorDispatcher

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#ifndef _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_
19
19
#define _OXIDE_SHARED_BROWSER_SSL_CERTIFICATE_ERROR_DISPATCHER_H_
20
20
 
 
21
#include <memory>
 
22
 
21
23
#include "base/callback.h"
22
24
#include "base/macros.h"
23
 
#include "base/memory/scoped_ptr.h"
24
25
#include "content/public/browser/certificate_request_result_type.h"
25
26
#include "content/public/browser/web_contents_user_data.h"
26
27
#include "content/public/common/resource_type.h"
36
37
namespace oxide {
37
38
 
38
39
class CertificateError;
39
 
class CertificateErrorDispatcherClient;
40
40
 
41
41
// A helper class for dispatching certificate errors from Chromium to
42
 
// CertificateErrorDispatcherClient
 
42
// the provided callback
43
43
class OXIDE_SHARED_EXPORT CertificateErrorDispatcher
44
44
    : public content::WebContentsUserData<CertificateErrorDispatcher> {
45
45
 public:
63
63
      const base::Callback<void(bool)>& callback,
64
64
      content::CertificateRequestResultType* result);
65
65
 
66
 
  void set_client(CertificateErrorDispatcherClient* client) {
67
 
    client_ = client;
68
 
  }
 
66
  using Callback = base::Callback<void(std::unique_ptr<CertificateError>)>;
 
67
 
 
68
  void SetCallback(const Callback& callback);
69
69
 
70
70
 private:
71
71
  CertificateErrorDispatcher();
72
72
 
73
73
  bool CanDispatch() const;
74
 
  void Dispatch(scoped_ptr<CertificateError> error);
 
74
  void Dispatch(std::unique_ptr<CertificateError> error);
75
75
 
76
 
  CertificateErrorDispatcherClient* client_;
 
76
  Callback callback_;
77
77
 
78
78
  DISALLOW_COPY_AND_ASSIGN(CertificateErrorDispatcher);
79
79
};