• BlackBerry Dynamics
  • Runtime library for iOS applications
  • 10.2.0.83
GDSafeUrl.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019 Blackberry Inc. All rights reserved.
3 //
4 
5 #pragma once
6 
7 #ifdef __cplusplus
8 #include <memory>
9 
10 
11 #ifndef GD_C_API
12 # if !defined(_WIN32)
13 # define GD_C_API __attribute__((visibility("default")))
14 # else
15 # define GD_C_API
16 # endif
17 #endif
18 
19 namespace GD {
20  class SafeUrl
21 
45  {
46  public:
47 
53  enum class UrlCheckResult {
56  UNKNOWN = 0,
59  SAFE = 1,
62  UNSAFE = 20
63  };
64 
65 
70  enum class UrlCheckError {
73  NONE = 0,
76  NETWORK = 1,
79  GENERAL = 2
80  };
81 
89 
90  public:
91 
92  SafeUrlResultItem(const UrlCheckResult& result, const UrlCheckError& error, const long long reference );
93 
94  public:
97  long long reference;
98  };
99 
107 
108  public:
109  virtual void completed( const SafeUrlResultItem& resultItem ) = 0;
110  virtual ~SafeUrlCallback() = default;
111  };
112 
113 
128  GD_C_API void checkUrl(const std::string &url, const std::weak_ptr<SafeUrlCallback> callback,
129  const long long reference = 0, const bool suppressUserPrompt = false) const;
130 
131 
132 
140  GD_C_API bool isSafeBrowsingEnabled();
141  };
142 
143 };
144 #endif
GD
Definition: GDKerberosAuthHandler.h:16
GD::SafeUrl::UrlCheckError::GENERAL
@ GENERAL
Another error was encountered whilst checking that the URL was safe.
GD::SafeUrl::SafeUrlResultItem::error
UrlCheckError error
Definition: GDSafeUrl.h:96
GD::SafeUrl::UrlCheckError::NETWORK
@ NETWORK
There was a networking error whilst trying to check that the URL was safe.
GD::SafeUrl::SafeUrlResultItem::result
UrlCheckResult result
Definition: GDSafeUrl.h:95
GD::SafeUrl::UrlCheckError::NONE
@ NONE
No error has been detected.
GD::SafeUrl::UrlCheckResult
UrlCheckResult
Result codes from testing if a URL is safe.
Definition: GDSafeUrl.h:53
GD::SafeUrl::SafeUrlResultItem::reference
long long reference
Definition: GDSafeUrl.h:97
GD::SafeUrl::UrlCheckResult::UNSAFE
@ UNSAFE
The URL is flagged as being unsafe or malicious and should not be called.
GD::SafeUrl::UrlCheckError
UrlCheckError
Error codes from testing if a URL is safe.
Definition: GDSafeUrl.h:70
GD::SafeUrl
Check that URLs are safe using BlackBerry Protect (C++).
Definition: GDSafeUrl.h:20
GD::SafeUrl::SafeUrlCallback::~SafeUrlCallback
virtual ~SafeUrlCallback()=default
GD::SafeUrl::SafeUrlCallback::completed
virtual void completed(const SafeUrlResultItem &resultItem)=0
GD::SafeUrl::SafeUrlResultItem
Item within the SafeURL callback.
Definition: GDSafeUrl.h:88
GD::SafeUrl::SafeUrlCallback
Callback object returned from SafeURL.
Definition: GDSafeUrl.h:106
GD::SafeUrl::isSafeBrowsingEnabled
bool isSafeBrowsingEnabled()
Determine if Safe Browsing is enabled.
GD::SafeUrl::SafeUrlResultItem::SafeUrlResultItem
SafeUrlResultItem(const UrlCheckResult &result, const UrlCheckError &error, const long long reference)
GD::SafeUrl::UrlCheckResult::SAFE
@ SAFE
The URL is deemed to be safe.
GD::SafeUrl::UrlCheckResult::UNKNOWN
@ UNKNOWN
The result could not be determined.
GD::SafeUrl::checkUrl
void checkUrl(const std::string &url, const std::weak_ptr< SafeUrlCallback > callback, const long long reference=0, const bool suppressUserPrompt=false) const
This function checks whether or not the url is safe to make an http request.