Chromium Code Reviews| Index: chrome/browser/safe_browsing/srt_global_error_win.cc |
| diff --git a/chrome/browser/safe_browsing/srt_global_error_win.cc b/chrome/browser/safe_browsing/srt_global_error_win.cc |
| index 69f4062600cade8627f35428842f7f5040d31a75..412ce6031be090734f8da9605cc232ac48ee98db 100644 |
| --- a/chrome/browser/safe_browsing/srt_global_error_win.cc |
| +++ b/chrome/browser/safe_browsing/srt_global_error_win.cc |
| @@ -55,7 +55,7 @@ void MaybeExecuteSRTFromBlockingPool( |
| if (base::PathExists(downloaded_path)) { |
| base::FilePath executable_path( |
| downloaded_path.ReplaceExtension(kExecutableExtension)); |
| - if (base::ReplaceFile(downloaded_path, executable_path, NULL)) { |
| + if (base::ReplaceFile(downloaded_path, executable_path, nullptr)) { |
| base::CommandLine srt_command_line(executable_path); |
| srt_command_line.AppendSwitch(kChromePromptSwitch); |
| base::Process srt_process( |
| @@ -158,16 +158,30 @@ void SRTGlobalError::OnBubbleViewDidClose(Browser* browser) { |
| } |
| void SRTGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { |
| + // This is for cases where the UI doesn't go away quickly enough and user |
|
macourteau
2016/04/20 17:46:39
nit: this function and the one below have a lot of
MAD
2016/04/20 17:48:12
I wouldn't call this a lot of common code... Just
macourteau
2016/04/20 18:04:03
It's still 10 lines that are exactly the same exce
|
| + // might click on the button more than once, or more than one button. |
| + if (interacted_) |
| + return; |
| RecordSRTPromptHistogram(SRT_PROMPT_ACCEPTED); |
| interacted_ = true; |
| - global_error_service_->RemoveGlobalError(this); |
| + if (global_error_service_) { |
| + global_error_service_->RemoveGlobalError(this); |
| + global_error_service_ = nullptr; |
| + } |
| MaybeExecuteSRT(); |
| } |
| void SRTGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
| + // This is for cases where the UI doesn't go away quickly enough and user |
| + // might click on the button more than once, or more than one button. |
| + if (interacted_) |
| + return; |
| RecordSRTPromptHistogram(SRT_PROMPT_DENIED); |
| interacted_ = true; |
| - global_error_service_->RemoveGlobalError(this); |
| + if (global_error_service_) { |
| + global_error_service_->RemoveGlobalError(this); |
| + global_error_service_ = nullptr; |
| + } |
| BrowserThread::PostBlockingPoolTask( |
| FROM_HERE, base::Bind(&DeleteFilesFromBlockingPool, downloaded_path_)); |