在ContentViewCore.java里:
@CalledByNative
private void setTitle(String title) {
getContentViewClient().onUpdateTitle(title);
}
这里会调用:WebChromeClient.onReceivedTitle.
调用ContentViewCore.setTitle的C++文件是:
content_view_core_impl.cc
void ContentViewCoreImpl::SetTitle(const base::string16& title) {
Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj());
}
在web_contents/web_contents_view_android.cc中
void WebContentsViewAndroid::SetPageTitle(const base::string16& title) {
if (content_view_core_)
content_view_core_->SetTitle(title);
}
然后调用:
WebContentsImpl::UpdateTitleForEntry() {
view_->SetPageTitle(final_title);
}
这里会接收msg:
RenderViewHostImpl::OnUpdateTitle
{}
void RenderViewImpl::UpdateTitle
{
Send(new ViewHostMsg_UpdateTitle(routing_id_, page_id_, shortened_title,
title_direction));
}
RenderViewImpl::didReceiveTitle{
UpdateTitle();
}
void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title)
{
if (m_webFrame->client())
m_webFrame->client()->didReceiveTitle(m_webFrame, title, WebTextDirectionLeftToRight);
}