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