You.i Engine
YiWebViewController.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_WEB_VIEW_CONTROLLER_H_
3 #define _YI_WEB_VIEW_CONTROLLER_H_
4 
6 #include "signal/YiSignal.h"
7 
8 class CYIUrl;
9 
37 {
38 public:
42  static std::unique_ptr<CYIWebViewController> CreateIfSupported();
43 
48  {
52  };
53 
57  struct Resource
58  {
61  };
62 
63  virtual ~CYIWebViewController();
64 
68  void LoadUrl(const CYIUrl &url);
69 
73  void LoadFile(const CYIString &pathToDocument);
74 
78  void LoadHTML(const CYIString &htmlString);
79 
85  virtual void NavigateBack() = 0;
86 
92  virtual void NavigateForward() = 0;
93 
97  virtual bool CanNavigateBack() = 0;
98 
102  virtual bool CanNavigateForward() = 0;
103 
107  virtual void ClearCache() = 0;
108 
114  const Resource &GetLastLoadedResource() const;
115 
123  virtual void Authenticate(const CYIString &username, const CYIString &password) = 0;
124 
130  virtual void CancelAuthentication() = 0;
131 
137  virtual void SetOverpullEnabled(bool bEnabled) = 0;
138 
156 
165  CYISignal<CYIString /*host*/, CYIString /*realm*/> AuthenticationRequired;
166 
173 
178 
183 
187  CYISignal<Resource, CYIString /*errorMessage*/> LoadingErrorOccurred;
188 
193 
194 protected:
196 
200  void NotifyLoadingStarted(const CYIString &webRequest);
201 
205  void NotifyLoadingFinished();
206 
210  void NotifyLoadingErrorOccurred(const CYIString &errorMessage);
211 
215  void NotifyAuthenticationRequired(const CYIString &realm, const CYIString &host);
216 
220  void NotifyLoadingCancelled();
221 
225  virtual void Load(const Resource &webViewResource) = 0;
226 
227 private:
229 
230  std::unique_ptr<CYIPlatformViewProxy> m_pPlatformViewProxy;
231  Resource m_lastLoadedResource;
232  Resource m_lastRequestedResource;
233  bool m_bLoadNewResource;
234 };
235 
236 
241 #endif
const Resource & GetLastLoadedResource() const
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:114
CYISignal< Resource > LoadingStarted
Definition: YiWebViewController.h:177
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
CYIPlatformViewProxy * GetPlatformViewProxy() const
void LoadHTML(const CYIString &htmlString)
virtual void NavigateBack()=0
virtual bool CanNavigateForward()=0
CYISignal< Resource > LoadingFinished
Definition: YiWebViewController.h:182
CYISignal< Resource, CYIString > LoadingErrorOccurred
Definition: YiWebViewController.h:187
CYISignal< CYIString, CYIString > AuthenticationRequired
Definition: YiWebViewController.h:165
virtual void Authenticate(const CYIString &username, const CYIString &password)=0
RESOURCE_TYPE eType
Definition: YiWebViewController.h:60
Represents a resource that has been loaded.
Definition: YiWebViewController.h:57
virtual ~CYIWebViewController()
CYISignal< Resource > RedirectOccurred
Definition: YiWebViewController.h:192
virtual void Load(const Resource &webViewResource)=0
virtual void ClearCache()=0
A class used to encapsulate an URL.
Definition: YiUrl.h:24
Definition: YiSignalHandler.h:174
Definition: YiWebViewController.h:51
Definition: YiWebViewController.h:49
static std::unique_ptr< CYIWebViewController > CreateIfSupported()
virtual void SetOverpullEnabled(bool bEnabled)=0
virtual void CancelAuthentication()=0
CYISignal< Resource > LoadingCancelled
Definition: YiWebViewController.h:172
Definition: YiWebViewController.h:50
CYIString string
Definition: YiWebViewController.h:59
virtual void NavigateForward()=0
void LoadFile(const CYIString &pathToDocument)
virtual bool CanNavigateBack()=0
A proxy representation for a platform-native view.
Definition: YiPlatformViewProxy.h:32
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:164
void NotifyLoadingStarted(const CYIString &webRequest)
RESOURCE_TYPE
Supported resource types.
Definition: YiWebViewController.h:47
void LoadUrl(const CYIUrl &url)
void NotifyAuthenticationRequired(const CYIString &realm, const CYIString &host)
void NotifyLoadingErrorOccurred(const CYIString &errorMessage)
Provides an interface to a platform web view, if available.
Definition: YiWebViewController.h:36