Chromium on Web Access Favicon

Source: Internet
Author: User

Each page has a favicon, which is required for the history to be saved. In the content directory, this is not implemented.

Here's my implementation process:

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 add the following method in shell.cc:

void Shell::D Idupdatefaviconurl (Int32 page_id,
Const std::vector<faviconurl>& candidates) {
Updatefaviconurl (page_id, candidates);
}


Then, add the following method in the shell_android.cc file:

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 can 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.