chore: make RenderProcessHostPrivilege enum class (#26050)

This commit is contained in:
Milan Burda 2020-10-21 02:47:04 +02:00 committed by GitHub
parent 56d1fafe66
commit 1ef803d2ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,11 +236,11 @@ const base::FilePath::StringPieceType kPathDelimiter = FILE_PATH_LITERAL(":");
// below. Extension, and isolated apps require different privileges to be // below. Extension, and isolated apps require different privileges to be
// granted to their RenderProcessHosts. This classification allows us to make // granted to their RenderProcessHosts. This classification allows us to make
// sure URLs are served by hosts with the right set of privileges. // sure URLs are served by hosts with the right set of privileges.
enum RenderProcessHostPrivilege { enum class RenderProcessHostPrivilege {
PRIV_NORMAL, Normal,
PRIV_HOSTED, Hosted,
PRIV_ISOLATED, Isolated,
PRIV_EXTENSION, Extension,
}; };
RenderProcessHostPrivilege GetPrivilegeRequiredByUrl( RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(
@ -253,12 +253,12 @@ RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(
// than normal webrenderer, the navigation logic will correct us out of band // than normal webrenderer, the navigation logic will correct us out of band
// anyways. // anyways.
if (!url.is_valid()) if (!url.is_valid())
return PRIV_NORMAL; return RenderProcessHostPrivilege::Normal;
if (!url.SchemeIs(extensions::kExtensionScheme)) if (!url.SchemeIs(extensions::kExtensionScheme))
return PRIV_NORMAL; return RenderProcessHostPrivilege::Normal;
return PRIV_EXTENSION; return RenderProcessHostPrivilege::Extension;
} }
RenderProcessHostPrivilege GetProcessPrivilege( RenderProcessHostPrivilege GetProcessPrivilege(
@ -268,9 +268,9 @@ RenderProcessHostPrivilege GetProcessPrivilege(
std::set<std::string> extension_ids = std::set<std::string> extension_ids =
process_map->GetExtensionsInProcess(process_host->GetID()); process_map->GetExtensionsInProcess(process_host->GetID());
if (extension_ids.empty()) if (extension_ids.empty())
return PRIV_NORMAL; return RenderProcessHostPrivilege::Normal;
return PRIV_EXTENSION; return RenderProcessHostPrivilege::Extension;
} }
const extensions::Extension* GetEnabledExtensionFromEffectiveURL( const extensions::Extension* GetEnabledExtensionFromEffectiveURL(