| 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 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "url/origin.h" | 41 #include "url/origin.h" |
| 42 | 42 |
| 43 using base::UserMetricsAction; | 43 using base::UserMetricsAction; |
| 44 using content::BrowserContext; | 44 using content::BrowserContext; |
| 45 using content::BrowserThread; | 45 using content::BrowserThread; |
| 46 using content::BrowsingDataFilterBuilder; | 46 using content::BrowsingDataFilterBuilder; |
| 47 using content::DOMStorageContext; | 47 using content::DOMStorageContext; |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 template <typename T> | |
| 52 void IgnoreArgumentHelper(const base::Closure& callback, T unused_argument) { | |
| 53 callback.Run(); | |
| 54 } | |
| 55 | |
| 56 // Another convenience method to turn a callback without arguments into one that | |
| 57 // accepts (and ignores) a single argument. | |
| 58 template <typename T> | |
| 59 base::Callback<void(T)> IgnoreArgument(const base::Closure& callback) { | |
| 60 return base::Bind(&IgnoreArgumentHelper<T>, callback); | |
| 61 } | |
| 62 | |
| 63 // Returns whether |origin| matches |origin_type_mask| given the special | 51 // Returns whether |origin| matches |origin_type_mask| given the special |
| 64 // storage |policy|; and if |predicate| is not null, then also whether | 52 // storage |policy|; and if |predicate| is not null, then also whether |
| 65 // it matches |predicate|. If |origin_type_mask| contains embedder-specific | 53 // it matches |predicate|. If |origin_type_mask| contains embedder-specific |
| 66 // datatypes, |embedder_matcher| must not be null; the decision for those | 54 // datatypes, |embedder_matcher| must not be null; the decision for those |
| 67 // datatypes will be delegated to it. | 55 // datatypes will be delegated to it. |
| 68 bool DoesOriginMatchMaskAndURLs( | 56 bool DoesOriginMatchMaskAndURLs( |
| 69 int origin_type_mask, | 57 int origin_type_mask, |
| 70 const base::Callback<bool(const GURL&)>& predicate, | 58 const base::Callback<bool(const GURL&)>& predicate, |
| 71 const BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher& | 59 const BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher& |
| 72 embedder_matcher, | 60 embedder_matcher, |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 668 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 681 base::WeakPtr<BrowsingDataRemoverImpl> weak_ptr = | 669 base::WeakPtr<BrowsingDataRemoverImpl> weak_ptr = |
| 682 weak_ptr_factory_.GetWeakPtr(); | 670 weak_ptr_factory_.GetWeakPtr(); |
| 683 | 671 |
| 684 // Immediately bind the weak pointer to the UI thread. This makes it easier | 672 // Immediately bind the weak pointer to the UI thread. This makes it easier |
| 685 // to discover potential misuse on the IO thread. | 673 // to discover potential misuse on the IO thread. |
| 686 weak_ptr.get(); | 674 weak_ptr.get(); |
| 687 | 675 |
| 688 return weak_ptr; | 676 return weak_ptr; |
| 689 } | 677 } |
| OLD | NEW |