OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 if (!web_contents) | 80 if (!web_contents) |
81 return NONE; | 81 return NONE; |
82 | 82 |
83 NavigationEntry* entry = web_contents->GetController().GetVisibleEntry(); | 83 NavigationEntry* entry = web_contents->GetController().GetVisibleEntry(); |
84 if (!entry) | 84 if (!entry) |
85 return NONE; | 85 return NONE; |
86 | 86 |
87 const SSLStatus& ssl = entry->GetSSL(); | 87 const SSLStatus& ssl = entry->GetSSL(); |
88 switch (ssl.security_style) { | 88 switch (ssl.security_style) { |
89 case content::SECURITY_STYLE_UNKNOWN: | 89 case content::SECURITY_STYLE_UNKNOWN: |
90 case content::SECURITY_STYLE_UNAUTHENTICATED: | |
91 return NONE; | 90 return NONE; |
91 case content::SECURITY_STYLE_UNAUTHENTICATED: { | |
92 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | |
93 std::string choice = | |
94 cmd->GetSwitchValueASCII(switches::kMarkHttpAsNonSecure); | |
95 if (choice.empty()) { | |
96 ToolbarModel::SecurityLevel security_level = NONE; | |
97 if (GetSecurityLevelForFieldTrialGroup( | |
jww
2014/12/20 01:21:57
According to Finch documentation, you should actua
Ryan Sleevi
2014/12/20 01:29:32
See https://goto.google.com/finch-and-flags
palmer
2014/12/20 01:59:53
OK, I think I did this right. I'm sure you'll let
| |
98 base::FieldTrialList::FindFullName("MarkHTTPAsNonSecure"), | |
99 &security_level)) { | |
100 return security_level; | |
101 } | |
102 return NONE; | |
103 } else if (choice == "dubious") { | |
104 return ToolbarModel::SECURITY_WARNING; | |
105 } else if (choice == "non-secure") { | |
106 return ToolbarModel::SECURITY_ERROR; | |
107 } else { | |
108 return NONE; | |
109 } | |
110 } | |
92 | 111 |
93 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: | 112 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: |
94 return SECURITY_ERROR; | 113 return SECURITY_ERROR; |
95 | 114 |
96 case content::SECURITY_STYLE_AUTHENTICATED: { | 115 case content::SECURITY_STYLE_AUTHENTICATED: { |
97 #if defined(OS_CHROMEOS) | 116 #if defined(OS_CHROMEOS) |
98 policy::PolicyCertService* service = | 117 policy::PolicyCertService* service = |
99 policy::PolicyCertServiceFactory::GetForProfile( | 118 policy::PolicyCertServiceFactory::GetForProfile( |
100 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 119 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
101 if (service && service->UsedPolicyCertificates()) | 120 if (service && service->UsedPolicyCertificates()) |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 if (entry && | 410 if (entry && |
392 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) | 411 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) |
393 return search_terms; | 412 return search_terms; |
394 | 413 |
395 // Otherwise, extract search terms for HTTPS pages that do not have a security | 414 // Otherwise, extract search terms for HTTPS pages that do not have a security |
396 // error. | 415 // error. |
397 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); | 416 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); |
398 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? | 417 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? |
399 base::string16() : search_terms; | 418 base::string16() : search_terms; |
400 } | 419 } |
OLD | NEW |