Cannot use chrome_settings_overrides for overriding Search Provider

二次信任 提交于 2020-12-06 06:58:47

问题


I have the following declaration in my manifest.json, following Google's instructions:

{
  ...
  "chrome_settings_overrides": {
    "search_provider": {
      "name": "My Name",
      "keyword": "My Keyword",
      "favicon_url": "icon32.png",
      "search_url": "http://example.com/Home/Search?keyword={searchTerms}",
      "encoding": "UTF-8",
      "is_default": true
    }
  },
  ...
}

However, I cannot load the manifest with that part at all (removing it will make it work). The message is receive is:

Failed to load extension from: D:\Chrome\SearchExtensions Empty dictionary for 'chrome_settings_overrides'.

What am I doing wrong? What is the proper way doing this?


回答1:


The documentation says about "favicon_url":

may only be omitted if prepopulated_id is set.

And "favicon_url" must be a fully qualified http or https url according to chromium source code:

if (!CreateManifestURL(*overrides->search_provider->favicon_url)) {
  *error = ...
.........................................
// CreateManifestURL function:
if (!manifest_url->is_valid() ||
    !manifest_url->SchemeIsHTTPOrHTTPS())
  return std::unique_ptr<GURL>();  // <<<< returns an empty value that sets the error


来源:https://stackoverflow.com/questions/39177401/cannot-use-chrome-settings-overrides-for-overriding-search-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!