| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 const TimeRange& time_range, | 324 const TimeRange& time_range, |
| 325 int remove_mask, | 325 int remove_mask, |
| 326 int origin_type_mask, | 326 int origin_type_mask, |
| 327 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder, | 327 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder, |
| 328 Observer* observer); | 328 Observer* observer); |
| 329 | 329 |
| 330 private: | 330 private: |
| 331 // The clear API needs to be able to toggle removing_ in order to test that | 331 // The clear API needs to be able to toggle removing_ in order to test that |
| 332 // only one BrowsingDataRemover instance can be called at a time. | 332 // only one BrowsingDataRemover instance can be called at a time. |
| 333 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); | 333 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); |
| 334 // Testing our static method, ClearSettingsForOneTypeWithPredicate. | |
| 335 FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, ClearWithPredicate); | |
| 336 // Testing the private RemovalTask. | 334 // Testing the private RemovalTask. |
| 337 FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, MultipleTasks); | 335 FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, MultipleTasks); |
| 338 | 336 |
| 339 // The BrowsingDataRemover tests need to be able to access the implementation | 337 // The BrowsingDataRemover tests need to be able to access the implementation |
| 340 // of Remove(), as it exposes details that aren't yet available in the public | 338 // of Remove(), as it exposes details that aren't yet available in the public |
| 341 // API. As soon as those details are exposed via new methods, this should be | 339 // API. As soon as those details are exposed via new methods, this should be |
| 342 // removed. | 340 // removed. |
| 343 // | 341 // |
| 344 // TODO(mkwst): See http://crbug.com/113621 | 342 // TODO(mkwst): See http://crbug.com/113621 |
| 345 friend class BrowsingDataRemoverTest; | 343 friend class BrowsingDataRemoverTest; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 356 Observer* observer); | 354 Observer* observer); |
| 357 ~RemovalTask(); | 355 ~RemovalTask(); |
| 358 | 356 |
| 359 TimeRange time_range; | 357 TimeRange time_range; |
| 360 int remove_mask; | 358 int remove_mask; |
| 361 int origin_type_mask; | 359 int origin_type_mask; |
| 362 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder; | 360 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder; |
| 363 Observer* observer; | 361 Observer* observer; |
| 364 }; | 362 }; |
| 365 | 363 |
| 366 // Clears all host-specific settings for one content type that satisfy the | |
| 367 // given predicate. | |
| 368 // | |
| 369 // This should only be called on the UI thread. | |
| 370 static void ClearSettingsForOneTypeWithPredicate( | |
| 371 HostContentSettingsMap* content_settings_map, | |
| 372 ContentSettingsType content_type, | |
| 373 const base::Callback< | |
| 374 bool(const ContentSettingsPattern& primary_pattern, | |
| 375 const ContentSettingsPattern& secondary_pattern)>& predicate); | |
| 376 | |
| 377 void Shutdown() override; | 364 void Shutdown() override; |
| 378 | 365 |
| 379 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're | 366 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're |
| 380 // not already removing, and vice-versa. | 367 // not already removing, and vice-versa. |
| 381 void SetRemoving(bool is_removing); | 368 void SetRemoving(bool is_removing); |
| 382 | 369 |
| 383 // Callback for when TemplateURLService has finished loading. Clears the data, | 370 // Callback for when TemplateURLService has finished loading. Clears the data, |
| 384 // clears the respective waiting flag, and invokes NotifyIfDone. | 371 // clears the respective waiting flag, and invokes NotifyIfDone. |
| 385 void OnKeywordsLoaded(); | 372 void OnKeywordsLoaded(); |
| 386 | 373 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // not initialised, so the registry must be mocked out. | 589 // not initialised, so the registry must be mocked out. |
| 603 std::unique_ptr<WebappRegistry> webapp_registry_; | 590 std::unique_ptr<WebappRegistry> webapp_registry_; |
| 604 #endif | 591 #endif |
| 605 | 592 |
| 606 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; | 593 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; |
| 607 | 594 |
| 608 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 595 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 609 }; | 596 }; |
| 610 | 597 |
| 611 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 598 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |