Browser.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 $Header$
00004 
00005 */
00006 
00007 #include "Error.h"
00008 #include "BrowserWarmStart.h"
00009 
00010 #include "Browser.h"
00011 
00012 // Protected methods.
00013 
00014 Browser::Browser(const ValueList &params) : Service<Browser>(params),
00015   _window(NULL)
00016 {
00017   CHECK_PARENT;
00018 
00019   BIND(profile__path);
00020   BIND(pref__name);
00021   BIND(pref__value);
00022 
00023   BIND(url);
00024   BIND(go);
00025   BIND(go__back);
00026   BIND(go__forward);
00027 
00028   int res;
00029 
00030   if (FAILED(res = start())) {
00031     failure(ERROR_BACKTRACE(res));
00032     return;
00033   }
00034 
00035 }
00036 
00037 Browser::~Browser()
00038 {
00039   if (_window)
00040     delete _window;
00041 }
00042 
00043 // Private methods.
00044 
00045 int Browser::start()
00046 {
00047   String profilePath;
00048   int res;
00049 
00050   if (FAILED(res = SET_SETTER(url, Browser::setUrl)))
00051     return ERROR_BACKTRACE(res);
00052 
00053   if (FAILED(res = REGISTRY_GET(Browser, profile__path, profilePath)))
00054     return ERROR_BACKTRACE(res);
00055 
00056   if (FAILED(res = BrowserWarmStart::init(profilePath)))
00057     return ERROR_BACKTRACE(res);
00058 
00059   _window = new BrowserWindow(profilePath);
00060   CHECK_CREATION(_window, "BrowserWindow");
00061 
00062   if (FAILED(res = CONNECT(_window, closed, this, Browser, uiClose)))
00063     return ERROR_BACKTRACE(res);
00064 
00065   if (FAILED(res = _window->show()))
00066     return ERROR_BACKTRACE(res);
00067 
00068   return OK;
00069 }
00070 
00071 int Browser::uiClose()
00072 {
00073   int res;
00074   if (FAILED(res = kill()))
00075     return ERROR_BACKTRACE(res);
00076   return OK;
00077 }
00078 
00079 // Registry getters and setters.
00080 
00081 int Browser::setUrl(const String &name, const String &url)
00082 {
00083   int res;
00084 
00085   if (FAILED(res = _window->load(url)))
00086     return ERROR_BACKTRACE(res);
00087   return OK;
00088 }

Generated on Thu Sep 6 20:11:25 2007 for Pylon Application Platform by  doxygen 1.5.1