ReactOS 0.4.15-dev-7924-g5949c20
BrowserNavigator Struct Reference

#include <webchild.h>

Collaboration diagram for BrowserNavigator:

Public Member Functions

 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 ()
 

Protected Attributes

SIfacePtr< IWebBrowser > _browser
 
String _new_url
 
String _new_html_txt
 
bool _browser_initialized
 

Detailed Description

Definition at line 506 of file webchild.h.

Constructor & Destructor Documentation

◆ BrowserNavigator()

BrowserNavigator::BrowserNavigator ( )

Definition at line 99 of file webchild.cpp.

100 : _browser_initialized(false)
101{
102}
bool _browser_initialized
Definition: webchild.h:521

Member Function Documentation

◆ attach()

void BrowserNavigator::attach ( IWebBrowser *  browser)

Definition at line 104 of file webchild.cpp.

105{
106 _browser = browser;
107}
SIfacePtr< IWebBrowser > _browser
Definition: webchild.h:518

Referenced by WebChildWindow::WebChildWindow().

◆ get_browser()

IWebBrowser * BrowserNavigator::get_browser ( )
inline

Definition at line 515 of file webchild.h.

515{return _browser.get();}

◆ goto_url()

void BrowserNavigator::goto_url ( LPCTSTR  url)

Definition at line 109 of file webchild.cpp.

110{
112 _browser->Navigate(BStr(url), NULL, NULL, NULL, NULL);
113 else {
114 _new_url = url;
115
116 _browser->Navigate(BStr(L"about:blank"), NULL, NULL, NULL, NULL);
117 }
118}
#define NULL
Definition: types.h:112
static const WCHAR url[]
Definition: encode.c:1432
#define L(x)
Definition: ntvdm.h:50
String _new_url
Definition: webchild.h:519

Referenced by WebChildWindow::jump_to_int(), and set_html_page().

◆ navigated()

void BrowserNavigator::navigated ( LPCTSTR  url)
Todo:
move this into DocumentComplete() ?

Definition at line 133 of file webchild.cpp.

134{
136
137 bool nav = false;
138
139 if (!_new_url.empty()) {
140 if (!_tcscmp(url,TEXT("about:blank")) && _new_url!=TEXT("about:blank")) {
141 _browser->Navigate(BStr(_new_url), NULL, NULL, NULL, NULL);
142 ++nav;
143 }
144
145 _new_url.erase();
146 }
147
148 if (!nav && !_new_html_txt.empty()) {
149 int len = _new_html_txt.length();
150 HGLOBAL hHtmlText = GlobalAlloc(GPTR, len);
151
152 if (!hHtmlText) {
153 T2nA_binary(_new_html_txt, (char*)hHtmlText, len);
154 _new_html_txt.erase();
155
156 SIfacePtr<IStream> pStream;
157 HRESULT hr = CreateStreamOnHGlobal(hHtmlText, TRUE, &pStream);
158
159 if (SUCCEEDED(hr)) {
160 SIfacePtr<IDispatch> pHtmlDoc;
161 CheckError(_browser->get_Document(&pHtmlDoc));
162
163 SIfacePtr<IPersistStreamInit> pPersistStreamInit;
164 pHtmlDoc.QueryInterface(IID_IPersistStreamInit, &pPersistStreamInit);
165
166 CheckError(pPersistStreamInit->InitNew());
167 CheckError(pPersistStreamInit->Load(pStream));
168 } else
169 GlobalFree(hHtmlText);
170 }
171 }
172}
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLenum GLsizei len
Definition: glext.h:6722
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define _tcscmp
Definition: tchar.h:1424
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define TEXT(s)
Definition: k32.h:26
const GUID IID_IPersistStreamInit
void CheckError(HRESULT hr)
Definition: shellclasses.h:167
HRESULT hr
Definition: shlfolder.c:183
String _new_html_txt
Definition: webchild.h:520
wrapper class for COM interface pointers
Definition: shellclasses.h:333
HRESULT QueryInterface(REFIID riid, I *p)
Definition: shellclasses.h:417
void T2nA_binary(LPCTSTR s, LPSTR d, int len)
Definition: webchild.cpp:127
#define GPTR
Definition: winbase.h:296

Referenced by DWebBrowserEvents2Impl::NavigateComplete2().

◆ set_html_page()

void BrowserNavigator::set_html_page ( const String html_txt)

Definition at line 120 of file webchild.cpp.

121{
122 _new_html_txt = html_txt;
123
124 goto_url(TEXT("about:blank"));
125}
void goto_url(LPCTSTR url)
Definition: webchild.cpp:109

Member Data Documentation

◆ _browser

SIfacePtr<IWebBrowser> BrowserNavigator::_browser
protected

Definition at line 518 of file webchild.h.

Referenced by attach(), goto_url(), and navigated().

◆ _browser_initialized

bool BrowserNavigator::_browser_initialized
protected

Definition at line 521 of file webchild.h.

Referenced by goto_url(), and navigated().

◆ _new_html_txt

String BrowserNavigator::_new_html_txt
protected

Definition at line 520 of file webchild.h.

Referenced by navigated(), and set_html_page().

◆ _new_url

String BrowserNavigator::_new_url
protected

Definition at line 519 of file webchild.h.

Referenced by goto_url(), and navigated().


The documentation for this struct was generated from the following files: