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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 base::ThreadTaskRunnerHandle::Get(), | 191 base::ThreadTaskRunnerHandle::Get(), |
192 base::Bind(&SRTGlobalError::OnUserinteractionDone, | 192 base::Bind(&SRTGlobalError::OnUserinteractionDone, |
193 base::Unretained(this)), | 193 base::Unretained(this)), |
194 base::Bind(&SRTGlobalError::FallbackToDownloadPage, | 194 base::Bind(&SRTGlobalError::FallbackToDownloadPage, |
195 base::Unretained(this)))); | 195 base::Unretained(this)))); |
196 } | 196 } |
197 | 197 |
198 void SRTGlobalError::FallbackToDownloadPage() { | 198 void SRTGlobalError::FallbackToDownloadPage() { |
199 RecordSRTPromptHistogram(SRT_PROMPT_FALLBACK); | 199 RecordSRTPromptHistogram(SRT_PROMPT_FALLBACK); |
200 | 200 |
201 chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); | 201 Browser* browser = chrome::FindLastActive(); |
202 Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type); | |
203 if (browser) { | 202 if (browser) { |
204 browser->OpenURL(content::OpenURLParams( | 203 browser->OpenURL(content::OpenURLParams( |
205 GURL(kSRTDownloadURL), content::Referrer(), NEW_FOREGROUND_TAB, | 204 GURL(kSRTDownloadURL), content::Referrer(), NEW_FOREGROUND_TAB, |
206 ui::PAGE_TRANSITION_LINK, false)); | 205 ui::PAGE_TRANSITION_LINK, false)); |
207 } | 206 } |
208 | 207 |
209 BrowserThread::PostBlockingPoolTask( | 208 BrowserThread::PostBlockingPoolTask( |
210 FROM_HERE, base::Bind(&DeleteFilesFromBlockingPool, downloaded_path_)); | 209 FROM_HERE, base::Bind(&DeleteFilesFromBlockingPool, downloaded_path_)); |
211 OnUserinteractionDone(); | 210 OnUserinteractionDone(); |
212 } | 211 } |
213 | 212 |
214 void SRTGlobalError::OnUserinteractionDone() { | 213 void SRTGlobalError::OnUserinteractionDone() { |
215 DCHECK(interacted_); | 214 DCHECK(interacted_); |
216 // Once the user interacted with the bubble, we can forget about any pending | 215 // Once the user interacted with the bubble, we can forget about any pending |
217 // prompt. | 216 // prompt. |
218 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, | 217 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, |
219 false); | 218 false); |
220 delete this; | 219 delete this; |
221 } | 220 } |
222 | 221 |
223 } // namespace safe_browsing | 222 } // namespace safe_browsing |
OLD | NEW |