| 312 | } |
| 313 | |
| 314 | HWND Browser::GetContentWindowHandle() { |
| 315 | LOG(TRACE) << "Entering Browser::GetContentWindowHandle"; |
| 316 | |
| 317 | HWND current_content_window_handle = this->window_handle(); |
| 318 | // If this window is closing, the only reason to care about |
| 319 | // a valid window handle is to check for alerts whose parent |
| 320 | // is this window handle, so return the stored window handle. |
| 321 | if (!this->is_closing()) { |
| 322 | // If, for some reason, the window handle is no longer valid, set the |
| 323 | // member variable to NULL so that we can reacquire the valid window |
| 324 | // handle. Note that this can happen when browsing from one type of |
| 325 | // content to another, like from HTML to a transformed XML page that |
| 326 | // renders content. If the member variable is NULL upon entering this |
| 327 | // method, that is okay, as it typically means only that this object |
| 328 | // is newly constructed, and has not yet had its handle set. |
| 329 | bool window_handle_is_valid = ::IsWindow(current_content_window_handle); |
| 330 | if (!window_handle_is_valid) { |
| 331 | LOG(INFO) << "Flushing window handle as it is no longer valid"; |
| 332 | this->set_window_handle(NULL); |
| 333 | } |
| 334 | |
| 335 | if (this->window_handle() == NULL) { |
| 336 | LOG(INFO) << "Restore window handle from tab"; |
| 337 | // GetBrowserWindowHandle gets the TabWindowClass window in IE 7 and 8, |
| 338 | // and the top-level window frame in IE 6. The window we need is the |
| 339 | // InternetExplorer_Server window. |
| 340 | HWND tab_window_handle = this->GetBrowserWindowHandle(); |
| 341 | if (tab_window_handle == NULL) { |
| 342 | LOG(WARN) << "No tab window found"; |
| 343 | } |
| 344 | HWND content_window_handle = this->FindContentWindowHandle(tab_window_handle); |
| 345 | this->set_window_handle(content_window_handle); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | return this->window_handle(); |
| 350 | } |
| 351 | |
| 352 | std::string Browser::GetWindowName() { |
| 353 | LOG(TRACE) << "Entering Browser::GetWindowName"; |
no test coverage detected