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

Side by Side Diff: chrome/browser/safe_browsing/srt_prompt_controller.cc

Issue 2847643002: Chrome Cleaner UI: update the modal dialog (Closed)
Patch Set: Change Advanced() -> AdvancedButtonClicked() Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_prompt_controller.h" 5 #include "chrome/browser/safe_browsing/srt_prompt_controller.h"
6 6
7 #include <initializer_list>
8
9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
11 8
12 namespace safe_browsing { 9 namespace safe_browsing {
13 10
14 namespace { 11 namespace {
15 12
16 // Some dummy strings to be displayed in the Cleaner dialog while iterating on 13 // Some dummy strings to be displayed in the Cleaner dialog while iterating on
17 // the dialog's UX design and work on the Chrome<->Cleaner IPC is ongoing. 14 // the dialog's UX design and work on the Chrome<->Cleaner IPC is ongoing.
18 constexpr char kMainTextIntroduction[] = 15 constexpr char kWindowTitle[] = "Clean up your computer?";
19 "Have you seen unusual startup pages or strange search results? Chrome has " 16 constexpr char kMainText[] =
20 "detected the following kinds of programs on your computer that may be " 17 "Chrome found software that harms your browsing experience. Remove related "
21 "causing the problem:"; 18 "files from your computer and restore browser settings, including your "
22 constexpr char kMainTextActionExplanation[] = 19 "search engine and home page.";
23 "Chrome can remove the detected programs, which should stop the strange " 20 constexpr char kAcceptButtonLabel[] = "Cleanup";
24 "behavior."; 21 constexpr char kAdvancedButtonLabel[] = "Advanced";
25 constexpr char kUnwantedSoftwareCategory1[] = "1 Browser hijacker";
26 constexpr char kUnwantedSoftwareCategory2[] = "2 Ad Injectors";
27
28 constexpr char kDetailsSectionSettingsResetExplanation[] =
29 "Chrome will reset the following settings:";
30 constexpr char kDetailsSectionSetting1[] = "Default search engine";
31 constexpr char kDetailsSectionSetting2[] = "Startup pages";
32 constexpr char kDetailsSectionSetting3[] = "Homepage";
33 constexpr char kDetailsSectionSetting4[] = "Shortcuts";
34 constexpr char kDetailsSectionSetting5[] =
35 "All extensions (these can be enabled again later)";
36 constexpr char kDetailsSectionActionExplanation[] =
37 "The following files will be removed:";
38 constexpr char kDetailsSectionPoweredBy[] = "Powered by: <ESET logo>";
39
40 constexpr char kDummyDirectory[] =
41 "C:\\Documents and Settings\\JohnDoe\\Local Settings\\Application Data"
42 "\\IAmNotWanted\\application\\";
43 constexpr char kDummyFilename1[] = "somefile.dll";
44 constexpr char kDummyFilename2[] = "another_file.dll";
45 constexpr char kDummyFilename3[] = "more_stuff.dll";
46 constexpr char kDummyFilename4[] = "run_me.exe";
47
48 constexpr char kShowDetails[] = "Learn more";
49 constexpr char kHideDetails[] = "Close";
50 constexpr char kWindowTitle[] = "Chrome detected unusual behavior";
51 constexpr char kAcceptButtonLabel[] = "Start cleanup";
52 22
53 } // namespace 23 } // namespace
54 24
55 SRTPromptController::LabelInfo::LabelInfo(LabelType type,
56 const base::string16& text)
57 : type(type), text(text) {}
58
59 SRTPromptController::LabelInfo::~LabelInfo() = default;
60
61 SRTPromptController::SRTPromptController() {} 25 SRTPromptController::SRTPromptController() {}
62 26
63 SRTPromptController::~SRTPromptController() = default; 27 SRTPromptController::~SRTPromptController() = default;
64 28
65 base::string16 SRTPromptController::GetWindowTitle() const { 29 base::string16 SRTPromptController::GetWindowTitle() const {
66 return base::UTF8ToUTF16(kWindowTitle); 30 return base::UTF8ToUTF16(kWindowTitle);
67 } 31 }
68 32
69 std::vector<SRTPromptController::LabelInfo> SRTPromptController::GetMainText() 33 base::string16 SRTPromptController::GetMainText() const {
70 const { 34 return base::UTF8ToUTF16(kMainText);
71 return {
72 LabelInfo(LabelInfo::PARAGRAPH, base::UTF8ToUTF16(kMainTextIntroduction)),
73 LabelInfo(LabelInfo::BULLET_ITEM,
74 base::UTF8ToUTF16(kUnwantedSoftwareCategory1)),
75 LabelInfo(LabelInfo::BULLET_ITEM,
76 base::UTF8ToUTF16(kUnwantedSoftwareCategory2)),
77 LabelInfo(LabelInfo::PARAGRAPH,
78 base::UTF8ToUTF16(kMainTextActionExplanation)),
79 };
80 }
81
82 std::vector<SRTPromptController::LabelInfo>
83 SRTPromptController::GetDetailsText() const {
84 return {
85 LabelInfo(LabelInfo::PARAGRAPH,
86 base::UTF8ToUTF16(kDetailsSectionSettingsResetExplanation)),
87 LabelInfo(LabelInfo::BULLET_ITEM,
88 base::UTF8ToUTF16(kDetailsSectionSetting1)),
89 LabelInfo(LabelInfo::BULLET_ITEM,
90 base::UTF8ToUTF16(kDetailsSectionSetting2)),
91 LabelInfo(LabelInfo::BULLET_ITEM,
92 base::UTF8ToUTF16(kDetailsSectionSetting3)),
93 LabelInfo(LabelInfo::BULLET_ITEM,
94 base::UTF8ToUTF16(kDetailsSectionSetting4)),
95 LabelInfo(LabelInfo::BULLET_ITEM,
96 base::UTF8ToUTF16(kDetailsSectionSetting5)),
97 LabelInfo(LabelInfo::PARAGRAPH,
98 base::UTF8ToUTF16(kDetailsSectionActionExplanation)),
99 LabelInfo(LabelInfo::BULLET_ITEM,
100 base::UTF8ToUTF16(base::JoinString(
101 {kDummyDirectory, kDummyFilename1}, nullptr))),
102 LabelInfo(LabelInfo::BULLET_ITEM,
103 base::UTF8ToUTF16(base::JoinString(
104 {kDummyDirectory, kDummyFilename2}, nullptr))),
105 LabelInfo(LabelInfo::BULLET_ITEM,
106 base::UTF8ToUTF16(base::JoinString(
107 {kDummyDirectory, kDummyFilename3}, nullptr))),
108 LabelInfo(LabelInfo::BULLET_ITEM,
109 base::UTF8ToUTF16(base::JoinString(
110 {kDummyDirectory, kDummyFilename4}, nullptr))),
111 LabelInfo(LabelInfo::PARAGRAPH,
112 base::UTF8ToUTF16(kDetailsSectionPoweredBy)),
113 };
114 }
115
116 base::string16 SRTPromptController::GetShowDetailsLabel() const {
117 return base::UTF8ToUTF16(kShowDetails);
118 }
119
120 base::string16 SRTPromptController::GetHideDetailsLabel() const {
121 return base::UTF8ToUTF16(kHideDetails);
122 } 35 }
123 36
124 base::string16 SRTPromptController::GetAcceptButtonLabel() const { 37 base::string16 SRTPromptController::GetAcceptButtonLabel() const {
125 return base::UTF8ToUTF16(kAcceptButtonLabel); 38 return base::UTF8ToUTF16(kAcceptButtonLabel);
126 } 39 }
127 40
41 base::string16 SRTPromptController::GetAdvancedButtonLabel() const {
42 return base::UTF8ToUTF16(kAdvancedButtonLabel);
43 }
44
128 void SRTPromptController::DialogShown() {} 45 void SRTPromptController::DialogShown() {}
129 46
130 void SRTPromptController::Accept() { 47 void SRTPromptController::Accept() {
131 OnInteractionDone(); 48 OnInteractionDone();
132 } 49 }
133 50
134 void SRTPromptController::Cancel() { 51 void SRTPromptController::Cancel() {
135 OnInteractionDone(); 52 OnInteractionDone();
136 } 53 }
137 54
55 void SRTPromptController::Close() {
56 OnInteractionDone();
57 }
58
59 void SRTPromptController::AdvancedButtonClicked() {
60 OnInteractionDone();
61 }
62
138 void SRTPromptController::OnInteractionDone() { 63 void SRTPromptController::OnInteractionDone() {
139 delete this; 64 delete this;
140 } 65 }
141 66
142 } // namespace safe_browsing 67 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/srt_prompt_controller.h ('k') | chrome/browser/ui/views/srt_prompt_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698