int DocumentHost::SetFocusedFrameByElement(IHTMLElement* frame_element) { LOG(TRACE) << "Entering DocumentHost::SetFocusedFrameByElement"; HRESULT hr = S_OK; if (!frame_element) { this->focused_frame_window_ = NULL; return SUCCESS; } CComQIPtr<IHTMLFrameBase2> frame_base(frame_element); if (!frame_base) { LOG(WARN) << "IHTMLElement is not a FRAME or IFRAME element"; return ENOSUCHFRAME; } CComQIPtr<IHTMLWindow2> interim_result; hr = frame_base->get_contentWindow(&interim_result); if (FAILED(hr)) { LOGHR(WARN, hr) << "Cannot get contentWindow from IHTMLFrameBase2, call to IHTMLFrameBase2::get_contentWindow failed"; return ENOSUCHFRAME; } this->focused_frame_window_ = interim_result; return SUCCESS; }
int BrowserWrapper::SetFocusedFrameByElement(IHTMLElement *frame_element) { HRESULT hr = S_OK; if (!frame_element) { this->focused_frame_window_ = NULL; return SUCCESS; } CComQIPtr<IHTMLFrameBase2> frame_base(frame_element); if (!frame_base) { // IHTMLElement is not a FRAME or IFRAME element. return ENOSUCHFRAME; } CComQIPtr<IHTMLWindow2> interim_result; hr = frame_base->get_contentWindow(&interim_result); if (FAILED(hr)) { // Cannot get contentWindow from IHTMLFrameBase2. return ENOSUCHFRAME; } this->focused_frame_window_ = interim_result; return SUCCESS; }