| 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> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 virtual ~SettingsResetPromptConfig(); | 33 virtual ~SettingsResetPromptConfig(); |
| 34 | 34 |
| 35 // Returns a non-negative integer ID if |url| should trigger a | 35 // Returns a non-negative integer ID if |url| should trigger a |
| 36 // settings reset prompt and a negative integer otherwise. The IDs | 36 // settings reset prompt and a negative integer otherwise. The IDs |
| 37 // 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 |
| 38 // for and can be used for metrics reporting. | 38 // for and can be used for metrics reporting. |
| 39 virtual int UrlToResetDomainId(const GURL& url) const; | 39 virtual int UrlToResetDomainId(const GURL& url) const; |
| 40 | 40 |
| 41 // The delay before showing the reset prompt after Chrome startup. | 41 // The delay before showing the reset prompt after Chrome startup. |
| 42 base::TimeDelta delay_before_prompt() const; | 42 base::TimeDelta delay_before_prompt() const; |
| 43 // Integer that identifies the current prompt wave. This number will increase |
| 44 // with each new prompt wave. |
| 45 int prompt_wave() const; |
| 46 // The minimum time that must pass since the last time the prompt was shown |
| 47 // before a new prompt can be shown. Applies only to prompts shown during the |
| 48 // same prompt wave. |
| 49 base::TimeDelta time_between_prompts() const; |
| 43 | 50 |
| 44 protected: | 51 protected: |
| 45 SettingsResetPromptConfig(); | 52 SettingsResetPromptConfig(); |
| 46 | 53 |
| 47 private: | 54 private: |
| 48 using SHA256Hash = std::vector<uint8_t>; | 55 using SHA256Hash = std::vector<uint8_t>; |
| 49 struct SHA256HashHasher { | 56 struct SHA256HashHasher { |
| 50 size_t operator()(const SHA256Hash& key) const; | 57 size_t operator()(const SHA256Hash& key) const; |
| 51 }; | 58 }; |
| 52 enum ConfigError : int; | 59 enum ConfigError : int; |
| 53 | 60 |
| 54 bool Init(); | 61 bool Init(); |
| 55 ConfigError ParseDomainHashes(const std::string& domain_hashes_json); | 62 ConfigError ParseDomainHashes(const std::string& domain_hashes_json); |
| 56 | 63 |
| 57 // Map of 32 byte SHA256 hashes to integer domain IDs. | 64 // Map of 32 byte SHA256 hashes to integer domain IDs. |
| 58 std::unordered_map<SHA256Hash, int, SHA256HashHasher> domain_hashes_; | 65 std::unordered_map<SHA256Hash, int, SHA256HashHasher> domain_hashes_; |
| 59 | 66 |
| 60 // Other feature parameters. | 67 // Other feature parameters. |
| 61 base::TimeDelta delay_before_prompt_; | 68 base::TimeDelta delay_before_prompt_; |
| 69 int prompt_wave_ = 0; |
| 70 base::TimeDelta time_between_prompts_; |
| 62 | 71 |
| 63 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptConfig); | 72 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptConfig); |
| 64 }; | 73 }; |
| 65 | 74 |
| 66 } // namespace safe_browsing | 75 } // namespace safe_browsing |
| 67 | 76 |
| 68 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO
MPT_CONFIG_H_ | 77 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO
MPT_CONFIG_H_ |
| OLD | NEW |