Chromium Code Reviews| Index: chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| index 8f2edcd0c7b07c1d13c637eff1042f1a1c57b671..1024f83fd54ff44c8a8510d7d540339e902e4216 100644 |
| --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| @@ -65,6 +65,27 @@ bool GetSecurityLevelForFieldTrialGroup(const std::string& group, |
| return true; |
| } |
| +ToolbarModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial() { |
| + std::string choice = base::CommandLine::ForCurrentProcess()-> |
| + GetSwitchValueASCII(switches::kMarkNonSecureAs); |
| + if (choice == switches::kMarkNonSecureAsNeutral) |
| + return ToolbarModel::NONE; |
| + else if (choice == switches::kMarkNonSecureAsDubious) |
|
sky
2015/01/22 21:56:47
nit: (chromium) style guide say no else after retu
palmer
2015/01/22 22:01:01
Done.
|
| + return ToolbarModel::SECURITY_WARNING; |
| + else if (choice == switches::kMarkNonSecureAsNonSecure) |
| + return ToolbarModel::SECURITY_ERROR; |
| + |
| + std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); |
|
sky
2015/01/22 21:56:47
Is it common not to use constants for this?
palmer
2015/01/22 22:01:01
Searching the code shows about 50/50.
|
| + if (group == switches::kMarkNonSecureAsNeutral) |
| + return ToolbarModel::NONE; |
| + else if (group == switches::kMarkNonSecureAsDubious) |
| + return ToolbarModel::SECURITY_WARNING; |
| + else if (group == switches::kMarkNonSecureAsNonSecure) |
| + return ToolbarModel::SECURITY_ERROR; |
| + |
| + return ToolbarModel::NONE; |
| +} |
| + |
| } // namespace |
| ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) |
| @@ -87,9 +108,15 @@ ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevelForWebContents( |
| const SSLStatus& ssl = entry->GetSSL(); |
| switch (ssl.security_style) { |
| case content::SECURITY_STYLE_UNKNOWN: |
| - case content::SECURITY_STYLE_UNAUTHENTICATED: |
| return NONE; |
| + case content::SECURITY_STYLE_UNAUTHENTICATED: { |
| + const GURL& url = entry->GetURL(); |
| + if (url.SchemeIs("http") || url.SchemeIs("ftp")) |
| + return GetSecurityLevelForNonSecureFieldTrial(); |
| + return NONE; |
| + } |
| + |
| case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: |
| return SECURITY_ERROR; |