Add the default startup page in chromium

Source: Internet
Author: User

Configuration options for the startup page:

The default configuration for the startup page is generated by src\chrome\browser\prefs\session_startup_pref.cc

In the Registerprofileprefs function, you can see the configuration options.

  Registry->registerintegerpref (      prefs::krestoreonstartup,      typetoprefvalue (Getdefaultstartuptype ()),      user_prefs::P refregistrysyncable::syncable_pref);  Registry->registerlistpref (Prefs::kurlstorestoreonstartup,                             user_prefs::P refregistrysyncable::syncable_ PREF);

The Getdefaultstartuptype function returns the sessionstartuppref::D efault

In the function typetoprefvalue, you can see that its corresponding action is Kprefvaluenewtab, which is a new tab that is opened by default at startup, and the Start URL list is empty by default.

If you need to set the start page as a preset page, you can change the session_startup_pref.cc as follows.

For example, add http://www.baidu.com/to the default startup page.

First change the default type of Getdefaultstartuptype to Sessionstartuppref::urls

Staticsessionstartuppref::type Sessionstartuppref::getdefaultstartuptype () {#if defined (Os_chromeos)  return Sessionstartuppref::last; #else//  return Sessionstartuppref::D efault;  return sessionstartuppref::urls; #endif}

Increase the list of URLs for the launch, adding a function for this createdefaultstartupurllist

base::listvalue* createdefaultstartupurllist () {  std::vector<gurl> default_startup_urls;  Default_startup_urls.push_back (Gurl ("Http://<a target=_blank href=" http://www.baidu.com ">www.baidu.com< /a>/"));  scoped_ptr<base::listvalue> URLs (new base::listvalue);  for (size_t i = 0; i < default_startup_urls.size (); ++i) {Urls->set (static_cast<int> (i),  new base:: StringValue (Default_startup_urls[i].spec ()));  }  return Urls.release ();}

Add the configured ur list to the registerprofileprefs function.

  Registry->registerlistpref (Prefs::kurlstorestoreonstartup,  createdefaultstartupurllist (),  user_ Prefs::P refregistrysyncable::syncable_pref);

Once the compilation is complete, you can see that the default startup page has been changed to http://www.baidu.com/to see the settings




Add the default startup page in chromium

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.