| 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/base_paths.h" |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 10 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 14 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
| 15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 45 // downloaded or run. | 46 // downloaded or run. |
| 46 const char kSRTDownloadURL[] = | 47 const char kSRTDownloadURL[] = |
| 47 "https://www.google.com/chrome/srt/?chrome-prompt=1"; | 48 "https://www.google.com/chrome/srt/?chrome-prompt=1"; |
| 48 | 49 |
| 49 // The extension to use to replace the temporary one created when the SRT was | 50 // The extension to use to replace the temporary one created when the SRT was |
| 50 // downloaded. | 51 // downloaded. |
| 51 const base::FilePath::CharType kExecutableExtension[] = L"exe"; | 52 const base::FilePath::CharType kExecutableExtension[] = L"exe"; |
| 52 | 53 |
| 53 // Switches to add to the command line when executing the SRT. | 54 // Switches to add to the command line when executing the SRT. |
| 54 const char kChromePromptSwitch[] = "chrome-prompt"; | 55 const char kChromePromptSwitch[] = "chrome-prompt"; |
| 56 const char kChromeExePathSwitch[] = "chrome-exe-path"; |
| 55 const char kChromeSystemInstallSwitch[] = "chrome-system-install"; | 57 const char kChromeSystemInstallSwitch[] = "chrome-system-install"; |
| 56 const char kUmaUserSwitch[] = "uma-user"; | 58 const char kUmaUserSwitch[] = "uma-user"; |
| 57 | 59 |
| 58 // Values to be passed to the kChromePromptSwitch of the Chrome Cleanup Tool to | 60 // Values to be passed to the kChromePromptSwitch of the Chrome Cleanup Tool to |
| 59 // indicate how the user interacted with the accept button. | 61 // indicate how the user interacted with the accept button. |
| 60 enum class ChromePromptValue { | 62 enum class ChromePromptValue { |
| 61 // The user accepted the prompt when the prompt was first shown. | 63 // The user accepted the prompt when the prompt was first shown. |
| 62 kPrompted = 3, | 64 kPrompted = 3, |
| 63 // The user accepted the prompt after navigating to it from the menu. | 65 // The user accepted the prompt after navigating to it from the menu. |
| 64 kShownFromMenu = 4 | 66 kShownFromMenu = 4 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 srt_command_line.AppendSwitchASCII( | 83 srt_command_line.AppendSwitchASCII( |
| 82 kChromePromptSwitch, | 84 kChromePromptSwitch, |
| 83 base::IntToString(static_cast<int>(prompt_value))); | 85 base::IntToString(static_cast<int>(prompt_value))); |
| 84 srt_command_line.AppendSwitchASCII(kChromeVersionSwitch, | 86 srt_command_line.AppendSwitchASCII(kChromeVersionSwitch, |
| 85 version_info::GetVersionNumber()); | 87 version_info::GetVersionNumber()); |
| 86 srt_command_line.AppendSwitchASCII(kChromeChannelSwitch, | 88 srt_command_line.AppendSwitchASCII(kChromeChannelSwitch, |
| 87 base::IntToString(ChannelAsInt())); | 89 base::IntToString(ChannelAsInt())); |
| 88 | 90 |
| 89 base::FilePath chrome_exe_path; | 91 base::FilePath chrome_exe_path; |
| 90 PathService::Get(base::FILE_EXE, &chrome_exe_path); | 92 PathService::Get(base::FILE_EXE, &chrome_exe_path); |
| 93 srt_command_line.AppendSwitchPath(kChromeExePathSwitch, chrome_exe_path); |
| 91 if (!InstallUtil::IsPerUserInstall(chrome_exe_path)) | 94 if (!InstallUtil::IsPerUserInstall(chrome_exe_path)) |
| 92 srt_command_line.AppendSwitch(kChromeSystemInstallSwitch); | 95 srt_command_line.AppendSwitch(kChromeSystemInstallSwitch); |
| 93 | 96 |
| 94 if (metrics_enabled) { | 97 if (metrics_enabled) { |
| 95 srt_command_line.AppendSwitch(kUmaUserSwitch); | 98 srt_command_line.AppendSwitch(kUmaUserSwitch); |
| 96 srt_command_line.AppendSwitch(kEnableCrashReporting); | 99 srt_command_line.AppendSwitch(kEnableCrashReporting); |
| 97 } | 100 } |
| 98 | 101 |
| 99 base::Process srt_process( | 102 base::Process srt_process( |
| 100 base::LaunchProcess(srt_command_line, base::LaunchOptions())); | 103 base::LaunchProcess(srt_command_line, base::LaunchOptions())); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 void SRTGlobalError::OnUserinteractionDone() { | 270 void SRTGlobalError::OnUserinteractionDone() { |
| 268 DCHECK(interacted_); | 271 DCHECK(interacted_); |
| 269 // Once the user interacted with the bubble, we can forget about any pending | 272 // Once the user interacted with the bubble, we can forget about any pending |
| 270 // prompt. | 273 // prompt. |
| 271 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, | 274 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, |
| 272 false); | 275 false); |
| 273 delete this; | 276 delete this; |
| 274 } | 277 } |
| 275 | 278 |
| 276 } // namespace safe_browsing | 279 } // namespace safe_browsing |
| OLD | NEW |