Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 _CONFIG_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _CONFIG_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _CONFIG_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT _CONFIG_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <unordered_map> | 11 #include <unordered_map> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/feature_list.h" | 14 #include "base/feature_list.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 | 17 |
| 18 class GURL; | 18 class GURL; |
| 19 | 19 |
| 20 namespace safe_browsing { | 20 namespace safe_browsing { |
| 21 | 21 |
| 22 // Exposed for testing. | |
| 23 extern const base::Feature kSettingsResetPrompt; | 22 extern const base::Feature kSettingsResetPrompt; |
| 24 | 23 |
| 25 // Encapsulates the state of the reset prompt experiment as well as | 24 // Encapsulates the state of the reset prompt experiment as well as |
| 26 // associated data. | 25 // associated data. |
| 27 class SettingsResetPromptConfig { | 26 class SettingsResetPromptConfig { |
| 28 public: | 27 public: |
| 29 // Returns true if the settings reset prompt study is enabled. | |
| 30 static bool IsPromptEnabled(); | |
| 31 // Factory method for creating instances of SettingsResetPromptConfig. | 28 // Factory method for creating instances of SettingsResetPromptConfig. |
| 32 // Returns nullptr if |IsPromptEnabled()| is false or if something is wrong | 29 // Returns nullptr if |IsPromptEnabled()| is false or if something is wrong |
| 33 // with the config parameters. | 30 // with the config parameters. |
| 34 static std::unique_ptr<SettingsResetPromptConfig> Create(); | 31 static std::unique_ptr<SettingsResetPromptConfig> Create(); |
| 35 | 32 |
| 36 virtual ~SettingsResetPromptConfig(); | 33 virtual ~SettingsResetPromptConfig(); |
|
sky
2017/02/21 17:37:27
If you're going to cleanup this file, move the des
alito
2017/02/23 02:31:59
According to Google's external C++ style guide, fa
sky
2017/02/23 04:27:31
I clearly missed the 'factory functions' sections.
| |
| 37 | 34 |
| 38 // Returns a non-negative integer ID if |url| should trigger a | 35 // Returns a non-negative integer ID if |url| should trigger a |
| 39 // settings reset prompt and a negative integer otherwise. The IDs | 36 // settings reset prompt and a negative integer otherwise. The IDs |
| 40 // identify the domains or entities that we want to prompt the user | 37 // identify the domains or entities that we want to prompt the user |
| 41 // for and can be used for metrics reporting. | 38 // for and can be used for metrics reporting. |
| 42 virtual int UrlToResetDomainId(const GURL& url) const; | 39 virtual int UrlToResetDomainId(const GURL& url) const; |
| 43 | 40 |
| 44 // The delay before showing the reset prompt after Chrome startup. | 41 // The delay before showing the reset prompt after Chrome startup. |
| 45 base::TimeDelta delay_before_prompt() const; | 42 base::TimeDelta delay_before_prompt() const; |
| 46 // Whether the prompt dialog should be modal. | 43 // Whether the prompt dialog should be modal. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 68 // Other feature parameters. | 65 // Other feature parameters. |
| 69 base::TimeDelta delay_before_prompt_; | 66 base::TimeDelta delay_before_prompt_; |
| 70 bool use_modal_dialog_; | 67 bool use_modal_dialog_; |
| 71 | 68 |
| 72 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptConfig); | 69 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptConfig); |
| 73 }; | 70 }; |
| 74 | 71 |
| 75 } // namespace safe_browsing | 72 } // namespace safe_browsing |
| 76 | 73 |
| 77 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO MPT_CONFIG_H_ | 74 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO MPT_CONFIG_H_ |
| OLD | NEW |