| 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 COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ | 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 friend class PasswordProtectionServiceTest; | 124 friend class PasswordProtectionServiceTest; |
| 125 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | 125 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, |
| 126 TestParseInvalidVerdictEntry); | 126 TestParseInvalidVerdictEntry); |
| 127 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | 127 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, |
| 128 TestParseValidVerdictEntry); | 128 TestParseValidVerdictEntry); |
| 129 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | 129 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, |
| 130 TestPathVariantsMatchCacheExpression); | 130 TestPathVariantsMatchCacheExpression); |
| 131 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | 131 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, |
| 132 TestPathMatchCacheExpressionExactly); | |
| 133 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | |
| 134 TestCleanUpCachedVerdicts); | 132 TestCleanUpCachedVerdicts); |
| 135 | 133 |
| 136 // Overridden from history::HistoryServiceObserver. | 134 // Overridden from history::HistoryServiceObserver. |
| 137 void OnURLsDeleted(history::HistoryService* history_service, | 135 void OnURLsDeleted(history::HistoryService* history_service, |
| 138 bool all_history, | 136 bool all_history, |
| 139 bool expired, | 137 bool expired, |
| 140 const history::URLRows& deleted_rows, | 138 const history::URLRows& deleted_rows, |
| 141 const std::set<GURL>& favicon_urls) override; | 139 const std::set<GURL>& favicon_urls) override; |
| 142 | 140 |
| 143 void HistoryServiceBeingDeleted( | 141 void HistoryServiceBeingDeleted( |
| 144 history::HistoryService* history_service) override; | 142 history::HistoryService* history_service) override; |
| 145 | 143 |
| 146 // Posted to UI thread by OnURLsDeleted(..). This function cleans up password | 144 // Posted to UI thread by OnURLsDeleted(..). This function cleans up password |
| 147 // protection content settings related to deleted URLs. | 145 // protection content settings related to deleted URLs. |
| 148 void RemoveContentSettingsOnURLsDeleted(bool all_history, | 146 void RemoveContentSettingsOnURLsDeleted(bool all_history, |
| 149 const history::URLRows& deleted_rows); | 147 const history::URLRows& deleted_rows); |
| 150 | 148 |
| 151 static bool ParseVerdictEntry(base::DictionaryValue* verdict_entry, | 149 static bool ParseVerdictEntry(base::DictionaryValue* verdict_entry, |
| 152 int* out_verdict_received_time, | 150 int* out_verdict_received_time, |
| 153 LoginReputationClientResponse* out_verdict); | 151 LoginReputationClientResponse* out_verdict); |
| 154 | 152 |
| 155 static bool PathMatchCacheExpressionExactly( | |
| 156 const std::vector<std::string>& generated_paths, | |
| 157 const std::string& cache_expression_path); | |
| 158 | |
| 159 static bool PathVariantsMatchCacheExpression( | 153 static bool PathVariantsMatchCacheExpression( |
| 160 const std::vector<std::string>& generated_paths, | 154 const std::vector<std::string>& generated_paths, |
| 161 const std::string& cache_expression_path); | 155 const std::string& cache_expression_path); |
| 162 | 156 |
| 163 static bool IsCacheExpired(int cache_creation_time, int cache_duration); | 157 static bool IsCacheExpired(int cache_creation_time, int cache_duration); |
| 164 | 158 |
| 165 static void GeneratePathVariantsWithoutQuery(const GURL& url, | 159 static void GeneratePathVariantsWithoutQuery(const GURL& url, |
| 166 std::vector<std::string>* paths); | 160 std::vector<std::string>* paths); |
| 167 | 161 |
| 168 static std::string GetCacheExpressionPath( | 162 static std::string GetCacheExpressionPath( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 191 // Content settings map associated with this instance. | 185 // Content settings map associated with this instance. |
| 192 HostContentSettingsMap* content_settings_; | 186 HostContentSettingsMap* content_settings_; |
| 193 | 187 |
| 194 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; | 188 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; |
| 195 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); | 189 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); |
| 196 }; | 190 }; |
| 197 | 191 |
| 198 } // namespace safe_browsing | 192 } // namespace safe_browsing |
| 199 | 193 |
| 200 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV
ICE_H_ | 194 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV
ICE_H_ |
| OLD | NEW |