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

Side by Side Diff: chrome/browser/ui/website_settings/website_settings.cc

Issue 2365553002: Fix a use-after-free in WebsiteSettings::OnUIClosing. (Closed)
Patch Set: 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/ui/website_settings/website_settings.h ('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 (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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 WebsiteSettings::WebsiteSettings( 247 WebsiteSettings::WebsiteSettings(
248 WebsiteSettingsUI* ui, 248 WebsiteSettingsUI* ui,
249 Profile* profile, 249 Profile* profile,
250 TabSpecificContentSettings* tab_specific_content_settings, 250 TabSpecificContentSettings* tab_specific_content_settings,
251 content::WebContents* web_contents, 251 content::WebContents* web_contents,
252 const GURL& url, 252 const GURL& url,
253 const SecurityStateModel::SecurityInfo& security_info) 253 const SecurityStateModel::SecurityInfo& security_info)
254 : TabSpecificContentSettings::SiteDataObserver( 254 : TabSpecificContentSettings::SiteDataObserver(
255 tab_specific_content_settings), 255 tab_specific_content_settings),
256 content::WebContentsObserver(web_contents),
256 ui_(ui), 257 ui_(ui),
257 #if !defined(OS_ANDROID)
258 web_contents_(web_contents),
259 #endif
260 show_info_bar_(false), 258 show_info_bar_(false),
261 site_url_(url), 259 site_url_(url),
262 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), 260 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN),
263 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), 261 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN),
264 content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)), 262 content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)),
265 chrome_ssl_host_state_delegate_( 263 chrome_ssl_host_state_delegate_(
266 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), 264 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)),
267 did_revoke_user_ssl_decisions_(false), 265 did_revoke_user_ssl_decisions_(false),
268 profile_(profile) { 266 profile_(profile) {
269 Init(url, security_info); 267 Init(url, security_info);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 359 }
362 360
363 void WebsiteSettings::OnSiteDataAccessed() { 361 void WebsiteSettings::OnSiteDataAccessed() {
364 PresentSiteData(); 362 PresentSiteData();
365 } 363 }
366 364
367 void WebsiteSettings::OnUIClosing() { 365 void WebsiteSettings::OnUIClosing() {
368 #if defined(OS_ANDROID) 366 #if defined(OS_ANDROID)
369 NOTREACHED(); 367 NOTREACHED();
370 #else 368 #else
371 if (show_info_bar_ && web_contents_) { 369 if (show_info_bar_ && web_contents() && !web_contents()->IsBeingDestroyed()) {
372 InfoBarService* infobar_service = 370 InfoBarService* infobar_service =
373 InfoBarService::FromWebContents(web_contents_); 371 InfoBarService::FromWebContents(web_contents());
374 if (infobar_service) 372 if (infobar_service)
375 WebsiteSettingsInfoBarDelegate::Create(infobar_service); 373 WebsiteSettingsInfoBarDelegate::Create(infobar_service);
376 } 374 }
377 375
378 SSLCertificateDecisionsDidRevoke user_decision = 376 SSLCertificateDecisionsDidRevoke user_decision =
379 did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED 377 did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED
380 : USER_CERT_DECISIONS_NOT_REVOKED; 378 : USER_CERT_DECISIONS_NOT_REVOKED;
381 379
382 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions", 380 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions",
383 user_decision, 381 user_decision,
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 info.connection_status = site_connection_status_; 803 info.connection_status = site_connection_status_;
806 info.connection_status_description = 804 info.connection_status_description =
807 UTF16ToUTF8(site_connection_details_); 805 UTF16ToUTF8(site_connection_details_);
808 info.identity_status = site_identity_status_; 806 info.identity_status = site_identity_status_;
809 info.identity_status_description = 807 info.identity_status_description =
810 UTF16ToUTF8(site_identity_details_); 808 UTF16ToUTF8(site_identity_details_);
811 info.certificate = certificate_; 809 info.certificate = certificate_;
812 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; 810 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_;
813 ui_->SetIdentityInfo(info); 811 ui_->SetIdentityInfo(info);
814 } 812 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698