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

Unified Diff: chrome/browser/safe_browsing/srt_global_error_win.cc

Issue 1903733005: Make sure to not remove global error twice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698