| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/safe_browsing/srt_global_error_win.h" | 5 #include "chrome/browser/safe_browsing/srt_global_error_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 base::ThreadTaskRunnerHandle::Get(), | 187 base::ThreadTaskRunnerHandle::Get(), |
| 188 base::Bind(&SRTGlobalError::DestroySelf, | 188 base::Bind(&SRTGlobalError::DestroySelf, |
| 189 base::Unretained(this)), | 189 base::Unretained(this)), |
| 190 base::Bind(&SRTGlobalError::FallbackToDownloadPage, | 190 base::Bind(&SRTGlobalError::FallbackToDownloadPage, |
| 191 base::Unretained(this)))); | 191 base::Unretained(this)))); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void SRTGlobalError::FallbackToDownloadPage() { | 194 void SRTGlobalError::FallbackToDownloadPage() { |
| 195 safe_browsing::RecordSRTPromptHistogram(safe_browsing::SRT_PROMPT_FALLBACK); | 195 safe_browsing::RecordSRTPromptHistogram(safe_browsing::SRT_PROMPT_FALLBACK); |
| 196 | 196 |
| 197 chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); | 197 ui::HostDesktopType desktop_type = chrome::GetActiveDesktop(); |
| 198 Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type); | 198 Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type); |
| 199 if (browser) { | 199 if (browser) { |
| 200 browser->OpenURL(content::OpenURLParams( | 200 browser->OpenURL(content::OpenURLParams( |
| 201 GURL(kSRTDownloadURL), content::Referrer(), NEW_FOREGROUND_TAB, | 201 GURL(kSRTDownloadURL), content::Referrer(), NEW_FOREGROUND_TAB, |
| 202 ui::PAGE_TRANSITION_LINK, false)); | 202 ui::PAGE_TRANSITION_LINK, false)); |
| 203 } | 203 } |
| 204 | 204 |
| 205 BrowserThread::PostBlockingPoolTask( | 205 BrowserThread::PostBlockingPoolTask( |
| 206 FROM_HERE, base::Bind(&DeleteFilesFromBlockingPool, downloaded_path_)); | 206 FROM_HERE, base::Bind(&DeleteFilesFromBlockingPool, downloaded_path_)); |
| 207 DestroySelf(); | 207 DestroySelf(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void SRTGlobalError::DestroySelf() { | 210 void SRTGlobalError::DestroySelf() { |
| 211 // This should only happen when user interacted with the bubble. | 211 // This should only happen when user interacted with the bubble. |
| 212 DCHECK(interacted_); | 212 DCHECK(interacted_); |
| 213 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, | 213 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, |
| 214 false); | 214 false); |
| 215 delete this; | 215 delete this; |
| 216 } | 216 } |
| OLD | NEW |