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

Side by Side Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.h

Issue 2701313002: Adds a modal dialog implementation of the settings reset prompt. (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _CONTROLLER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _CONTROLLER_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/strings/string16.h"
12
13 class Browser;
14
15 namespace safe_browsing {
16
17 class SettingsResetPromptModel;
18
19 // The |SettingsResetPromptController| class is responsible for providing the
20 // text that will be displayed in the settings reset dialog. The controller's
21 // |Accept()| and |Cancel()| functions will be called based on user
22 // interaction. Objects of this class will delete themselves after |Accept()| or
23 // |Cancel()| has been called.
24 class SettingsResetPromptController {
25 public:
26 // A simple struct representing text to be displayed in the dialog.
27 struct LabelInfo {
28 enum LabelType {
29 // Strings of type PARAGRAPH will be displayed by multiline labels.
30 PARAGRAPH,
31 // Strings of type BULLET_ITEM will be displayed as a (possibly elided)
32 // single-line label starting with a bullet point.
33 BULLET_ITEM,
34 };
35
36 LabelInfo(LabelType type, const base::string16& text);
37 // Convenience constructor for displaying resource strings.
38 LabelInfo(LabelType type, int message_id);
39 ~LabelInfo();
40
41 LabelType type;
sky 2017/02/21 17:37:28 If you can, make both of these const.
alito 2017/02/23 02:31:59 Seems hard to accomplish since I'm using a vector
42 base::string16 text;
43 };
44
45 static void ShowSettingsResetPrompt(
46 Browser* browser,
47 SettingsResetPromptController* controller);
48
49 // A controller should be created only if |model->ShouldPromptforReset()|
sky 2017/02/21 17:37:28 constructor/destructor above other functions (see
alito 2017/02/23 02:31:59 Done.
50 // is true.
51 SettingsResetPromptController(
52 std::unique_ptr<SettingsResetPromptModel> model);
53 ~SettingsResetPromptController();
54
55 base::string16 GetWindowTitle();
sky 2017/02/21 17:37:28 GetWindowTitle() const ? Same comment for similar
alito 2017/02/23 02:31:59 Done.
56 base::string16 GetButtonLabel();
57 base::string16 GetShowDetailsLabel();
58 base::string16 GetHideDetailsLabel();
59 std::vector<LabelInfo> GetMainText();
sky 2017/02/21 17:37:28 const std::vector<LabelInfo>& GetMainText() const?
alito 2017/02/23 02:31:59 Done.
60 std::vector<LabelInfo> GetDetailsText();
61 // |Accept()| will be called by the dialog when the user clicks the main
62 // button, after which the dialog will be closed.
63 void Accept();
64 // |Cancel()| will be called by the dialog when the user clicks the dismiss
65 // button on the top right, after which the dialog will be closed.
66 void Cancel();
67
68 private:
69 void InitMainText();
70 void InitDetailsText();
71 // Function to be called sometime after |Accept()| or |Cancel()| has been
72 // called to perform any final tasks (such as metrcis reporting) and delete
73 // this object.
74 void OnInteractionDone();
75
76 std::unique_ptr<SettingsResetPromptModel> model_;
77 std::vector<SettingsResetPromptController::LabelInfo> details_text_;
78 std::vector<SettingsResetPromptController::LabelInfo> main_text_;
79 };
sky 2017/02/21 17:37:28 DISALLOW...
alito 2017/02/23 02:31:59 Done.
80
81 } // namespace safe_browsing
82
83 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO MPT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698