diff --git a/reactos/subsys/system/explorer/shell/mainframe.cpp b/reactos/subsys/system/explorer/shell/mainframe.cpp index 6d8e1c0a372..9e1d6fffe2b 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.cpp +++ b/reactos/subsys/system/explorer/shell/mainframe.cpp @@ -623,8 +623,11 @@ int MainFrame::Command(int id, int code) break;} case ID_WEB_WINDOW: +#ifdef _DEBUG + create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://localhost"))); +#else create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.reactos.com"))); - //create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://localhost"))); +#endif break; ///@todo There are even more menu items! diff --git a/reactos/subsys/system/explorer/shell/webchild.cpp b/reactos/subsys/system/explorer/shell/webchild.cpp index be315837cd4..ac230b78d0f 100644 --- a/reactos/subsys/system/explorer/shell/webchild.cpp +++ b/reactos/subsys/system/explorer/shell/webchild.cpp @@ -101,12 +101,16 @@ void BStr::assign(const VARIANT& var) } -BrowserNavigator::BrowserNavigator(IWebBrowser* browser) - : _browser(browser), - _browser_initialized(false) +BrowserNavigator::BrowserNavigator() + : _browser_initialized(false) { } +void BrowserNavigator::attach(IWebBrowser* browser) +{ + _browser = browser; +} + void BrowserNavigator::goto_url(LPCTSTR url) { if (_browser_initialized) @@ -198,18 +202,17 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info) hr = create_control(hwnd, CLSID_MozillaBrowser, IID_IWebBrowser2); if (SUCCEEDED(hr)) { + _navigator.attach(_control); + HWND hwndFrame = GetParent(info._hmdiclient); // handling events using DWebBrowserEvents2 - _evt_handler = auto_ptr(new DWebBrowserEvents2Handler(_hwnd, hwndFrame, _control)); - - SIfacePtr browser(get_browser()); + _evt_handler = auto_ptr(new DWebBrowserEvents2Handler(_hwnd, hwndFrame, _navigator)); #ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004) Variant vtMissing; #endif - - browser->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); + get_browser()->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); //browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); } } diff --git a/reactos/subsys/system/explorer/shell/webchild.h b/reactos/subsys/system/explorer/shell/webchild.h index 6c6767956ed..2bf19b20161 100644 --- a/reactos/subsys/system/explorer/shell/webchild.h +++ b/reactos/subsys/system/explorer/shell/webchild.h @@ -569,12 +569,15 @@ struct DWebBrowserEvents2IF // die nicht auf das Internet zugreift (z.B. addcom/./index.html) dargestellt werden kann. struct ANSUNC BrowserNavigator { - BrowserNavigator(IWebBrowser* browser); + BrowserNavigator(); + void attach(IWebBrowser* browser); void goto_url(LPCTSTR url); void set_html_page(const String& html_txt); void navigated(LPCTSTR url); + IWebBrowser* get_browser() {return _browser.get();} + protected: SIfacePtr _browser; String _new_url; @@ -889,13 +892,13 @@ struct DWebBrowserEvents2Handler : public DWebBrowserEvents2Impl { typedef DWebBrowserEvents2Impl super; - DWebBrowserEvents2Handler(HWND hwnd, HWND hwndFrame, IWebBrowser* browser) - : _hwnd(hwnd), + DWebBrowserEvents2Handler(HWND hwnd, HWND hwndFrame, BrowserNavigator& navigator) + : DWebBrowserEvents2Impl(navigator), + _hwnd(hwnd), _hwndFrame(hwndFrame), - _navigator(browser), - DWebBrowserEvents2Impl(_navigator), - _browser(browser, IID_IWebBrowser2), - _connector(browser, DIID_DWebBrowserEvents2, this) + _navigator(navigator), + _browser(navigator.get_browser(), IID_IWebBrowser2), + _connector(navigator.get_browser(), DIID_DWebBrowserEvents2, this) { } @@ -1058,7 +1061,7 @@ protected: protected: HWND _hwnd; HWND _hwndFrame; - BrowserNavigator _navigator; + BrowserNavigator& _navigator; SIfacePtr _browser; EventConnector _connector; }; @@ -1087,6 +1090,7 @@ struct WebChildWindow : public IPCtrlWindow } protected: + BrowserNavigator _navigator; auto_ptr _evt_handler; LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam); diff --git a/reactos/subsys/system/explorer/utility/shellclasses.h b/reactos/subsys/system/explorer/utility/shellclasses.h index 78abdb01a66..e31d7d14c5f 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.h +++ b/reactos/subsys/system/explorer/utility/shellclasses.h @@ -405,6 +405,11 @@ template struct SIfacePtr return _p->QueryInterface(riid, (LPVOID*)p); } + T* get() + { + return _p; + } + void Free() { T* h = _p;