Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "components/component_updater/pref_names.h" | 22 #include "components/component_updater/pref_names.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 | 27 |
| 28 using base::SingleThreadTaskRunner; | 28 using base::SingleThreadTaskRunner; |
| 29 using base::ThreadTaskRunnerHandle; | 29 using base::ThreadTaskRunnerHandle; |
| 30 using content::BrowserThread; | 30 using content::BrowserThread; |
| 31 | 31 |
| 32 namespace safe_browsing { | |
| 33 | |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 // Used as a backup plan in case the SRT executable was not successfully | 36 // Used as a backup plan in case the SRT executable was not successfully |
| 35 // downloaded or run. | 37 // downloaded or run. |
| 36 const char kSRTDownloadURL[] = | 38 const char kSRTDownloadURL[] = |
| 37 "https://www.google.com/chrome/srt/?chrome-prompt=1"; | 39 "https://www.google.com/chrome/srt/?chrome-prompt=1"; |
| 38 | 40 |
| 39 // The extension to use to replace the temporary one created when the SRT was | 41 // The extension to use to replace the temporary one created when the SRT was |
| 40 // downloaded. | 42 // downloaded. |
| 41 const base::FilePath::CharType kExecutableExtension[] = L"exe"; | 43 const base::FilePath::CharType kExecutableExtension[] = L"exe"; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 100 |
| 99 int SRTGlobalError::MenuItemCommandID() { | 101 int SRTGlobalError::MenuItemCommandID() { |
| 100 return IDC_SHOW_SRT_BUBBLE; | 102 return IDC_SHOW_SRT_BUBBLE; |
| 101 } | 103 } |
| 102 | 104 |
| 103 base::string16 SRTGlobalError::MenuItemLabel() { | 105 base::string16 SRTGlobalError::MenuItemLabel() { |
| 104 return l10n_util::GetStringUTF16(IDS_SRT_MENU_ITEM); | 106 return l10n_util::GetStringUTF16(IDS_SRT_MENU_ITEM); |
| 105 } | 107 } |
| 106 | 108 |
| 107 void SRTGlobalError::ExecuteMenuItem(Browser* browser) { | 109 void SRTGlobalError::ExecuteMenuItem(Browser* browser) { |
| 108 safe_browsing::RecordSRTPromptHistogram( | 110 safe_browsing::RecordSRTPromptHistogram( |
|
mattm
2015/11/12 00:36:06
bunch of safe_browsing:: in this file could be rem
vakh (old account. dont use)
2015/11/12 09:27:43
Done.
| |
| 109 safe_browsing::SRT_PROMPT_SHOWN_FROM_MENU); | 111 safe_browsing::SRT_PROMPT_SHOWN_FROM_MENU); |
| 110 show_dismiss_button_ = true; | 112 show_dismiss_button_ = true; |
| 111 ShowBubbleView(browser); | 113 ShowBubbleView(browser); |
| 112 } | 114 } |
| 113 | 115 |
| 114 void SRTGlobalError::ShowBubbleView(Browser* browser) { | 116 void SRTGlobalError::ShowBubbleView(Browser* browser) { |
| 115 safe_browsing::RecordSRTPromptHistogram(safe_browsing::SRT_PROMPT_SHOWN); | 117 safe_browsing::RecordSRTPromptHistogram(safe_browsing::SRT_PROMPT_SHOWN); |
| 116 GlobalErrorWithStandardBubble::ShowBubbleView(browser); | 118 GlobalErrorWithStandardBubble::ShowBubbleView(browser); |
| 117 } | 119 } |
| 118 | 120 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 DestroySelf(); | 213 DestroySelf(); |
| 212 } | 214 } |
| 213 | 215 |
| 214 void SRTGlobalError::DestroySelf() { | 216 void SRTGlobalError::DestroySelf() { |
| 215 // This should only happen when user interacted with the bubble. | 217 // This should only happen when user interacted with the bubble. |
| 216 DCHECK(interacted_); | 218 DCHECK(interacted_); |
| 217 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, | 219 g_browser_process->local_state()->SetBoolean(prefs::kSwReporterPendingPrompt, |
| 218 false); | 220 false); |
| 219 delete this; | 221 delete this; |
| 220 } | 222 } |
| 223 | |
| 224 } // namespace safe_browsing | |
| OLD | NEW |