Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: chrome/browser/browsing_data/local_data_container.cc

Issue 863503002: Delete cookies for site when deleting locally stored data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Augment string, as per discussion in bug Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/local_data_container.h" 5 #include "chrome/browser/browsing_data/local_data_container.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/linked_ptr.h" 8 #include "base/memory/linked_ptr.h"
9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
(...skipping 21 matching lines...) Expand all
32 database_helper_(database_helper), 32 database_helper_(database_helper),
33 local_storage_helper_(local_storage_helper), 33 local_storage_helper_(local_storage_helper),
34 session_storage_helper_(session_storage_helper), 34 session_storage_helper_(session_storage_helper),
35 indexed_db_helper_(indexed_db_helper), 35 indexed_db_helper_(indexed_db_helper),
36 file_system_helper_(file_system_helper), 36 file_system_helper_(file_system_helper),
37 quota_helper_(quota_helper), 37 quota_helper_(quota_helper),
38 channel_id_helper_(channel_id_helper), 38 channel_id_helper_(channel_id_helper),
39 service_worker_helper_(service_worker_helper), 39 service_worker_helper_(service_worker_helper),
40 flash_lso_helper_(flash_lso_helper), 40 flash_lso_helper_(flash_lso_helper),
41 model_(NULL), 41 model_(NULL),
42 batches_started_(0),
42 weak_ptr_factory_(this) { 43 weak_ptr_factory_(this) {
43 } 44 }
44 45
45 LocalDataContainer::~LocalDataContainer() {} 46 LocalDataContainer::~LocalDataContainer() {}
46 47
47 void LocalDataContainer::Init(CookiesTreeModel* model) { 48 void LocalDataContainer::Init(CookiesTreeModel* model) {
48 DCHECK(!model_); 49 DCHECK(!model_);
49 model_ = model; 50 model_ = model;
50 51
52 batches_started_ = 1;
51 DCHECK(cookie_helper_.get()); 53 DCHECK(cookie_helper_.get());
52 cookie_helper_->StartFetching( 54 cookie_helper_->StartFetching(
53 base::Bind(&LocalDataContainer::OnCookiesModelInfoLoaded, 55 base::Bind(&LocalDataContainer::OnCookiesModelInfoLoaded,
54 weak_ptr_factory_.GetWeakPtr())); 56 weak_ptr_factory_.GetWeakPtr()));
55 57
56 if (database_helper_.get()) { 58 if (database_helper_.get()) {
59 batches_started_++;
57 database_helper_->StartFetching( 60 database_helper_->StartFetching(
58 base::Bind(&LocalDataContainer::OnDatabaseModelInfoLoaded, 61 base::Bind(&LocalDataContainer::OnDatabaseModelInfoLoaded,
59 weak_ptr_factory_.GetWeakPtr())); 62 weak_ptr_factory_.GetWeakPtr()));
60 } 63 }
61 64
62 if (local_storage_helper_.get()) { 65 if (local_storage_helper_.get()) {
66 batches_started_++;
63 local_storage_helper_->StartFetching( 67 local_storage_helper_->StartFetching(
64 base::Bind(&LocalDataContainer::OnLocalStorageModelInfoLoaded, 68 base::Bind(&LocalDataContainer::OnLocalStorageModelInfoLoaded,
65 weak_ptr_factory_.GetWeakPtr())); 69 weak_ptr_factory_.GetWeakPtr()));
66 } 70 }
67 71
68 if (session_storage_helper_.get()) { 72 if (session_storage_helper_.get()) {
73 batches_started_++;
69 session_storage_helper_->StartFetching( 74 session_storage_helper_->StartFetching(
70 base::Bind(&LocalDataContainer::OnSessionStorageModelInfoLoaded, 75 base::Bind(&LocalDataContainer::OnSessionStorageModelInfoLoaded,
71 weak_ptr_factory_.GetWeakPtr())); 76 weak_ptr_factory_.GetWeakPtr()));
72 } 77 }
73 78
74 // TODO(michaeln): When all of the UI implementations have been updated, make 79 // TODO(michaeln): When all of the UI implementations have been updated, make
75 // this a required parameter. 80 // this a required parameter.
76 if (appcache_helper_.get()) { 81 if (appcache_helper_.get()) {
82 batches_started_++;
77 appcache_helper_->StartFetching( 83 appcache_helper_->StartFetching(
78 base::Bind(&LocalDataContainer::OnAppCacheModelInfoLoaded, 84 base::Bind(&LocalDataContainer::OnAppCacheModelInfoLoaded,
79 weak_ptr_factory_.GetWeakPtr())); 85 weak_ptr_factory_.GetWeakPtr()));
80 } 86 }
81 87
82 if (indexed_db_helper_.get()) { 88 if (indexed_db_helper_.get()) {
89 batches_started_++;
83 indexed_db_helper_->StartFetching( 90 indexed_db_helper_->StartFetching(
84 base::Bind(&LocalDataContainer::OnIndexedDBModelInfoLoaded, 91 base::Bind(&LocalDataContainer::OnIndexedDBModelInfoLoaded,
85 weak_ptr_factory_.GetWeakPtr())); 92 weak_ptr_factory_.GetWeakPtr()));
86 } 93 }
87 94
88 if (file_system_helper_.get()) { 95 if (file_system_helper_.get()) {
96 batches_started_++;
89 file_system_helper_->StartFetching( 97 file_system_helper_->StartFetching(
90 base::Bind(&LocalDataContainer::OnFileSystemModelInfoLoaded, 98 base::Bind(&LocalDataContainer::OnFileSystemModelInfoLoaded,
91 weak_ptr_factory_.GetWeakPtr())); 99 weak_ptr_factory_.GetWeakPtr()));
92 } 100 }
93 101
94 if (quota_helper_.get()) { 102 if (quota_helper_.get()) {
103 batches_started_++;
95 quota_helper_->StartFetching( 104 quota_helper_->StartFetching(
96 base::Bind(&LocalDataContainer::OnQuotaModelInfoLoaded, 105 base::Bind(&LocalDataContainer::OnQuotaModelInfoLoaded,
97 weak_ptr_factory_.GetWeakPtr())); 106 weak_ptr_factory_.GetWeakPtr()));
98 } 107 }
99 108
100 if (channel_id_helper_.get()) { 109 if (channel_id_helper_.get()) {
110 batches_started_++;
101 channel_id_helper_->StartFetching( 111 channel_id_helper_->StartFetching(
102 base::Bind(&LocalDataContainer::OnChannelIDModelInfoLoaded, 112 base::Bind(&LocalDataContainer::OnChannelIDModelInfoLoaded,
103 weak_ptr_factory_.GetWeakPtr())); 113 weak_ptr_factory_.GetWeakPtr()));
104 } 114 }
105 115
106 if (service_worker_helper_.get()) { 116 if (service_worker_helper_.get()) {
117 batches_started_++;
107 service_worker_helper_->StartFetching( 118 service_worker_helper_->StartFetching(
108 base::Bind(&LocalDataContainer::OnServiceWorkerModelInfoLoaded, 119 base::Bind(&LocalDataContainer::OnServiceWorkerModelInfoLoaded,
109 weak_ptr_factory_.GetWeakPtr())); 120 weak_ptr_factory_.GetWeakPtr()));
110 } 121 }
111 122
112 if (flash_lso_helper_.get()) { 123 if (flash_lso_helper_.get()) {
124 batches_started_++;
113 flash_lso_helper_->StartFetching( 125 flash_lso_helper_->StartFetching(
114 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, 126 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded,
115 weak_ptr_factory_.GetWeakPtr())); 127 weak_ptr_factory_.GetWeakPtr()));
116 } 128 }
129
130 model_->SetBatchExpectation(batches_started_, true);
117 } 131 }
118 132
119 void LocalDataContainer::OnAppCacheModelInfoLoaded() { 133 void LocalDataContainer::OnAppCacheModelInfoLoaded() {
120 using content::AppCacheInfo; 134 using content::AppCacheInfo;
121 using content::AppCacheInfoCollection; 135 using content::AppCacheInfoCollection;
122 using content::AppCacheInfoVector; 136 using content::AppCacheInfoVector;
123 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; 137 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin;
124 138
125 scoped_refptr<AppCacheInfoCollection> appcache_info = 139 scoped_refptr<AppCacheInfoCollection> appcache_info =
126 appcache_helper_->info_collection(); 140 appcache_helper_->info_collection();
127 if (!appcache_info.get() || appcache_info->infos_by_origin.empty()) 141 if (!appcache_info.get() || appcache_info->infos_by_origin.empty()) {
142 // This batch has been canceled, so let the model know it won't be arriving.
143 model_->SetBatchExpectation(--batches_started_, false);
128 return; 144 return;
145 }
129 146
130 for (InfoByOrigin::const_iterator origin = 147 for (InfoByOrigin::const_iterator origin =
131 appcache_info->infos_by_origin.begin(); 148 appcache_info->infos_by_origin.begin();
132 origin != appcache_info->infos_by_origin.end(); ++origin) { 149 origin != appcache_info->infos_by_origin.end(); ++origin) {
133 std::list<AppCacheInfo>& info_list = appcache_info_[origin->first]; 150 std::list<AppCacheInfo>& info_list = appcache_info_[origin->first];
134 info_list.insert( 151 info_list.insert(
135 info_list.begin(), origin->second.begin(), origin->second.end()); 152 info_list.begin(), origin->second.begin(), origin->second.end());
136 } 153 }
137 154
138 model_->PopulateAppCacheInfo(this); 155 model_->PopulateAppCacheInfo(this);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 DCHECK(model_); 219 DCHECK(model_);
203 model_->PopulateServiceWorkerUsageInfo(this); 220 model_->PopulateServiceWorkerUsageInfo(this);
204 } 221 }
205 222
206 void LocalDataContainer::OnFlashLSOInfoLoaded( 223 void LocalDataContainer::OnFlashLSOInfoLoaded(
207 const FlashLSODomainList& domains) { 224 const FlashLSODomainList& domains) {
208 flash_lso_domain_list_ = domains; 225 flash_lso_domain_list_ = domains;
209 DCHECK(model_); 226 DCHECK(model_);
210 model_->PopulateFlashLSOInfo(this); 227 model_->PopulateFlashLSOInfo(this);
211 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698