Fawkes API Fawkes Development Version
webview.cpp
1
2/***************************************************************************
3 * webview.cpp - Webview aspect for Fawkes
4 *
5 * Created: Thu Nov 25 22:20:52 2010
6 * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#include <aspect/webview.h>
25
26namespace fawkes {
27
28/** @class WebviewAspect <aspect/webview.h>
29 * Thread aspect to provide web pages via Webview.
30 *
31 * The WebviewAspect differs from other aspects. It can be successfully
32 * initialized even if there currently is no plugin loaded to serve web
33 * pages. This is because the central interface, the WebUrlManager, is
34 * held by the WebviewAspectIniFin and thus processor can be registerd
35 * and deregistered all the time. The webview plugin itself has the
36 * WebviewAspect, but it uses its access to the WebUrlManager instance
37 * to serve requests and pass them on to the appropriate processor.
38 *
39 * It is guaranteed that if used properly from within plugins that
40 * init_WebviewAspect() is called before the thread is started and that
41 * you can access the webview request processor manager in the thread's
42 * init() method.
43 *
44 * @ingroup Aspects
45 * @author Tim Niemueller
46 */
47
48/** Constructor. */
50{
51 add_aspect("WebviewAspect");
52}
53
54/** Virtual empty Destructor. */
56{
57}
58
59/** Set URL manager.
60 * It is guaranteed that this is called for a logging thread before
61 * Thread::start() is called (when running regularly inside Fawkes).
62 * @param url_manager URL manager to register processors to
63 * @param nav_manager Navigation manager to add navigation entries
64 * @param request_manager Request manager to query request information
65 * @param rest_api_manager Manager to register REST APIs
66 * @see WebviewMaster
67 */
68void
70 WebNavManager * nav_manager,
71 WebRequestManager * request_manager,
72 WebviewRestApiManager *rest_api_manager)
73{
74 webview_url_manager = url_manager;
75 webview_nav_manager = nav_manager;
76 webview_request_manager = request_manager;
77 webview_rest_api_manager = rest_api_manager;
78}
79
80} // end namespace fawkes
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
Manage visible navigation entries.
Definition: nav_manager.h:34
Probides information about ongoing requests.
Manage URL mappings.
Definition: url_manager.h:40
WebRequestManager * webview_request_manager
Webview request manager.
Definition: webview.h:53
WebviewRestApiManager * webview_rest_api_manager
Webview REST API manager.
Definition: webview.h:55
WebNavManager * webview_nav_manager
Webview navigation manager.
Definition: webview.h:51
WebviewAspect()
Constructor.
Definition: webview.cpp:49
WebUrlManager * webview_url_manager
Webview request processor manager.
Definition: webview.h:49
void init_WebviewAspect(WebUrlManager *url_manager, WebNavManager *nav_manager, WebRequestManager *request_manager, WebviewRestApiManager *rest_api_manager)
Set URL manager.
Definition: webview.cpp:69
virtual ~WebviewAspect()
Virtual empty Destructor.
Definition: webview.cpp:55
Fawkes library namespace.