| 211 | } |
| 212 | |
| 213 | void DocumentHost::SetFocusedFrameToParent() { |
| 214 | LOG(TRACE) << "Entering DocumentHost::SetFocusedFrameToParent"; |
| 215 | // Three possible outcomes. |
| 216 | // Outcome 1: Already at top-level browsing context. No-op. |
| 217 | if (this->focused_frame_window_ != NULL) { |
| 218 | CComPtr<IHTMLWindow2> parent_window; |
| 219 | HRESULT hr = this->focused_frame_window_->get_parent(&parent_window); |
| 220 | if (FAILED(hr)) { |
| 221 | LOGHR(WARN, hr) << "IHTMLWindow2::get_parent call failed."; |
| 222 | } |
| 223 | CComPtr<IHTMLWindow2> top_window; |
| 224 | hr = this->focused_frame_window_->get_top(&top_window); |
| 225 | if (FAILED(hr)) { |
| 226 | LOGHR(WARN, hr) << "IHTMLWindow2::get_top call failed."; |
| 227 | } |
| 228 | if (top_window.IsEqualObject(parent_window)) { |
| 229 | // Outcome 2: Focus is on a frame one level deep, making the |
| 230 | // parent the top-level browsing context. Set focused frame |
| 231 | // pointer to NULL. |
| 232 | this->focused_frame_window_ = NULL; |
| 233 | } else { |
| 234 | // Outcome 3: Focus is on a frame more than one level deep. |
| 235 | // Set focused frame pointer to parent frame. |
| 236 | this->focused_frame_window_ = parent_window; |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | int DocumentHost::SetFocusedFrameByIdentifier(VARIANT frame_identifier) { |
| 242 | LOG(TRACE) << "Entering DocumentHost::SetFocusedFrameByIdentifier"; |