Each page has a favicon, which needs to be used in the preservation of the history record. Under the content folder, this is not implemented.
Let's talk about my implementation process here:
There are methods in the web_contents_impl.cc file: Webcontentsimpl::onupdatefaviconurl
This method is the response method of browser process after the kernel resolves to favicon, after giving feedback to Chromium's browser process.
The implementation of this method is as follows:
For_each_observer (Webcontentsobserver, Observers_,
Didupdatefaviconurl (page_id, candidates));
The observer here is shell.cc.
I joined in shell.cc? Methods such as the following:
void Shell::D Idupdatefaviconurl (Int32 page_id,
Const std::vector<faviconurl>& candidates) {
Updatefaviconurl (page_id, candidates);
}
Then, join in the shell_android.cc file? Methods such as the following:
void Shell::updatefaviconurl (Int32 page_id,
Const std::vector<faviconurl>& candidates) {
jnienv* env = Attachcurrentthread ();
Gurl Favicon_url = Candidates.back (). Icon_url;
scopedjavalocalref<jstring> J_favicon_url = base::android::convertutf8tojavastring (env, Favicon_url.spec ());
Return Java_shell_updateshellfaviconurl (env, Java_object_.obj (), j_favicon_url.obj ());
}
That way, Shell.java will be able to get faviicon.
@CalledByNative
private void Updateshellfaviconurl (String faviconurl) {
Mshellfaviconurl = Faviconurl;
}