Chromium on Web Access Favicon

Source: Internet
Author: User

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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.