ReactOS  0.4.12-dev-75-g00dd17e
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.

Referenced by WebChildWindow::WebChildWindow().

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

◆ get_browser()

IWebBrowser* BrowserNavigator::get_browser ( )
inline

Definition at line 515 of file webchild.h.

515 {return _browser.get();}
SIfacePtr< IWebBrowser > _browser
Definition: webchild.h:518

◆ goto_url()

void BrowserNavigator::goto_url ( LPCTSTR  url)

Definition at line 109 of file webchild.cpp.

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

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 }
String _new_url
Definition: webchild.h:519
SIfacePtr< IWebBrowser > _browser
Definition: webchild.h:518
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR url[]
Definition: encode.c:1432
static const WCHAR L[]
Definition: oid.c:1087
bool _browser_initialized
Definition: webchild.h:521

◆ navigated()

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

Definition at line 133 of file webchild.cpp.

Referenced by DWebBrowserEvents2Impl::NavigateComplete2().

134 {
135  _browser_initialized = true;
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
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define GPTR
Definition: winbase.h:293
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
void T2nA_binary(LPCTSTR s, LPSTR d, int len)
Definition: webchild.cpp:127
String _new_url
Definition: webchild.h:519
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
SIfacePtr< IWebBrowser > _browser
Definition: webchild.h:518
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HRESULT QueryInterface(REFIID riid, I *p)
Definition: shellclasses.h:417
const GUID IID_IPersistStreamInit
void CheckError(HRESULT hr)
Definition: shellclasses.h:167
GLenum GLsizei len
Definition: glext.h:6722
bool _browser_initialized
Definition: webchild.h:521
String _new_html_txt
Definition: webchild.h:520
#define TEXT(s)
Definition: k32.h:26
wrapper class for COM interface pointers
Definition: shellclasses.h:332
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ 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
String _new_html_txt
Definition: webchild.h:520
#define TEXT(s)
Definition: k32.h:26

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: