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

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

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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/srt_prompt_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 12
13 namespace safe_browsing { 13 namespace safe_browsing {
14 14
15 // Provides the various elements that will be displayed in the Chrome Cleaner 15 // Provides the various elements that will be displayed in the Chrome Cleaner
16 // UI. Also provides functions, such as |Accept()| and |Cancel()|, that should 16 // UI. Also provides functions, such as |Accept()| and |Cancel()|, that should
17 // be called by the UI in response to user actions. 17 // be called by the UI in response to user actions.
18 // 18 //
19 // Objects of this class are typically created by the SwReporterProcess class,
20 // which will pass in information the controller needs to be able to create
21 // strings to be displayed in the prompt dialog.
22 //
23 // This class manages its own lifetime and will delete itself once the Cleaner 19 // This class manages its own lifetime and will delete itself once the Cleaner
24 // dialog has been dismissed and either of |Accept()| or |Cancel()| have been 20 // dialog has been dismissed and either of |Accept()| or |Cancel()| have been
25 // called. 21 // called.
26 class SRTPromptController { 22 class SRTPromptController {
27 public: 23 public:
28 struct LabelInfo {
29 enum LabelType {
30 // Indicates that |text| should be displayed as a multi-line label.
31 PARAGRAPH,
32 // Indicates that |text| should be displayed as a multi-line label that is
33 // indented and starts with a bullet point.
34 BULLET_ITEM,
35 };
36
37 LabelInfo(LabelType type, const base::string16& text);
38 ~LabelInfo();
39
40 LabelType type;
41 base::string16 text;
42 };
43
44 SRTPromptController(); 24 SRTPromptController();
45 25
46 base::string16 GetWindowTitle() const; 26 base::string16 GetWindowTitle() const;
47 // The text to be shown in the Cleaner dialog's main section and will 27 base::string16 GetMainText() const;
48 // always be visible while the dialog is displayed.
49 std::vector<LabelInfo> GetMainText() const;
50 // The text to be shown in the expandable details section of the
51 // Cleaner dialog.
52 std::vector<LabelInfo> GetDetailsText() const;
53 // The text on the button that expands the details section.
54 base::string16 GetShowDetailsLabel() const;
55 // The text on the button that folds the details section.
56 base::string16 GetHideDetailsLabel() const;
57 base::string16 GetAcceptButtonLabel() const; 28 base::string16 GetAcceptButtonLabel() const;
29 base::string16 GetAdvancedButtonLabel() const;
58 30
59 // Called by the Cleaner dialog when the dialog has been shown. Used for 31 // Called by the Cleaner dialog when the dialog has been shown. Used for
60 // reporting metrics. 32 // reporting metrics.
61 void DialogShown(); 33 void DialogShown();
62 // Called by the Cleaner dialog when user accepts the prompt. Once |Accept()| 34 // Called by the Cleaner dialog when user accepts the prompt. Once |Accept()|
63 // has been called, the controller will eventually delete itself and so no 35 // has been called, the controller will eventually delete itself and no member
64 // member functions should be called after that. 36 // functions should be called after that.
65 void Accept(); 37 void Accept();
66 // Called by the Cleaner dialog when the dialog is dismissed or canceled. Once 38 // Called by the Cleaner dialog when the dialog is closed via the cancel
67 // |Cancel()| has been called, the controller will eventually delete itself 39 // button. Once |Cancel()| has been called, the controller will eventually
68 // and so no member functions should be called after that. 40 // delete itself and no member functions should be called after that.
69 void Cancel(); 41 void Cancel();
42 // Called by the Cleaner dialog when the dialog is closed by some other means
43 // than the cancel button (for example, by pressing Esc or clicking the 'x' on
44 // the top of the dialog). After a call to |Dismiss()|, the controller will
45 // eventually delete itself and no member functions should be called after
46 // that.
47 void Close();
48 // Called when the advanced button is clicked, after which the dialog will
49 // close. After a call to |AdvancedButtonClicked()|, the controller will
50 // eventually delete itself and no member functions should be called after
51 // that.
52 void AdvancedButtonClicked();
70 53
71 protected: 54 protected:
72 ~SRTPromptController(); 55 ~SRTPromptController();
73 56
74 private: 57 private:
75 void OnInteractionDone(); 58 void OnInteractionDone();
76 59
77 DISALLOW_COPY_AND_ASSIGN(SRTPromptController); 60 DISALLOW_COPY_AND_ASSIGN(SRTPromptController);
78 }; 61 };
79 62
80 } // namespace safe_browsing 63 } // namespace safe_browsing
81 64
82 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_ 65 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/srt_prompt_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698