Chromium Code Reviews| Index: chrome/browser/ssl/security_state_tab_helper.cc |
| diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc |
| index 590c3fdf83e48707f0fc9003b8911b5d764d3222..c4aa4191e831cd1d5645df30a03060dc1bc17429 100644 |
| --- a/chrome/browser/ssl/security_state_tab_helper.cc |
| +++ b/chrome/browser/ssl/security_state_tab_helper.cc |
| @@ -15,6 +15,7 @@ |
| #include "components/prefs/pref_service.h" |
| #include "components/security_state/content/content_utils.h" |
| #include "components/ssl_config/ssl_config_prefs.h" |
| +#include "content/public/browser/browser_context.h" |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/navigation_handle.h" |
| #include "content/public/browser/render_frame_host.h" |
| @@ -119,6 +120,17 @@ void SecurityStateTabHelper::DidFinishNavigation( |
| // and not for same-document navigations like reference fragments and |
| // pushState. |
| logged_http_warning_on_current_navigation_ = false; |
| + |
| + security_state::SecurityInfo security_info; |
| + GetSecurityInfo(&security_info); |
| + if (security_info.is_incognito && |
| + security_info.security_level == security_state::HTTP_SHOW_WARNING) { |
| + web_contents()->GetMainFrame()->AddMessageToConsole( |
| + content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| + "This page was loaded non-securely in an incognito mode browser. A " |
| + "warning has been added to the URL bar. For more information, see " |
| + "https://goo.gl/y8SRRv."); |
| + } |
| } |
| } |
| @@ -199,5 +211,13 @@ SecurityStateTabHelper::GetVisibleSecurityState() const { |
| // information is still being initialized, thus no need to check for that. |
| state->malicious_content_status = GetMaliciousContentStatus(); |
| + if (!state->certificate && |
|
estark
2017/06/09 05:09:37
Curious why check the certificate here? You could
elawrence
2017/06/13 15:31:35
It was intended as a simple optimization to avoid
|
| + security_state::IsHttpWarningForIncognitoEnabled()) { |
|
estark
2017/06/09 05:09:38
IIRC, the reason for checking the field trial here
elawrence
2017/06/13 15:31:35
The is_incognito flag now does what it says on the
|
| + content::BrowserContext* context = web_contents()->GetBrowserContext(); |
| + if (context->IsOffTheRecord() && |
| + !Profile::FromBrowserContext(context)->IsGuestSession()) { |
|
estark
2017/06/09 05:09:38
If it's not too hard, could you add a test that th
elawrence
2017/06/13 15:31:35
Added SecurityStateTabHelperTest.SecurityLevelNotD
|
| + state->is_incognito = true; |
| + } |
| + } |
| return state; |
| } |