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

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

Issue 2739513002: Settings reset prompt: add UMA metrics reporting. (Closed)
Patch Set: Adds histograms to log what is reset when prompt is accepted Created 3 years, 9 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _MODEL_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _MODEL_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _MODEL_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _MODEL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 30 matching lines...) Expand all
41 // 3. Homepage 41 // 3. Homepage
42 class SettingsResetPromptModel { 42 class SettingsResetPromptModel {
43 public: 43 public:
44 enum ResetState { 44 enum ResetState {
45 RESET_REQUIRED = 1, 45 RESET_REQUIRED = 1,
46 NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED = 2, 46 NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED = 2,
47 NO_RESET_REQUIRED_DUE_TO_ALREADY_PROMPTED_FOR_SETTING = 3, 47 NO_RESET_REQUIRED_DUE_TO_ALREADY_PROMPTED_FOR_SETTING = 3,
48 NO_RESET_REQUIRED_DUE_TO_RECENTLY_PROMPTED = 4, 48 NO_RESET_REQUIRED_DUE_TO_RECENTLY_PROMPTED = 4,
49 NO_RESET_REQUIRED_DUE_TO_OTHER_SETTING_REQUIRING_RESET = 5, 49 NO_RESET_REQUIRED_DUE_TO_OTHER_SETTING_REQUIRING_RESET = 5,
50 NO_RESET_REQUIRED_DUE_TO_POLICY = 6, 50 NO_RESET_REQUIRED_DUE_TO_POLICY = 6,
51 RESET_STATE_MAX = 7
51 }; 52 };
52 53
53 using ExtensionMap = 54 using ExtensionMap =
54 std::unordered_map<extensions::ExtensionId, ExtensionInfo>; 55 std::unordered_map<extensions::ExtensionId, ExtensionInfo>;
55 using CreateCallback = 56 using CreateCallback =
56 base::Callback<void(std::unique_ptr<SettingsResetPromptModel>)>; 57 base::Callback<void(std::unique_ptr<SettingsResetPromptModel>)>;
57 58
58 // Creates a new |SettingsResetPromptModel| and passes it to |callback|. This 59 // Creates a new |SettingsResetPromptModel| and passes it to |callback|. This
59 // function should be called on the UI thread. 60 // function should be called on the UI thread.
60 static void Create(Profile* profile, 61 static void Create(Profile* profile,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 virtual const std::vector<GURL>& startup_urls() const; 97 virtual const std::vector<GURL>& startup_urls() const;
97 // Returns the list of all startup URLs that have a match in the prompt 98 // Returns the list of all startup URLs that have a match in the prompt
98 // config. This is a subset of the URLs returned by |startup_urls()|. 99 // config. This is a subset of the URLs returned by |startup_urls()|.
99 virtual const std::vector<GURL>& startup_urls_to_reset() const; 100 virtual const std::vector<GURL>& startup_urls_to_reset() const;
100 virtual ResetState startup_urls_reset_state() const; 101 virtual ResetState startup_urls_reset_state() const;
101 102
102 // Returns a map of extension ID -> ExtensionInfo for all extensions that will 103 // Returns a map of extension ID -> ExtensionInfo for all extensions that will
103 // be disabled. 104 // be disabled.
104 virtual const ExtensionMap& extensions_to_disable() const; 105 virtual const ExtensionMap& extensions_to_disable() const;
105 106
107 void ReportUmaMetrics() const;
108
106 protected: 109 protected:
107 // Exposed for mocking in tests. 110 // Exposed for mocking in tests.
108 SettingsResetPromptModel( 111 SettingsResetPromptModel(
109 Profile* profile, 112 Profile* profile,
110 std::unique_ptr<SettingsResetPromptConfig> prompt_config, 113 std::unique_ptr<SettingsResetPromptConfig> prompt_config,
111 std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot, 114 std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot,
112 std::unique_ptr<BrandcodedDefaultSettings> default_settings, 115 std::unique_ptr<BrandcodedDefaultSettings> default_settings,
113 std::unique_ptr<ProfileResetter> profile_resetter); 116 std::unique_ptr<ProfileResetter> profile_resetter);
114 117
115 private: 118 private:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ResetState startup_urls_reset_state_; 177 ResetState startup_urls_reset_state_;
175 178
176 ExtensionMap extensions_to_disable_; 179 ExtensionMap extensions_to_disable_;
177 180
178 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptModel); 181 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptModel);
179 }; 182 };
180 183
181 } // namespace safe_browsing 184 } // namespace safe_browsing
182 185
183 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO MPT_MODEL_H_ 186 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO MPT_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698