Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * webview.cpp - Fawkes WebviewAspect initializer/finalizer 00004 * 00005 * Created: Thu Nov 25 23:12:01 2010 00006 * Copyright 2006-2010 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <aspect/inifins/webview.h> 00025 #include <aspect/webview.h> 00026 #include <core/threading/thread_finalizer.h> 00027 #include <webview/url_manager.h> 00028 #include <webview/nav_manager.h> 00029 00030 namespace fawkes { 00031 #if 0 /* just to make Emacs auto-indent happy */ 00032 } 00033 #endif 00034 00035 /** @class WebviewAspectIniFin <aspect/inifins/webview.h> 00036 * Initializer/finalizer for the WebviewAspect. 00037 * @author Tim Niemueller 00038 */ 00039 00040 /** Constructor. */ 00041 WebviewAspectIniFin::WebviewAspectIniFin() 00042 : AspectIniFin("WebviewAspect") 00043 { 00044 __url_manager = new WebUrlManager(); 00045 __nav_manager = new WebNavManager(); 00046 } 00047 00048 /** Destructor. */ 00049 WebviewAspectIniFin::~WebviewAspectIniFin() 00050 { 00051 delete __url_manager; 00052 delete __nav_manager; 00053 } 00054 00055 00056 void 00057 WebviewAspectIniFin::init(Thread *thread) 00058 { 00059 WebviewAspect *webview_thread; 00060 webview_thread = dynamic_cast<WebviewAspect *>(thread); 00061 if (webview_thread == NULL) { 00062 throw CannotInitializeThreadException("Thread '%s' claims to have the " 00063 "WebviewAspect, but RTTI says it " 00064 "has not. ", thread->name()); 00065 } 00066 00067 webview_thread->init_WebviewAspect(__url_manager, __nav_manager); 00068 } 00069 00070 00071 void 00072 WebviewAspectIniFin::finalize(Thread *thread) 00073 { 00074 WebviewAspect *webview_thread; 00075 webview_thread = dynamic_cast<WebviewAspect *>(thread); 00076 if (webview_thread == NULL) { 00077 throw CannotFinalizeThreadException("Thread '%s' claims to have the " 00078 "WebviewAspect, but RTTI says it " 00079 "has not. ", thread->name()); 00080 } 00081 } 00082 00083 } // end namespace fawkes