@@ -203,7 +203,12 @@ HWND Browser::GetContentWindowHandle() {
203
203
204
204
if (this ->window_handle () == NULL ) {
205
205
LOG (INFO) << " Restore window handle from tab" ;
206
- this ->set_window_handle (this ->GetTabWindowHandle ());
206
+ // GetBrowserWindowHandle gets the TabWindowClass window in IE 7 and 8,
207
+ // and the top-level window frame in IE 6. The window we need is the
208
+ // InternetExplorer_Server window.
209
+ HWND tab_window_handle = this ->GetBrowserWindowHandle ();
210
+ HWND content_window_handle = this ->FindContentWindowHandle (tab_window_handle);
211
+ this ->set_window_handle (content_window_handle);
207
212
}
208
213
209
214
return this ->window_handle ();
@@ -616,8 +621,8 @@ bool Browser::GetDocumentFromWindow(IHTMLWindow2* window,
616
621
return false ;
617
622
}
618
623
619
- HWND Browser::GetTabWindowHandle () {
620
- LOG (TRACE) << " Entering Browser::GetTabWindowHandle " ;
624
+ HWND Browser::GetBrowserWindowHandle () {
625
+ LOG (TRACE) << " Entering Browser::GetBrowserWindowHandle " ;
621
626
622
627
HWND hwnd = NULL ;
623
628
CComPtr<IServiceProvider> service_provider;
@@ -630,10 +635,8 @@ HWND Browser::GetTabWindowHandle() {
630
635
reinterpret_cast <void **>(&window));
631
636
if (SUCCEEDED (hr)) {
632
637
// This gets the TabWindowClass window in IE 7 and 8,
633
- // and the top-level window frame in IE 6. The window
634
- // we need is the InternetExplorer_Server window.
638
+ // and the top-level window frame in IE 6.
635
639
window->GetWindow (&hwnd);
636
- hwnd = this ->FindContentWindowHandle (hwnd);
637
640
} else {
638
641
LOGHR (WARN, hr) << " Unable to get window, call to IOleWindow::QueryService for SID_SShellBrowser failed" ;
639
642
}
@@ -644,6 +647,34 @@ HWND Browser::GetTabWindowHandle() {
644
647
return hwnd;
645
648
}
646
649
650
+ // HWND Browser::GetTabWindowHandle() {
651
+ // LOG(TRACE) << "Entering Browser::GetTabWindowHandle";
652
+ //
653
+ // HWND hwnd = NULL;
654
+ // CComPtr<IServiceProvider> service_provider;
655
+ // HRESULT hr = this->browser_->QueryInterface(IID_IServiceProvider,
656
+ // reinterpret_cast<void**>(&service_provider));
657
+ // if (SUCCEEDED(hr)) {
658
+ // CComPtr<IOleWindow> window;
659
+ // hr = service_provider->QueryService(SID_SShellBrowser,
660
+ // IID_IOleWindow,
661
+ // reinterpret_cast<void**>(&window));
662
+ // if (SUCCEEDED(hr)) {
663
+ // // This gets the TabWindowClass window in IE 7 and 8,
664
+ // // and the top-level window frame in IE 6. The window
665
+ // // we need is the InternetExplorer_Server window.
666
+ // window->GetWindow(&hwnd);
667
+ // hwnd = this->FindContentWindowHandle(hwnd);
668
+ // } else {
669
+ // LOGHR(WARN, hr) << "Unable to get window, call to IOleWindow::QueryService for SID_SShellBrowser failed";
670
+ // }
671
+ // } else {
672
+ // LOGHR(WARN, hr) << "Unable to get service, call to IWebBrowser2::QueryInterface for IID_IServiceProvider failed";
673
+ // }
674
+ //
675
+ // return hwnd;
676
+ // }
677
+
647
678
HWND Browser::GetActiveDialogWindowHandle () {
648
679
LOG (TRACE) << " Entering Browser::GetActiveDialogWindowHandle" ;
649
680
0 commit comments