Chromium Code Reviews| Index: chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc |
| diff --git a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc |
| index 0e50db9d3f208301b89290be6cfcf5cda89540f9..fca676a5eb47d66b99d789a1b3ba411735afe4e1 100644 |
| --- a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc |
| +++ b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.cc |
| @@ -109,6 +109,10 @@ std::string RemoveWwwPrefix(const std::string& url) { |
| return url; |
| } |
| +std::string FormatUrlForDisplay(const GURL& url) { |
| + return RemoveWwwPrefix(url.host()); |
|
Devlin
2017/02/07 18:39:24
Let's take the opportunity to make this a bit fast
karandeepb
2017/02/07 19:22:15
Done.
|
| +} |
| + |
| } // namespace |
| SettingsOverrides::SettingsOverrides() {} |
| @@ -148,13 +152,11 @@ bool SettingsOverridesHandler::Parse(Extension* extension, |
| if (info->search_engine) { |
| PermissionsParser::AddAPIPermission( |
| - extension, |
| - new SettingsOverrideAPIPermission( |
| - PermissionsInfo::GetInstance()->GetByID( |
| - APIPermission::kSearchProvider), |
| - RemoveWwwPrefix(CreateManifestURL(info->search_engine->search_url) |
| - ->GetOrigin() |
| - .host()))); |
| + extension, new SettingsOverrideAPIPermission( |
| + PermissionsInfo::GetInstance()->GetByID( |
| + APIPermission::kSearchProvider), |
| + FormatUrlForDisplay(*CreateManifestURL( |
| + info->search_engine->search_url)))); |
| } |
| if (!info->startup_pages.empty()) { |
| PermissionsParser::AddAPIPermission( |
| @@ -163,16 +165,15 @@ bool SettingsOverridesHandler::Parse(Extension* extension, |
| PermissionsInfo::GetInstance()->GetByID( |
| APIPermission::kStartupPages), |
| // We only support one startup page even though the type of the |
| - // manifest |
| - // property is a list, only the first one is used. |
| - RemoveWwwPrefix(info->startup_pages[0].GetContent()))); |
| + // manifest property is a list, only the first one is used. |
| + FormatUrlForDisplay(info->startup_pages[0]))); |
| } |
| if (info->homepage) { |
| PermissionsParser::AddAPIPermission( |
| extension, |
| new SettingsOverrideAPIPermission( |
| PermissionsInfo::GetInstance()->GetByID(APIPermission::kHomepage), |
| - RemoveWwwPrefix(info->homepage->GetContent()))); |
| + FormatUrlForDisplay(*(info->homepage)))); |
| } |
| extension->SetManifestData(manifest_keys::kSettingsOverride, |
| info.release()); |