OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cookies_tree_model.h" | 5 #include "chrome/browser/cookies_tree_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // model, and tell CookieMonster to delete the cookies. We can keep the | 61 // model, and tell CookieMonster to delete the cookies. We can keep the |
62 // vector storing the cookies in-tact and not delete from there (that would | 62 // vector storing the cookies in-tact and not delete from there (that would |
63 // invalidate our pointers), and the fact that it contains semi out-of-date | 63 // invalidate our pointers), and the fact that it contains semi out-of-date |
64 // data is not problematic as we don't re-build the model based on that. | 64 // data is not problematic as we don't re-build the model based on that. |
65 GetModel()->cookie_monster_->DeleteCanonicalCookie(*cookie_); | 65 GetModel()->cookie_monster_->DeleteCanonicalCookie(*cookie_); |
66 } | 66 } |
67 | 67 |
68 CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const { | 68 CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const { |
69 return DetailedInfo(parent()->parent()->GetTitle(), | 69 return DetailedInfo(parent()->parent()->GetTitle(), |
70 DetailedInfo::TYPE_COOKIE, | 70 DetailedInfo::TYPE_COOKIE, |
71 cookie_, NULL, NULL, NULL, NULL, NULL, NULL); | 71 cookie_, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
72 } | 72 } |
73 | 73 |
74 namespace { | 74 namespace { |
75 // comparison functor, for use in CookieTreeRootNode | 75 // comparison functor, for use in CookieTreeRootNode |
76 class OriginNodeComparator { | 76 class OriginNodeComparator { |
77 public: | 77 public: |
78 bool operator() (const CookieTreeNode* lhs, | 78 bool operator() (const CookieTreeNode* lhs, |
79 const CookieTreeNode* rhs) { | 79 const CookieTreeNode* rhs) { |
80 // We want to order by registry controlled domain, so we would get | 80 // We want to order by registry controlled domain, so we would get |
81 // google.com, ad.google.com, www.google.com, | 81 // google.com, ad.google.com, www.google.com, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 void CookieTreeAppCacheNode::DeleteStoredObjects() { | 142 void CookieTreeAppCacheNode::DeleteStoredObjects() { |
143 DCHECK(GetModel()->appcache_helper_); | 143 DCHECK(GetModel()->appcache_helper_); |
144 GetModel()->appcache_helper_->DeleteAppCacheGroup( | 144 GetModel()->appcache_helper_->DeleteAppCacheGroup( |
145 appcache_info_->manifest_url); | 145 appcache_info_->manifest_url); |
146 } | 146 } |
147 | 147 |
148 CookieTreeNode::DetailedInfo CookieTreeAppCacheNode::GetDetailedInfo() const { | 148 CookieTreeNode::DetailedInfo CookieTreeAppCacheNode::GetDetailedInfo() const { |
149 return DetailedInfo(parent()->parent()->GetTitle(), | 149 return DetailedInfo(parent()->parent()->GetTitle(), |
150 DetailedInfo::TYPE_APPCACHE, | 150 DetailedInfo::TYPE_APPCACHE, |
151 NULL, NULL, NULL, NULL, appcache_info_, NULL, NULL); | 151 NULL, NULL, NULL, NULL, appcache_info_, NULL, NULL, NULL); |
152 } | 152 } |
153 | 153 |
154 /////////////////////////////////////////////////////////////////////////////// | 154 /////////////////////////////////////////////////////////////////////////////// |
155 // CookieTreeDatabaseNode, public: | 155 // CookieTreeDatabaseNode, public: |
156 | 156 |
157 CookieTreeDatabaseNode::CookieTreeDatabaseNode( | 157 CookieTreeDatabaseNode::CookieTreeDatabaseNode( |
158 BrowsingDataDatabaseHelper::DatabaseInfo* database_info) | 158 BrowsingDataDatabaseHelper::DatabaseInfo* database_info) |
159 : CookieTreeNode(database_info->database_name.empty() ? | 159 : CookieTreeNode(database_info->database_name.empty() ? |
160 l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : | 160 l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : |
161 UTF8ToUTF16(database_info->database_name)), | 161 UTF8ToUTF16(database_info->database_name)), |
162 database_info_(database_info) { | 162 database_info_(database_info) { |
163 } | 163 } |
164 | 164 |
165 CookieTreeDatabaseNode::~CookieTreeDatabaseNode() {} | 165 CookieTreeDatabaseNode::~CookieTreeDatabaseNode() {} |
166 | 166 |
167 void CookieTreeDatabaseNode::DeleteStoredObjects() { | 167 void CookieTreeDatabaseNode::DeleteStoredObjects() { |
168 GetModel()->database_helper_->DeleteDatabase( | 168 GetModel()->database_helper_->DeleteDatabase( |
169 database_info_->origin_identifier, database_info_->database_name); | 169 database_info_->origin_identifier, database_info_->database_name); |
170 } | 170 } |
171 | 171 |
172 CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const { | 172 CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const { |
173 return DetailedInfo(parent()->parent()->GetTitle(), | 173 return DetailedInfo(parent()->parent()->GetTitle(), |
174 DetailedInfo::TYPE_DATABASE, | 174 DetailedInfo::TYPE_DATABASE, |
175 NULL, database_info_, NULL, NULL, NULL, NULL, NULL); | 175 NULL, database_info_, NULL, NULL, NULL, NULL, NULL, NULL); |
176 } | 176 } |
177 | 177 |
178 /////////////////////////////////////////////////////////////////////////////// | 178 /////////////////////////////////////////////////////////////////////////////// |
179 // CookieTreeLocalStorageNode, public: | 179 // CookieTreeLocalStorageNode, public: |
180 | 180 |
181 CookieTreeLocalStorageNode::CookieTreeLocalStorageNode( | 181 CookieTreeLocalStorageNode::CookieTreeLocalStorageNode( |
182 BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info) | 182 BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info) |
183 : CookieTreeNode(UTF8ToUTF16( | 183 : CookieTreeNode(UTF8ToUTF16( |
184 local_storage_info->origin.empty() ? | 184 local_storage_info->origin.empty() ? |
185 local_storage_info->database_identifier : | 185 local_storage_info->database_identifier : |
186 local_storage_info->origin)), | 186 local_storage_info->origin)), |
187 local_storage_info_(local_storage_info) { | 187 local_storage_info_(local_storage_info) { |
188 } | 188 } |
189 | 189 |
190 CookieTreeLocalStorageNode::~CookieTreeLocalStorageNode() {} | 190 CookieTreeLocalStorageNode::~CookieTreeLocalStorageNode() {} |
191 | 191 |
192 void CookieTreeLocalStorageNode::DeleteStoredObjects() { | 192 void CookieTreeLocalStorageNode::DeleteStoredObjects() { |
193 GetModel()->local_storage_helper_->DeleteLocalStorageFile( | 193 GetModel()->local_storage_helper_->DeleteLocalStorageFile( |
194 local_storage_info_->file_path); | 194 local_storage_info_->file_path); |
195 } | 195 } |
196 | 196 |
197 CookieTreeNode::DetailedInfo | 197 CookieTreeNode::DetailedInfo |
198 CookieTreeLocalStorageNode::GetDetailedInfo() const { | 198 CookieTreeLocalStorageNode::GetDetailedInfo() const { |
199 return DetailedInfo(parent()->parent()->GetTitle(), | 199 return DetailedInfo(parent()->parent()->GetTitle(), |
200 DetailedInfo::TYPE_LOCAL_STORAGE, | 200 DetailedInfo::TYPE_LOCAL_STORAGE, |
201 NULL, NULL, local_storage_info_, NULL, NULL, NULL, NULL); | 201 NULL, NULL, local_storage_info_, NULL, NULL, NULL, NULL, |
| 202 NULL); |
202 } | 203 } |
203 | 204 |
204 /////////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////////// |
205 // CookieTreeSessionStorageNode, public: | 206 // CookieTreeSessionStorageNode, public: |
206 | 207 |
207 CookieTreeSessionStorageNode::CookieTreeSessionStorageNode( | 208 CookieTreeSessionStorageNode::CookieTreeSessionStorageNode( |
208 BrowsingDataLocalStorageHelper::LocalStorageInfo* session_storage_info) | 209 BrowsingDataLocalStorageHelper::LocalStorageInfo* session_storage_info) |
209 : CookieTreeNode(UTF8ToUTF16( | 210 : CookieTreeNode(UTF8ToUTF16( |
210 session_storage_info->origin.empty() ? | 211 session_storage_info->origin.empty() ? |
211 session_storage_info->database_identifier : | 212 session_storage_info->database_identifier : |
212 session_storage_info->origin)), | 213 session_storage_info->origin)), |
213 session_storage_info_(session_storage_info) { | 214 session_storage_info_(session_storage_info) { |
214 } | 215 } |
215 | 216 |
216 CookieTreeSessionStorageNode::~CookieTreeSessionStorageNode() {} | 217 CookieTreeSessionStorageNode::~CookieTreeSessionStorageNode() {} |
217 | 218 |
218 CookieTreeNode::DetailedInfo | 219 CookieTreeNode::DetailedInfo |
219 CookieTreeSessionStorageNode::GetDetailedInfo() const { | 220 CookieTreeSessionStorageNode::GetDetailedInfo() const { |
220 return DetailedInfo(parent()->parent()->GetTitle(), | 221 return DetailedInfo(parent()->parent()->GetTitle(), |
221 DetailedInfo::TYPE_SESSION_STORAGE, | 222 DetailedInfo::TYPE_SESSION_STORAGE, |
222 NULL, NULL, NULL, session_storage_info_, NULL, NULL, | 223 NULL, NULL, NULL, session_storage_info_, NULL, NULL, |
223 NULL); | 224 NULL, NULL); |
224 } | 225 } |
225 | 226 |
226 /////////////////////////////////////////////////////////////////////////////// | 227 /////////////////////////////////////////////////////////////////////////////// |
227 // CookieTreeIndexedDBNode, public: | 228 // CookieTreeIndexedDBNode, public: |
228 | 229 |
229 CookieTreeIndexedDBNode::CookieTreeIndexedDBNode( | 230 CookieTreeIndexedDBNode::CookieTreeIndexedDBNode( |
230 BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info) | 231 BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info) |
231 : CookieTreeNode(UTF8ToUTF16( | 232 : CookieTreeNode(UTF8ToUTF16( |
232 indexed_db_info->origin.empty() ? | 233 indexed_db_info->origin.empty() ? |
233 indexed_db_info->database_identifier : | 234 indexed_db_info->database_identifier : |
234 indexed_db_info->origin)), | 235 indexed_db_info->origin)), |
235 indexed_db_info_(indexed_db_info) { | 236 indexed_db_info_(indexed_db_info) { |
236 } | 237 } |
237 | 238 |
238 CookieTreeIndexedDBNode::~CookieTreeIndexedDBNode() {} | 239 CookieTreeIndexedDBNode::~CookieTreeIndexedDBNode() {} |
239 | 240 |
240 void CookieTreeIndexedDBNode::DeleteStoredObjects() { | 241 void CookieTreeIndexedDBNode::DeleteStoredObjects() { |
241 GetModel()->indexed_db_helper_->DeleteIndexedDBFile( | 242 GetModel()->indexed_db_helper_->DeleteIndexedDBFile( |
242 indexed_db_info_->file_path); | 243 indexed_db_info_->file_path); |
243 } | 244 } |
244 | 245 |
245 CookieTreeNode::DetailedInfo CookieTreeIndexedDBNode::GetDetailedInfo() const { | 246 CookieTreeNode::DetailedInfo CookieTreeIndexedDBNode::GetDetailedInfo() const { |
246 return DetailedInfo(parent()->parent()->GetTitle(), | 247 return DetailedInfo(parent()->parent()->GetTitle(), |
247 DetailedInfo::TYPE_INDEXED_DB, | 248 DetailedInfo::TYPE_INDEXED_DB, |
248 NULL, NULL, NULL, NULL, NULL, indexed_db_info_, NULL); | 249 NULL, NULL, NULL, NULL, NULL, indexed_db_info_, NULL, |
| 250 NULL); |
249 } | 251 } |
250 | 252 |
251 /////////////////////////////////////////////////////////////////////////////// | 253 /////////////////////////////////////////////////////////////////////////////// |
252 // CookieTreeFileSystemNode, public: | 254 // CookieTreeFileSystemNode, public: |
253 | 255 |
254 CookieTreeFileSystemNode::CookieTreeFileSystemNode( | 256 CookieTreeFileSystemNode::CookieTreeFileSystemNode( |
255 BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) | 257 BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) |
256 : CookieTreeNode(UTF8ToUTF16( | 258 : CookieTreeNode(UTF8ToUTF16( |
257 file_system_info->origin.spec())), | 259 file_system_info->origin.spec())), |
258 file_system_info_(file_system_info) { | 260 file_system_info_(file_system_info) { |
259 } | 261 } |
260 | 262 |
261 CookieTreeFileSystemNode::~CookieTreeFileSystemNode() {} | 263 CookieTreeFileSystemNode::~CookieTreeFileSystemNode() {} |
262 | 264 |
263 void CookieTreeFileSystemNode::DeleteStoredObjects() { | 265 void CookieTreeFileSystemNode::DeleteStoredObjects() { |
264 GetModel()->file_system_helper_->DeleteFileSystemOrigin( | 266 GetModel()->file_system_helper_->DeleteFileSystemOrigin( |
265 file_system_info_->origin); | 267 file_system_info_->origin); |
266 } | 268 } |
267 | 269 |
268 CookieTreeNode::DetailedInfo CookieTreeFileSystemNode::GetDetailedInfo() const { | 270 CookieTreeNode::DetailedInfo CookieTreeFileSystemNode::GetDetailedInfo() const { |
269 return DetailedInfo(parent()->parent()->GetTitle(), | 271 return DetailedInfo(parent()->parent()->GetTitle(), |
270 DetailedInfo::TYPE_FILE_SYSTEM, | 272 DetailedInfo::TYPE_FILE_SYSTEM, |
271 NULL, NULL, NULL, NULL, NULL, NULL, file_system_info_); | 273 NULL, NULL, NULL, NULL, NULL, NULL, file_system_info_, |
| 274 NULL); |
272 } | 275 } |
273 | 276 |
274 /////////////////////////////////////////////////////////////////////////////// | 277 /////////////////////////////////////////////////////////////////////////////// |
| 278 // CookieTreeQuotaNode, public: |
| 279 |
| 280 CookieTreeQuotaNode::CookieTreeQuotaNode( |
| 281 BrowsingDataQuotaHelper::QuotaInfo* quota_info) |
| 282 : CookieTreeNode(UTF8ToUTF16(quota_info->host)), |
| 283 quota_info_(quota_info) { |
| 284 } |
| 285 |
| 286 CookieTreeQuotaNode::~CookieTreeQuotaNode() {} |
| 287 |
| 288 void CookieTreeQuotaNode::DeleteStoredObjects() { |
| 289 GetModel()->quota_helper_->DeleteQuotaHost(quota_info_->host); |
| 290 } |
| 291 |
| 292 CookieTreeNode::DetailedInfo CookieTreeQuotaNode::GetDetailedInfo() const { |
| 293 return DetailedInfo(parent()->parent()->GetTitle(), |
| 294 DetailedInfo::TYPE_QUOTA, |
| 295 NULL, NULL, NULL, NULL, NULL, NULL, NULL, quota_info_); |
| 296 } |
| 297 |
| 298 /////////////////////////////////////////////////////////////////////////////// |
275 // CookieTreeRootNode, public: | 299 // CookieTreeRootNode, public: |
276 | 300 |
277 CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) | 301 CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) |
278 : model_(model) { | 302 : model_(model) { |
279 } | 303 } |
280 | 304 |
281 CookieTreeRootNode::~CookieTreeRootNode() {} | 305 CookieTreeRootNode::~CookieTreeRootNode() {} |
282 | 306 |
283 CookieTreeOriginNode* CookieTreeRootNode::GetOrCreateOriginNode( | 307 CookieTreeOriginNode* CookieTreeRootNode::GetOrCreateOriginNode( |
284 const GURL& url) { | 308 const GURL& url) { |
(...skipping 18 matching lines...) Expand all Loading... |
303 return retval; | 327 return retval; |
304 } | 328 } |
305 | 329 |
306 CookiesTreeModel* CookieTreeRootNode::GetModel() const { | 330 CookiesTreeModel* CookieTreeRootNode::GetModel() const { |
307 return model_; | 331 return model_; |
308 } | 332 } |
309 | 333 |
310 CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { | 334 CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { |
311 return DetailedInfo(string16(), | 335 return DetailedInfo(string16(), |
312 DetailedInfo::TYPE_ROOT, | 336 DetailedInfo::TYPE_ROOT, |
313 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 337 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
314 } | 338 } |
315 | 339 |
316 /////////////////////////////////////////////////////////////////////////////// | 340 /////////////////////////////////////////////////////////////////////////////// |
317 // CookieTreeOriginNode, public: | 341 // CookieTreeOriginNode, public: |
318 | 342 |
319 // static | 343 // static |
320 std::wstring CookieTreeOriginNode::TitleForUrl( | 344 std::wstring CookieTreeOriginNode::TitleForUrl( |
321 const GURL& url) { | 345 const GURL& url) { |
322 return UTF8ToWide(url.SchemeIsFile() ? kFileOriginNodeName : url.host()); | 346 return UTF8ToWide(url.SchemeIsFile() ? kFileOriginNodeName : url.host()); |
323 } | 347 } |
324 | 348 |
325 CookieTreeOriginNode::CookieTreeOriginNode(const GURL& url) | 349 CookieTreeOriginNode::CookieTreeOriginNode(const GURL& url) |
326 : CookieTreeNode(WideToUTF16Hack(TitleForUrl(url))), | 350 : CookieTreeNode(WideToUTF16Hack(TitleForUrl(url))), |
327 cookies_child_(NULL), | 351 cookies_child_(NULL), |
328 databases_child_(NULL), | 352 databases_child_(NULL), |
329 local_storages_child_(NULL), | 353 local_storages_child_(NULL), |
330 session_storages_child_(NULL), | 354 session_storages_child_(NULL), |
331 appcaches_child_(NULL), | 355 appcaches_child_(NULL), |
332 indexed_dbs_child_(NULL), | 356 indexed_dbs_child_(NULL), |
333 file_systems_child_(NULL), | 357 file_systems_child_(NULL), |
| 358 quota_child_(NULL), |
334 url_(url) {} | 359 url_(url) {} |
335 | 360 |
336 CookieTreeOriginNode::~CookieTreeOriginNode() {} | 361 CookieTreeOriginNode::~CookieTreeOriginNode() {} |
337 | 362 |
338 CookieTreeNode::DetailedInfo CookieTreeOriginNode::GetDetailedInfo() const { | 363 CookieTreeNode::DetailedInfo CookieTreeOriginNode::GetDetailedInfo() const { |
339 return DetailedInfo(GetTitle(), | 364 return DetailedInfo(GetTitle(), |
340 DetailedInfo::TYPE_ORIGIN, | 365 DetailedInfo::TYPE_ORIGIN, |
341 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 366 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
342 } | 367 } |
343 | 368 |
344 CookieTreeCookiesNode* CookieTreeOriginNode::GetOrCreateCookiesNode() { | 369 CookieTreeCookiesNode* CookieTreeOriginNode::GetOrCreateCookiesNode() { |
345 if (cookies_child_) | 370 if (cookies_child_) |
346 return cookies_child_; | 371 return cookies_child_; |
347 cookies_child_ = new CookieTreeCookiesNode; | 372 cookies_child_ = new CookieTreeCookiesNode; |
348 AddChildSortedByTitle(cookies_child_); | 373 AddChildSortedByTitle(cookies_child_); |
349 return cookies_child_; | 374 return cookies_child_; |
350 } | 375 } |
351 | 376 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 417 } |
393 | 418 |
394 CookieTreeFileSystemsNode* CookieTreeOriginNode::GetOrCreateFileSystemsNode() { | 419 CookieTreeFileSystemsNode* CookieTreeOriginNode::GetOrCreateFileSystemsNode() { |
395 if (file_systems_child_) | 420 if (file_systems_child_) |
396 return file_systems_child_; | 421 return file_systems_child_; |
397 file_systems_child_ = new CookieTreeFileSystemsNode; | 422 file_systems_child_ = new CookieTreeFileSystemsNode; |
398 AddChildSortedByTitle(file_systems_child_); | 423 AddChildSortedByTitle(file_systems_child_); |
399 return file_systems_child_; | 424 return file_systems_child_; |
400 } | 425 } |
401 | 426 |
| 427 CookieTreeQuotaNode* CookieTreeOriginNode::UpdateOrCreateQuotaNode( |
| 428 BrowsingDataQuotaHelper::QuotaInfo* quota_info) { |
| 429 if (quota_child_) |
| 430 return quota_child_; |
| 431 quota_child_ = new CookieTreeQuotaNode(quota_info); |
| 432 AddChildSortedByTitle(quota_child_); |
| 433 return quota_child_; |
| 434 } |
| 435 |
402 void CookieTreeOriginNode::CreateContentException( | 436 void CookieTreeOriginNode::CreateContentException( |
403 HostContentSettingsMap* content_settings, ContentSetting setting) const { | 437 HostContentSettingsMap* content_settings, ContentSetting setting) const { |
404 if (CanCreateContentException()) { | 438 if (CanCreateContentException()) { |
405 content_settings->AddExceptionForURL(url_, | 439 content_settings->AddExceptionForURL(url_, |
406 url_, | 440 url_, |
407 CONTENT_SETTINGS_TYPE_COOKIES, | 441 CONTENT_SETTINGS_TYPE_COOKIES, |
408 "", | 442 "", |
409 setting); | 443 setting); |
410 } | 444 } |
411 } | 445 } |
412 | 446 |
413 bool CookieTreeOriginNode::CanCreateContentException() const { | 447 bool CookieTreeOriginNode::CanCreateContentException() const { |
414 return !url_.SchemeIsFile(); | 448 return !url_.SchemeIsFile(); |
415 } | 449 } |
416 | 450 |
417 /////////////////////////////////////////////////////////////////////////////// | 451 /////////////////////////////////////////////////////////////////////////////// |
418 // CookieTreeCookiesNode, public: | 452 // CookieTreeCookiesNode, public: |
419 | 453 |
420 CookieTreeCookiesNode::CookieTreeCookiesNode() | 454 CookieTreeCookiesNode::CookieTreeCookiesNode() |
421 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIES)) { | 455 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIES)) { |
422 } | 456 } |
423 | 457 |
424 CookieTreeCookiesNode::~CookieTreeCookiesNode() { | 458 CookieTreeCookiesNode::~CookieTreeCookiesNode() { |
425 } | 459 } |
426 | 460 |
427 CookieTreeNode::DetailedInfo CookieTreeCookiesNode::GetDetailedInfo() const { | 461 CookieTreeNode::DetailedInfo CookieTreeCookiesNode::GetDetailedInfo() const { |
428 return DetailedInfo(parent()->GetTitle(), | 462 return DetailedInfo(parent()->GetTitle(), |
429 DetailedInfo::TYPE_COOKIES, | 463 DetailedInfo::TYPE_COOKIES, |
430 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 464 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
431 } | 465 } |
432 | 466 |
433 /////////////////////////////////////////////////////////////////////////////// | 467 /////////////////////////////////////////////////////////////////////////////// |
434 // CookieTreeAppCachesNode, public: | 468 // CookieTreeAppCachesNode, public: |
435 | 469 |
436 CookieTreeAppCachesNode::CookieTreeAppCachesNode() | 470 CookieTreeAppCachesNode::CookieTreeAppCachesNode() |
437 : CookieTreeNode(l10n_util::GetStringUTF16( | 471 : CookieTreeNode(l10n_util::GetStringUTF16( |
438 IDS_COOKIES_APPLICATION_CACHES)) { | 472 IDS_COOKIES_APPLICATION_CACHES)) { |
439 } | 473 } |
440 | 474 |
441 CookieTreeAppCachesNode::~CookieTreeAppCachesNode() {} | 475 CookieTreeAppCachesNode::~CookieTreeAppCachesNode() {} |
442 | 476 |
443 CookieTreeNode::DetailedInfo CookieTreeAppCachesNode::GetDetailedInfo() const { | 477 CookieTreeNode::DetailedInfo CookieTreeAppCachesNode::GetDetailedInfo() const { |
444 return DetailedInfo(parent()->GetTitle(), | 478 return DetailedInfo(parent()->GetTitle(), |
445 DetailedInfo::TYPE_APPCACHES, | 479 DetailedInfo::TYPE_APPCACHES, |
446 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 480 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
447 } | 481 } |
448 | 482 |
449 /////////////////////////////////////////////////////////////////////////////// | 483 /////////////////////////////////////////////////////////////////////////////// |
450 // CookieTreeDatabasesNode, public: | 484 // CookieTreeDatabasesNode, public: |
451 | 485 |
452 CookieTreeDatabasesNode::CookieTreeDatabasesNode() | 486 CookieTreeDatabasesNode::CookieTreeDatabasesNode() |
453 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASES)) { | 487 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASES)) { |
454 } | 488 } |
455 | 489 |
456 CookieTreeDatabasesNode::~CookieTreeDatabasesNode() {} | 490 CookieTreeDatabasesNode::~CookieTreeDatabasesNode() {} |
457 | 491 |
458 CookieTreeNode::DetailedInfo CookieTreeDatabasesNode::GetDetailedInfo() const { | 492 CookieTreeNode::DetailedInfo CookieTreeDatabasesNode::GetDetailedInfo() const { |
459 return DetailedInfo(parent()->GetTitle(), | 493 return DetailedInfo(parent()->GetTitle(), |
460 DetailedInfo::TYPE_DATABASES, | 494 DetailedInfo::TYPE_DATABASES, |
461 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 495 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
462 } | 496 } |
463 | 497 |
464 /////////////////////////////////////////////////////////////////////////////// | 498 /////////////////////////////////////////////////////////////////////////////// |
465 // CookieTreeLocalStoragesNode, public: | 499 // CookieTreeLocalStoragesNode, public: |
466 | 500 |
467 CookieTreeLocalStoragesNode::CookieTreeLocalStoragesNode() | 501 CookieTreeLocalStoragesNode::CookieTreeLocalStoragesNode() |
468 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE)) { | 502 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE)) { |
469 } | 503 } |
470 | 504 |
471 CookieTreeLocalStoragesNode::~CookieTreeLocalStoragesNode() {} | 505 CookieTreeLocalStoragesNode::~CookieTreeLocalStoragesNode() {} |
472 | 506 |
473 CookieTreeNode::DetailedInfo | 507 CookieTreeNode::DetailedInfo |
474 CookieTreeLocalStoragesNode::GetDetailedInfo() const { | 508 CookieTreeLocalStoragesNode::GetDetailedInfo() const { |
475 return DetailedInfo(parent()->GetTitle(), | 509 return DetailedInfo(parent()->GetTitle(), |
476 DetailedInfo::TYPE_LOCAL_STORAGES, | 510 DetailedInfo::TYPE_LOCAL_STORAGES, |
477 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 511 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
478 } | 512 } |
479 | 513 |
480 /////////////////////////////////////////////////////////////////////////////// | 514 /////////////////////////////////////////////////////////////////////////////// |
481 // CookieTreeSessionStoragesNode, public: | 515 // CookieTreeSessionStoragesNode, public: |
482 | 516 |
483 CookieTreeSessionStoragesNode::CookieTreeSessionStoragesNode() | 517 CookieTreeSessionStoragesNode::CookieTreeSessionStoragesNode() |
484 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_SESSION_STORAGE)) { | 518 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_SESSION_STORAGE)) { |
485 } | 519 } |
486 | 520 |
487 CookieTreeSessionStoragesNode::~CookieTreeSessionStoragesNode() {} | 521 CookieTreeSessionStoragesNode::~CookieTreeSessionStoragesNode() {} |
488 | 522 |
489 CookieTreeNode::DetailedInfo | 523 CookieTreeNode::DetailedInfo |
490 CookieTreeSessionStoragesNode::GetDetailedInfo() const { | 524 CookieTreeSessionStoragesNode::GetDetailedInfo() const { |
491 return DetailedInfo(parent()->GetTitle(), | 525 return DetailedInfo(parent()->GetTitle(), |
492 DetailedInfo::TYPE_SESSION_STORAGES, | 526 DetailedInfo::TYPE_SESSION_STORAGES, |
493 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 527 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
494 } | 528 } |
495 | 529 |
496 /////////////////////////////////////////////////////////////////////////////// | 530 /////////////////////////////////////////////////////////////////////////////// |
497 // CookieTreeIndexedDBsNode, public: | 531 // CookieTreeIndexedDBsNode, public: |
498 | 532 |
499 CookieTreeIndexedDBsNode::CookieTreeIndexedDBsNode() | 533 CookieTreeIndexedDBsNode::CookieTreeIndexedDBsNode() |
500 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_INDEXED_DBS)) { | 534 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_INDEXED_DBS)) { |
501 } | 535 } |
502 | 536 |
503 CookieTreeIndexedDBsNode::~CookieTreeIndexedDBsNode() {} | 537 CookieTreeIndexedDBsNode::~CookieTreeIndexedDBsNode() {} |
504 | 538 |
505 CookieTreeNode::DetailedInfo | 539 CookieTreeNode::DetailedInfo |
506 CookieTreeIndexedDBsNode::GetDetailedInfo() const { | 540 CookieTreeIndexedDBsNode::GetDetailedInfo() const { |
507 return DetailedInfo(parent()->GetTitle(), | 541 return DetailedInfo(parent()->GetTitle(), |
508 DetailedInfo::TYPE_INDEXED_DBS, | 542 DetailedInfo::TYPE_INDEXED_DBS, |
509 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 543 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
510 } | 544 } |
511 | 545 |
512 /////////////////////////////////////////////////////////////////////////////// | 546 /////////////////////////////////////////////////////////////////////////////// |
513 // CookieTreeFileSystemsNode, public: | 547 // CookieTreeFileSystemsNode, public: |
514 | 548 |
515 CookieTreeFileSystemsNode::CookieTreeFileSystemsNode() | 549 CookieTreeFileSystemsNode::CookieTreeFileSystemsNode() |
516 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_FILE_SYSTEMS)) { | 550 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_FILE_SYSTEMS)) { |
517 } | 551 } |
518 | 552 |
519 CookieTreeFileSystemsNode::~CookieTreeFileSystemsNode() {} | 553 CookieTreeFileSystemsNode::~CookieTreeFileSystemsNode() {} |
520 | 554 |
521 CookieTreeNode::DetailedInfo | 555 CookieTreeNode::DetailedInfo |
522 CookieTreeFileSystemsNode::GetDetailedInfo() const { | 556 CookieTreeFileSystemsNode::GetDetailedInfo() const { |
523 return DetailedInfo(parent()->GetTitle(), | 557 return DetailedInfo(parent()->GetTitle(), |
524 DetailedInfo::TYPE_FILE_SYSTEMS, | 558 DetailedInfo::TYPE_FILE_SYSTEMS, |
525 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 559 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
526 } | 560 } |
527 | 561 |
528 /////////////////////////////////////////////////////////////////////////////// | 562 /////////////////////////////////////////////////////////////////////////////// |
529 // CookieTreeNode, protected | 563 // CookieTreeNode, protected |
530 | 564 |
531 bool CookieTreeNode::NodeTitleComparator::operator() ( | 565 bool CookieTreeNode::NodeTitleComparator::operator() ( |
532 const CookieTreeNode* lhs, const CookieTreeNode* rhs) { | 566 const CookieTreeNode* lhs, const CookieTreeNode* rhs) { |
533 const CookieTreeNode* left = | 567 const CookieTreeNode* left = |
534 static_cast<const CookieTreeNode*>(lhs); | 568 static_cast<const CookieTreeNode*>(lhs); |
535 const CookieTreeNode* right = | 569 const CookieTreeNode* right = |
(...skipping 15 matching lines...) Expand all Loading... |
551 // CookiesTreeModel, public: | 585 // CookiesTreeModel, public: |
552 | 586 |
553 CookiesTreeModel::CookiesTreeModel( | 587 CookiesTreeModel::CookiesTreeModel( |
554 net::CookieMonster* cookie_monster, | 588 net::CookieMonster* cookie_monster, |
555 BrowsingDataDatabaseHelper* database_helper, | 589 BrowsingDataDatabaseHelper* database_helper, |
556 BrowsingDataLocalStorageHelper* local_storage_helper, | 590 BrowsingDataLocalStorageHelper* local_storage_helper, |
557 BrowsingDataLocalStorageHelper* session_storage_helper, | 591 BrowsingDataLocalStorageHelper* session_storage_helper, |
558 BrowsingDataAppCacheHelper* appcache_helper, | 592 BrowsingDataAppCacheHelper* appcache_helper, |
559 BrowsingDataIndexedDBHelper* indexed_db_helper, | 593 BrowsingDataIndexedDBHelper* indexed_db_helper, |
560 BrowsingDataFileSystemHelper* file_system_helper, | 594 BrowsingDataFileSystemHelper* file_system_helper, |
| 595 BrowsingDataQuotaHelper* quota_helper, |
561 bool use_cookie_source) | 596 bool use_cookie_source) |
562 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::TreeNodeModel<CookieTreeNode>( | 597 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::TreeNodeModel<CookieTreeNode>( |
563 new CookieTreeRootNode(this))), | 598 new CookieTreeRootNode(this))), |
564 cookie_monster_(cookie_monster), | 599 cookie_monster_(cookie_monster), |
565 appcache_helper_(appcache_helper), | 600 appcache_helper_(appcache_helper), |
566 database_helper_(database_helper), | 601 database_helper_(database_helper), |
567 local_storage_helper_(local_storage_helper), | 602 local_storage_helper_(local_storage_helper), |
568 session_storage_helper_(session_storage_helper), | 603 session_storage_helper_(session_storage_helper), |
569 indexed_db_helper_(indexed_db_helper), | 604 indexed_db_helper_(indexed_db_helper), |
570 file_system_helper_(file_system_helper), | 605 file_system_helper_(file_system_helper), |
| 606 quota_helper_(quota_helper), |
571 batch_update_(0), | 607 batch_update_(0), |
572 use_cookie_source_(use_cookie_source) { | 608 use_cookie_source_(use_cookie_source) { |
573 LoadCookies(); | 609 LoadCookies(); |
574 DCHECK(database_helper_); | 610 DCHECK(database_helper_); |
575 database_helper_->StartFetching(NewCallback( | 611 database_helper_->StartFetching(NewCallback( |
576 this, &CookiesTreeModel::OnDatabaseModelInfoLoaded)); | 612 this, &CookiesTreeModel::OnDatabaseModelInfoLoaded)); |
577 DCHECK(local_storage_helper_); | 613 DCHECK(local_storage_helper_); |
578 local_storage_helper_->StartFetching(NewCallback( | 614 local_storage_helper_->StartFetching(NewCallback( |
579 this, &CookiesTreeModel::OnLocalStorageModelInfoLoaded)); | 615 this, &CookiesTreeModel::OnLocalStorageModelInfoLoaded)); |
580 if (session_storage_helper_) { | 616 if (session_storage_helper_) { |
(...skipping 10 matching lines...) Expand all Loading... |
591 | 627 |
592 if (indexed_db_helper_) { | 628 if (indexed_db_helper_) { |
593 indexed_db_helper_->StartFetching(NewCallback( | 629 indexed_db_helper_->StartFetching(NewCallback( |
594 this, &CookiesTreeModel::OnIndexedDBModelInfoLoaded)); | 630 this, &CookiesTreeModel::OnIndexedDBModelInfoLoaded)); |
595 } | 631 } |
596 | 632 |
597 if (file_system_helper_) { | 633 if (file_system_helper_) { |
598 file_system_helper_->StartFetching(NewCallback( | 634 file_system_helper_->StartFetching(NewCallback( |
599 this, &CookiesTreeModel::OnFileSystemModelInfoLoaded)); | 635 this, &CookiesTreeModel::OnFileSystemModelInfoLoaded)); |
600 } | 636 } |
| 637 |
| 638 if (quota_helper_) { |
| 639 quota_helper_->StartFetching(NewCallback( |
| 640 this, &CookiesTreeModel::OnQuotaModelInfoLoaded)); |
| 641 } |
601 } | 642 } |
602 | 643 |
603 CookiesTreeModel::~CookiesTreeModel() { | 644 CookiesTreeModel::~CookiesTreeModel() { |
604 database_helper_->CancelNotification(); | 645 database_helper_->CancelNotification(); |
605 local_storage_helper_->CancelNotification(); | 646 local_storage_helper_->CancelNotification(); |
606 if (session_storage_helper_) | 647 if (session_storage_helper_) |
607 session_storage_helper_->CancelNotification(); | 648 session_storage_helper_->CancelNotification(); |
608 if (appcache_helper_) | 649 if (appcache_helper_) |
609 appcache_helper_->CancelNotification(); | 650 appcache_helper_->CancelNotification(); |
610 if (indexed_db_helper_) | 651 if (indexed_db_helper_) |
611 indexed_db_helper_->CancelNotification(); | 652 indexed_db_helper_->CancelNotification(); |
612 if (file_system_helper_) | 653 if (file_system_helper_) |
613 file_system_helper_->CancelNotification(); | 654 file_system_helper_->CancelNotification(); |
| 655 if (quota_helper_) |
| 656 quota_helper_->CancelNotification(); |
614 } | 657 } |
615 | 658 |
616 /////////////////////////////////////////////////////////////////////////////// | 659 /////////////////////////////////////////////////////////////////////////////// |
617 // CookiesTreeModel, TreeModel methods (public): | 660 // CookiesTreeModel, TreeModel methods (public): |
618 | 661 |
619 // TreeModel methods: | 662 // TreeModel methods: |
620 // Returns the set of icons for the nodes in the tree. You only need override | 663 // Returns the set of icons for the nodes in the tree. You only need override |
621 // this if you don't want to use the default folder icons. | 664 // this if you don't want to use the default folder icons. |
622 void CookiesTreeModel::GetIcons(std::vector<SkBitmap>* icons) { | 665 void CookiesTreeModel::GetIcons(std::vector<SkBitmap>* icons) { |
623 icons->push_back(*ResourceBundle::GetSharedInstance().GetBitmapNamed( | 666 icons->push_back(*ResourceBundle::GetSharedInstance().GetBitmapNamed( |
(...skipping 19 matching lines...) Expand all Loading... |
643 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: | 686 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: |
644 return DATABASE; // close enough | 687 return DATABASE; // close enough |
645 case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE: | 688 case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE: |
646 return DATABASE; // ditto | 689 return DATABASE; // ditto |
647 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: | 690 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: |
648 return DATABASE; // ditto | 691 return DATABASE; // ditto |
649 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: | 692 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: |
650 return DATABASE; // ditto | 693 return DATABASE; // ditto |
651 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 694 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
652 return DATABASE; // ditto | 695 return DATABASE; // ditto |
| 696 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
| 697 return -1; |
653 default: | 698 default: |
654 break; | 699 break; |
655 } | 700 } |
656 return -1; | 701 return -1; |
657 } | 702 } |
658 | 703 |
659 void CookiesTreeModel::LoadCookies() { | 704 void CookiesTreeModel::LoadCookies() { |
660 LoadCookiesWithFilter(std::wstring()); | 705 LoadCookiesWithFilter(std::wstring()); |
661 } | 706 } |
662 | 707 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 NotifyObserverBeginBatch(); | 764 NotifyObserverBeginBatch(); |
720 for (int i = num_children - 1; i >= 0; --i) | 765 for (int i = num_children - 1; i >= 0; --i) |
721 delete Remove(root, root->GetChild(i)); | 766 delete Remove(root, root->GetChild(i)); |
722 LoadCookiesWithFilter(filter); | 767 LoadCookiesWithFilter(filter); |
723 PopulateDatabaseInfoWithFilter(filter); | 768 PopulateDatabaseInfoWithFilter(filter); |
724 PopulateLocalStorageInfoWithFilter(filter); | 769 PopulateLocalStorageInfoWithFilter(filter); |
725 PopulateSessionStorageInfoWithFilter(filter); | 770 PopulateSessionStorageInfoWithFilter(filter); |
726 PopulateAppCacheInfoWithFilter(filter); | 771 PopulateAppCacheInfoWithFilter(filter); |
727 PopulateIndexedDBInfoWithFilter(filter); | 772 PopulateIndexedDBInfoWithFilter(filter); |
728 PopulateFileSystemInfoWithFilter(filter); | 773 PopulateFileSystemInfoWithFilter(filter); |
| 774 PopulateQuotaInfoWithFilter(filter); |
729 NotifyObserverTreeNodeChanged(root); | 775 NotifyObserverTreeNodeChanged(root); |
730 NotifyObserverEndBatch(); | 776 NotifyObserverEndBatch(); |
731 } | 777 } |
732 | 778 |
733 void CookiesTreeModel::AddCookiesTreeObserver(Observer* observer) { | 779 void CookiesTreeModel::AddCookiesTreeObserver(Observer* observer) { |
734 cookies_observer_list_.AddObserver(observer); | 780 cookies_observer_list_.AddObserver(observer); |
735 // Call super so that TreeNodeModel can notify, too. | 781 // Call super so that TreeNodeModel can notify, too. |
736 ui::TreeNodeModel<CookieTreeNode>::AddObserver(observer); | 782 ui::TreeNodeModel<CookieTreeNode>::AddObserver(observer); |
737 } | 783 } |
738 | 784 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 CookieTreeFileSystemsNode* file_systems_node = | 983 CookieTreeFileSystemsNode* file_systems_node = |
938 origin_node->GetOrCreateFileSystemsNode(); | 984 origin_node->GetOrCreateFileSystemsNode(); |
939 file_systems_node->AddFileSystemNode( | 985 file_systems_node->AddFileSystemNode( |
940 new CookieTreeFileSystemNode(&(*file_system_info))); | 986 new CookieTreeFileSystemNode(&(*file_system_info))); |
941 } | 987 } |
942 } | 988 } |
943 NotifyObserverTreeNodeChanged(root); | 989 NotifyObserverTreeNodeChanged(root); |
944 NotifyObserverEndBatch(); | 990 NotifyObserverEndBatch(); |
945 } | 991 } |
946 | 992 |
| 993 void CookiesTreeModel::OnQuotaModelInfoLoaded( |
| 994 const QuotaInfoArray& quota_info) { |
| 995 quota_info_list_ = quota_info; |
| 996 PopulateQuotaInfoWithFilter(std::wstring()); |
| 997 } |
| 998 |
| 999 void CookiesTreeModel::PopulateQuotaInfoWithFilter( |
| 1000 const std::wstring& filter) { |
| 1001 if (quota_info_list_.empty()) |
| 1002 return; |
| 1003 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1004 NotifyObserverBeginBatch(); |
| 1005 for (QuotaInfoArray::iterator quota_info = quota_info_list_.begin(); |
| 1006 quota_info != quota_info_list_.end(); |
| 1007 ++quota_info) { |
| 1008 if (!filter.size() || |
| 1009 (UTF8ToWide(quota_info->host).find(filter) != std::wstring::npos)) { |
| 1010 CookieTreeOriginNode* origin_node = |
| 1011 root->GetOrCreateOriginNode(GURL("http://" + quota_info->host)); |
| 1012 origin_node->UpdateOrCreateQuotaNode(&*quota_info); |
| 1013 } |
| 1014 } |
| 1015 NotifyObserverTreeNodeChanged(root); |
| 1016 NotifyObserverEndBatch(); |
| 1017 } |
| 1018 |
947 void CookiesTreeModel::NotifyObserverBeginBatch() { | 1019 void CookiesTreeModel::NotifyObserverBeginBatch() { |
948 // Only notify the model once if we're batching in a nested manner. | 1020 // Only notify the model once if we're batching in a nested manner. |
949 if (batch_update_++ == 0) { | 1021 if (batch_update_++ == 0) { |
950 FOR_EACH_OBSERVER(Observer, | 1022 FOR_EACH_OBSERVER(Observer, |
951 cookies_observer_list_, | 1023 cookies_observer_list_, |
952 TreeModelBeginBatch(this)); | 1024 TreeModelBeginBatch(this)); |
953 } | 1025 } |
954 } | 1026 } |
955 | 1027 |
956 void CookiesTreeModel::NotifyObserverEndBatch() { | 1028 void CookiesTreeModel::NotifyObserverEndBatch() { |
957 // Only notify the observers if this is the outermost call to EndBatch() if | 1029 // Only notify the observers if this is the outermost call to EndBatch() if |
958 // called in a nested manner. | 1030 // called in a nested manner. |
959 if (--batch_update_ == 0) { | 1031 if (--batch_update_ == 0) { |
960 FOR_EACH_OBSERVER(Observer, | 1032 FOR_EACH_OBSERVER(Observer, |
961 cookies_observer_list_, | 1033 cookies_observer_list_, |
962 TreeModelEndBatch(this)); | 1034 TreeModelEndBatch(this)); |
963 } | 1035 } |
964 } | 1036 } |
OLD | NEW |