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

Side by Side Diff: ios/chrome/browser/ssl/ios_ssl_blocking_page.mm

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ios/chrome/browser/ssl/ios_ssl_blocking_page.h" 5 #include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "components/prefs/pref_service.h"
13 #include "components/security_interstitials/core/metrics_helper.h" 12 #include "components/security_interstitials/core/metrics_helper.h"
14 #include "components/security_interstitials/core/ssl_error_ui.h" 13 #include "components/security_interstitials/core/ssl_error_ui.h"
15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
16 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" 15 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h"
17 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" 16 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h"
18 #include "ios/chrome/browser/pref_names.h"
19 #include "ios/chrome/grit/ios_strings.h" 17 #include "ios/chrome/grit/ios_strings.h"
20 #include "ios/public/provider/chrome/browser/browser_constants.h" 18 #include "ios/public/provider/chrome/browser/browser_constants.h"
21 #include "ios/web/public/web_state/web_state.h" 19 #include "ios/web/public/web_state/web_state.h"
22 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
23 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
24 #include "url/gurl.h" 22 #include "url/gurl.h"
25 23
26 using security_interstitials::SSLErrorUI; 24 using security_interstitials::SSLErrorUI;
27 25
28 namespace { 26 namespace {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int options_mask, 72 int options_mask,
75 const base::Time& time_triggered, 73 const base::Time& time_triggered,
76 const base::Callback<void(bool)>& callback) 74 const base::Callback<void(bool)>& callback)
77 : IOSSecurityInterstitialPage(web_state, request_url), 75 : IOSSecurityInterstitialPage(web_state, request_url),
78 callback_(callback), 76 callback_(callback),
79 ssl_info_(ssl_info), 77 ssl_info_(ssl_info),
80 overridable_(IsOverridable(options_mask)), 78 overridable_(IsOverridable(options_mask)),
81 expired_but_previously_allowed_( 79 expired_but_previously_allowed_(
82 (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0), 80 (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0),
83 controller_(new IOSChromeControllerClient(web_state)) { 81 controller_(new IOSChromeControllerClient(web_state)) {
84 // Get the language and override prefs for the SSLErrorUI. 82 // Override prefs for the SSLErrorUI.
85 std::string languages;
86 ios::ChromeBrowserState* browser_state =
87 ios::ChromeBrowserState::FromBrowserState(web_state->GetBrowserState());
88 if (browser_state) {
89 languages = browser_state->GetPrefs()->GetString(prefs::kAcceptLanguages);
90 }
91 if (overridable_) 83 if (overridable_)
92 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; 84 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED;
93 else 85 else
94 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; 86 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED;
95 87
96 // Set up the metrics helper for the SSLErrorUI. 88 // Set up the metrics helper for the SSLErrorUI.
97 security_interstitials::MetricsHelper::ReportDetails reporting_info; 89 security_interstitials::MetricsHelper::ReportDetails reporting_info;
98 reporting_info.metric_prefix = 90 reporting_info.metric_prefix =
99 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; 91 overridable_ ? "ssl_overridable" : "ssl_nonoverridable";
100 reporting_info.rappor_prefix = kSSLRapporPrefix; 92 reporting_info.rappor_prefix = kSSLRapporPrefix;
101 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; 93 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE;
102 IOSChromeMetricsHelper* ios_chrome_metrics_helper = 94 IOSChromeMetricsHelper* ios_chrome_metrics_helper =
103 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); 95 new IOSChromeMetricsHelper(web_state, request_url, reporting_info);
104 controller_->set_metrics_helper(make_scoped_ptr(ios_chrome_metrics_helper)); 96 controller_->set_metrics_helper(make_scoped_ptr(ios_chrome_metrics_helper));
105 97
106 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, 98 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info,
107 options_mask, time_triggered, languages, 99 options_mask, time_triggered,
108 controller_.get())); 100 controller_.get()));
109 101
110 // Creating an interstitial without showing (e.g. from chrome://interstitials) 102 // Creating an interstitial without showing (e.g. from chrome://interstitials)
111 // it leaks memory, so don't create it here. 103 // it leaks memory, so don't create it here.
112 } 104 }
113 105
114 bool IOSSSLBlockingPage::ShouldCreateNewNavigation() const { 106 bool IOSSSLBlockingPage::ShouldCreateNewNavigation() const {
115 return true; 107 return true;
116 } 108 }
117 109
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 callback_.Reset(); 190 callback_.Reset();
199 } 191 }
200 192
201 // static 193 // static
202 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { 194 bool IOSSSLBlockingPage::IsOverridable(int options_mask) {
203 const bool is_overridable = 195 const bool is_overridable =
204 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && 196 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) &&
205 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); 197 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT);
206 return is_overridable; 198 return is_overridable;
207 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698