| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 const TimeRange& time_range, | 298 const TimeRange& time_range, |
| 299 int remove_mask, | 299 int remove_mask, |
| 300 int origin_type_mask, | 300 int origin_type_mask, |
| 301 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder, | 301 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder, |
| 302 Observer* observer); | 302 Observer* observer); |
| 303 | 303 |
| 304 private: | 304 private: |
| 305 // The clear API needs to be able to toggle removing_ in order to test that | 305 // The clear API needs to be able to toggle removing_ in order to test that |
| 306 // only one BrowsingDataRemover instance can be called at a time. | 306 // only one BrowsingDataRemover instance can be called at a time. |
| 307 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); | 307 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); |
| 308 // Testing our static method, ClearSettingsForOneTypeWithPredicate. | |
| 309 FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, ClearWithPredicate); | |
| 310 // Testing the private RemovalTask. | 308 // Testing the private RemovalTask. |
| 311 FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, MultipleTasks); | 309 FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, MultipleTasks); |
| 312 | 310 |
| 313 // The BrowsingDataRemover tests need to be able to access the implementation | 311 // The BrowsingDataRemover tests need to be able to access the implementation |
| 314 // of Remove(), as it exposes details that aren't yet available in the public | 312 // of Remove(), as it exposes details that aren't yet available in the public |
| 315 // API. As soon as those details are exposed via new methods, this should be | 313 // API. As soon as those details are exposed via new methods, this should be |
| 316 // removed. | 314 // removed. |
| 317 // | 315 // |
| 318 // TODO(mkwst): See http://crbug.com/113621 | 316 // TODO(mkwst): See http://crbug.com/113621 |
| 319 friend class BrowsingDataRemoverTest; | 317 friend class BrowsingDataRemoverTest; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 330 Observer* observer); | 328 Observer* observer); |
| 331 ~RemovalTask(); | 329 ~RemovalTask(); |
| 332 | 330 |
| 333 TimeRange time_range; | 331 TimeRange time_range; |
| 334 int remove_mask; | 332 int remove_mask; |
| 335 int origin_type_mask; | 333 int origin_type_mask; |
| 336 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder; | 334 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder; |
| 337 Observer* observer; | 335 Observer* observer; |
| 338 }; | 336 }; |
| 339 | 337 |
| 340 // Clears all host-specific settings for one content type that satisfy the | |
| 341 // given predicate. | |
| 342 // | |
| 343 // This should only be called on the UI thread. | |
| 344 static void ClearSettingsForOneTypeWithPredicate( | |
| 345 HostContentSettingsMap* content_settings_map, | |
| 346 ContentSettingsType content_type, | |
| 347 const base::Callback< | |
| 348 bool(const ContentSettingsPattern& primary_pattern, | |
| 349 const ContentSettingsPattern& secondary_pattern)>& predicate); | |
| 350 | |
| 351 void Shutdown() override; | 338 void Shutdown() override; |
| 352 | 339 |
| 353 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're | 340 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're |
| 354 // not already removing, and vice-versa. | 341 // not already removing, and vice-versa. |
| 355 void SetRemoving(bool is_removing); | 342 void SetRemoving(bool is_removing); |
| 356 | 343 |
| 357 // Callback for when TemplateURLService has finished loading. Clears the data, | 344 // Callback for when TemplateURLService has finished loading. Clears the data, |
| 358 // clears the respective waiting flag, and invokes NotifyIfDone. | 345 // clears the respective waiting flag, and invokes NotifyIfDone. |
| 359 void OnKeywordsLoaded(base::Callback<bool(const GURL&)> url_filter); | 346 void OnKeywordsLoaded(base::Callback<bool(const GURL&)> url_filter); |
| 360 | 347 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // not initialised, so the registry must be mocked out. | 568 // not initialised, so the registry must be mocked out. |
| 582 std::unique_ptr<WebappRegistry> webapp_registry_; | 569 std::unique_ptr<WebappRegistry> webapp_registry_; |
| 583 #endif | 570 #endif |
| 584 | 571 |
| 585 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; | 572 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; |
| 586 | 573 |
| 587 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 574 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 588 }; | 575 }; |
| 589 | 576 |
| 590 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 577 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |