Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/browser/ssl/chrome_security_state_model_client.cc

Issue 2270283002: Downgrade security state after user clicks through SB interstitial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove logging statements Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ssl/chrome_security_state_model_client.h" 5 #include "chrome/browser/ssl/chrome_security_state_model_client.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/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/policy/policy_cert_service.h" 13 #include "chrome/browser/chromeos/policy/policy_cert_service.h"
13 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 14 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/browser/safe_browsing/ui_manager.h"
15 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
16 #include "content/public/browser/cert_store.h" 19 #include "content/public/browser/cert_store.h"
17 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/security_style_explanation.h" 21 #include "content/public/browser/security_style_explanation.h"
19 #include "content/public/browser/security_style_explanations.h" 22 #include "content/public/browser/security_style_explanations.h"
20 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
21 #include "content/public/common/origin_util.h" 24 #include "content/public/common/origin_util.h"
22 #include "content/public/common/ssl_status.h" 25 #include "content/public/common/ssl_status.h"
23 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
24 #include "net/cert/x509_certificate.h" 27 #include "net/cert/x509_certificate.h"
25 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
26 29
27 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeSecurityStateModelClient); 30 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeSecurityStateModelClient);
28 31
32 using safe_browsing::SafeBrowsingUIManager;
29 using security_state::SecurityStateModel; 33 using security_state::SecurityStateModel;
30 34
31 namespace { 35 namespace {
32 36
33 // Converts a content::SecurityStyle (an indicator of a request's 37 // Converts a content::SecurityStyle (an indicator of a request's
34 // overall security level computed by //content) into a 38 // overall security level computed by //content) into a
35 // SecurityStateModel::SecurityLevel (a finer-grained SecurityStateModel 39 // SecurityStateModel::SecurityLevel (a finer-grained SecurityStateModel
36 // concept that can express all of SecurityStateModel's policies that 40 // concept that can express all of SecurityStateModel's policies that
37 // //content doesn't necessarily know about). 41 // //content doesn't necessarily know about).
38 SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle( 42 SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle(
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ssl.sct_statuses.end()); 251 ssl.sct_statuses.end());
248 state->displayed_mixed_content = 252 state->displayed_mixed_content =
249 !!(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT); 253 !!(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT);
250 state->ran_mixed_content = 254 state->ran_mixed_content =
251 !!(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT); 255 !!(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT);
252 state->displayed_content_with_cert_errors = 256 state->displayed_content_with_cert_errors =
253 !!(ssl.content_status & 257 !!(ssl.content_status &
254 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS); 258 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS);
255 state->ran_content_with_cert_errors = 259 state->ran_content_with_cert_errors =
256 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); 260 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS);
261
262 // Check to see whether the security state should be downgraded to reflect
263 // a Safe Browsing verdict.
264 safe_browsing::SafeBrowsingService* sb_service =
265 g_browser_process->safe_browsing_service();
266 if (!sb_service)
267 return;
268 scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager();
269 if (sb_ui_manager->IsUrlWhitelistedForWebContents(entry->GetURL(), false,
270 entry, web_contents_)) {
271 state->fails_malware_check = true;
272 state->initial_security_level = SecurityStateModel::SECURITY_ERROR;
273 }
257 } 274 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698