Fix identification of focused frame (issue #1381).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1840 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-09-19 19:12:44 +00:00
parent 3850498939
commit c17cd60630
7 changed files with 48 additions and 67 deletions

View File

@ -2367,6 +2367,23 @@ void CefBrowserHostImpl::DidFailLoad(
OnLoadEnd(frame, validated_url, error_code);
}
void CefBrowserHostImpl::FrameDetached(
content::RenderFrameHost* render_frame_host) {
base::AutoLock lock_scope(state_lock_);
const int64 frame_id = render_frame_host->GetRoutingID();
FrameMap::iterator it = frames_.find(frame_id);
if (it != frames_.end()) {
it->second->Detach();
frames_.erase(it);
}
if (main_frame_id_ == frame_id)
main_frame_id_ = CefFrameHostImpl::kInvalidFrameId;
if (focused_frame_id_ == frame_id)
focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId;
}
void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) {
if (client_.get()) {
@ -2385,8 +2402,6 @@ bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(CefBrowserHostImpl, message)
IPC_MESSAGE_HANDLER(CefHostMsg_FrameIdentified, OnFrameIdentified)
IPC_MESSAGE_HANDLER(CefHostMsg_FrameDetached, DetachFrame)
IPC_MESSAGE_HANDLER(CefHostMsg_FrameFocusChange, SetFocusedFrame)
IPC_MESSAGE_HANDLER(CefHostMsg_DidFinishLoad, OnDidFinishLoad)
IPC_MESSAGE_HANDLER(CefHostMsg_LoadingURLChange, OnLoadingURLChange)
IPC_MESSAGE_HANDLER(CefHostMsg_Request, OnRequest)
@ -2692,21 +2707,6 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
return frame.get();
}
void CefBrowserHostImpl::DetachFrame(int64 frame_id) {
base::AutoLock lock_scope(state_lock_);
FrameMap::iterator it = frames_.find(frame_id);
if (it != frames_.end()) {
it->second->Detach();
frames_.erase(it);
}
if (main_frame_id_ == frame_id)
main_frame_id_ = CefFrameHostImpl::kInvalidFrameId;
if (focused_frame_id_ == frame_id)
focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId;
}
void CefBrowserHostImpl::DetachAllFrames() {
FrameMap frames;