OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
20 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
21 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
22 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
23 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
24 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 24 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
25 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
| 26 #include "chrome/browser/infobars/infobar_service.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 28 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
28 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 29 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
29 #include "chrome/browser/ssl/ssl_error_info.h" | 30 #include "chrome/browser/ssl/ssl_error_info.h" |
30 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h
" | 31 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h
" |
31 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 32 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
34 #include "chrome/grit/chromium_strings.h" | 35 #include "chrome/grit/chromium_strings.h" |
35 #include "chrome/grit/generated_resources.h" | 36 #include "chrome/grit/generated_resources.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return is_ev ? WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT | 141 return is_ev ? WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT |
141 : WebsiteSettings::SITE_IDENTITY_STATUS_CERT; | 142 : WebsiteSettings::SITE_IDENTITY_STATUS_CERT; |
142 } | 143 } |
143 | 144 |
144 } // namespace | 145 } // namespace |
145 | 146 |
146 WebsiteSettings::WebsiteSettings( | 147 WebsiteSettings::WebsiteSettings( |
147 WebsiteSettingsUI* ui, | 148 WebsiteSettingsUI* ui, |
148 Profile* profile, | 149 Profile* profile, |
149 TabSpecificContentSettings* tab_specific_content_settings, | 150 TabSpecificContentSettings* tab_specific_content_settings, |
150 InfoBarService* infobar_service, | 151 content::WebContents* web_contents, |
151 const GURL& url, | 152 const GURL& url, |
152 const content::SSLStatus& ssl, | 153 const content::SSLStatus& ssl, |
153 content::CertStore* cert_store) | 154 content::CertStore* cert_store) |
154 : TabSpecificContentSettings::SiteDataObserver( | 155 : TabSpecificContentSettings::SiteDataObserver( |
155 tab_specific_content_settings), | 156 tab_specific_content_settings), |
156 ui_(ui), | 157 ui_(ui), |
157 infobar_service_(infobar_service), | 158 web_contents_(web_contents), |
158 show_info_bar_(false), | 159 show_info_bar_(false), |
159 site_url_(url), | 160 site_url_(url), |
160 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), | 161 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), |
161 cert_id_(0), | 162 cert_id_(0), |
162 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), | 163 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), |
163 cert_store_(cert_store), | 164 cert_store_(cert_store), |
164 content_settings_(profile->GetHostContentSettingsMap()), | 165 content_settings_(profile->GetHostContentSettingsMap()), |
165 chrome_ssl_host_state_delegate_( | 166 chrome_ssl_host_state_delegate_( |
166 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), | 167 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), |
167 did_revoke_user_ssl_decisions_(false) { | 168 did_revoke_user_ssl_decisions_(false) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // Refresh the UI to reflect the new setting. | 316 // Refresh the UI to reflect the new setting. |
316 PresentSitePermissions(); | 317 PresentSitePermissions(); |
317 #endif | 318 #endif |
318 } | 319 } |
319 | 320 |
320 void WebsiteSettings::OnSiteDataAccessed() { | 321 void WebsiteSettings::OnSiteDataAccessed() { |
321 PresentSiteData(); | 322 PresentSiteData(); |
322 } | 323 } |
323 | 324 |
324 void WebsiteSettings::OnUIClosing() { | 325 void WebsiteSettings::OnUIClosing() { |
325 if (show_info_bar_) | 326 if (show_info_bar_ && web_contents_) { |
326 WebsiteSettingsInfoBarDelegate::Create(infobar_service_); | 327 InfoBarService* infobar_service = |
| 328 InfoBarService::FromWebContents(web_contents_); |
| 329 if (infobar_service) |
| 330 WebsiteSettingsInfoBarDelegate::Create(infobar_service); |
| 331 } |
327 | 332 |
328 SSLCertificateDecisionsDidRevoke user_decision = | 333 SSLCertificateDecisionsDidRevoke user_decision = |
329 did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED | 334 did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED |
330 : USER_CERT_DECISIONS_NOT_REVOKED; | 335 : USER_CERT_DECISIONS_NOT_REVOKED; |
331 | 336 |
332 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions", | 337 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions", |
333 user_decision, | 338 user_decision, |
334 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM); | 339 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM); |
335 } | 340 } |
336 | 341 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 info.connection_status = site_connection_status_; | 726 info.connection_status = site_connection_status_; |
722 info.connection_status_description = | 727 info.connection_status_description = |
723 UTF16ToUTF8(site_connection_details_); | 728 UTF16ToUTF8(site_connection_details_); |
724 info.identity_status = site_identity_status_; | 729 info.identity_status = site_identity_status_; |
725 info.identity_status_description = | 730 info.identity_status_description = |
726 UTF16ToUTF8(site_identity_details_); | 731 UTF16ToUTF8(site_identity_details_); |
727 info.cert_id = cert_id_; | 732 info.cert_id = cert_id_; |
728 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 733 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
729 ui_->SetIdentityInfo(info); | 734 ui_->SetIdentityInfo(info); |
730 } | 735 } |
OLD | NEW |