• chromium 启动页设置


    启动页的设置方式有:

    1.  chrome.exe http://www.baidu.com  
    2. 但是由于所带的参数 不能打开webUI页面 

    所以我们需要改启动页的起始设置

    启动页写入文件在

    DefaultSecure Preferences

    // An integer pref. Holds one of several values:
    // 0: unused, previously indicated to open the homepage on startup
    // 1: restore the last session.
    // 2: this was used to indicate a specific session should be restored. It is
    //    no longer used, but saved to avoid conflict with old preferences.
    // 3: unused, previously indicated the user wants to restore a saved session.
    // 4: restore the URLs defined in kURLsToRestoreOnStartup.
    // 5: open the New Tab Page on startup.
    const char kRestoreOnStartup[] = "session.restore_on_startup";
    
    // The URLs to restore on startup or when the home button is pressed. The URLs
    // are only restored on startup if kRestoreOnStartup is 4.
    const char kURLsToRestoreOnStartup[] = "session.startup_urls";

    所以 我们很清楚的知道打开特定网页或者一组网页时是4

    kRestoreOnStartup = 4

    kURLsToRestoreOnStartup = ["chrome://security-check"...........];

    诸如此类的

    对应下面这个

    所以我们需要找到代码设置这里

    可以通过这个webUI页定位到相对应的位置

    srcchromerowserprefssession_startup_pref.cc 

    就是关于启动页设置的类  所以主要就是修改它

    在srcchromerowserchrome_browser_main.cc    

    刚开始肯定要初始化那些文件之类的所以要在那些文件设置完成之后再修改

    代码:

     //这边启动页面是要设置得...如果说有店铺得名字 表示的是通过打开店铺的 所以要打开webUI
      const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
      if (command_line->HasSwitch(switches::kStoreName)) {
        PrefService* prefs = profile_->GetPrefs();
        SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
        pref.type = SessionStartupPref::URLS;
        if (pref.urls.size()< 1)
          pref.urls.push_back(GURL("chrome://security-check/"));
        SessionStartupPref::SetStartupPref(prefs, pref);
      }
     

    我这里是90.0.4430.212 版本

  • 相关阅读:
    Postman+Newman+Git+JenKins+钉钉(接口自动化测试持续集成)CI_知识回顾与整理
    GitHub 使用入门
    python中json文件处理涉及的四个函数json.dumps()和json.loads()、json.dump()和json.load()的区分
    python实现:重复列表按重复次数排序
    python中lambda匿名函数的用法
    Python中各种符号的意义
    OSI七层协议和TCP/IP的4层、5层协议
    Jmeter中传参输入位置[chrome中区分是否json传参]
    Jmeter中http cookie Manager、Http Header Manager
    jQuery 获取屏幕高度、宽度
  • 原文地址:https://www.cnblogs.com/Galesaur-wcy/p/15022599.html
Copyright © 2020-2023  润新知