| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/net/cookies/cookie_store_ios.h" | 5 #include "ios/net/cookies/cookie_store_ios.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 CookieStoreIOS::CookieStoreIOS( | 286 CookieStoreIOS::CookieStoreIOS( |
| 287 net::CookieMonster::PersistentCookieStore* persistent_store) | 287 net::CookieMonster::PersistentCookieStore* persistent_store) |
| 288 : CookieStoreIOS(persistent_store, | 288 : CookieStoreIOS(persistent_store, |
| 289 [NSHTTPCookieStorage sharedHTTPCookieStorage]) { | 289 [NSHTTPCookieStorage sharedHTTPCookieStorage]) { |
| 290 } | 290 } |
| 291 | 291 |
| 292 CookieStoreIOS::CookieStoreIOS( | 292 CookieStoreIOS::CookieStoreIOS( |
| 293 net::CookieMonster::PersistentCookieStore* persistent_store, | 293 net::CookieMonster::PersistentCookieStore* persistent_store, |
| 294 NSHTTPCookieStorage* system_store) | 294 NSHTTPCookieStorage* system_store) |
| 295 : system_store_(system_store), | 295 : cookie_monster_(new net::CookieMonster(persistent_store, nullptr)), |
| 296 system_store_(system_store), |
| 296 creation_time_manager_(new CookieCreationTimeManager), | 297 creation_time_manager_(new CookieCreationTimeManager), |
| 297 metrics_enabled_(false), | 298 metrics_enabled_(false), |
| 298 flush_delay_(base::TimeDelta::FromSeconds(10)), | 299 flush_delay_(base::TimeDelta::FromSeconds(10)), |
| 299 synchronization_state_(NOT_SYNCHRONIZED), | 300 synchronization_state_(NOT_SYNCHRONIZED), |
| 300 cookie_cache_(new CookieCache()) { | 301 cookie_cache_(new CookieCache()), |
| 302 weak_factory_(this) { |
| 301 DCHECK(system_store); | 303 DCHECK(system_store); |
| 302 | 304 |
| 303 NotificationTrampoline::GetInstance()->AddObserver(this); | 305 NotificationTrampoline::GetInstance()->AddObserver(this); |
| 304 cookie_monster_ = new net::CookieMonster(persistent_store, nullptr); | 306 |
| 305 cookie_monster_->SetPersistSessionCookies(true); | 307 cookie_monster_->SetPersistSessionCookies(true); |
| 306 cookie_monster_->SetForceKeepSessionState(); | 308 cookie_monster_->SetForceKeepSessionState(); |
| 307 } | 309 } |
| 308 | 310 |
| 311 CookieStoreIOS::~CookieStoreIOS() { |
| 312 NotificationTrampoline::GetInstance()->RemoveObserver(this); |
| 313 STLDeleteContainerPairSecondPointers(hook_map_.begin(), hook_map_.end()); |
| 314 } |
| 315 |
| 309 // static | 316 // static |
| 310 void CookieStoreIOS::SetCookiePolicy(CookiePolicy setting) { | 317 void CookieStoreIOS::SetCookiePolicy(CookiePolicy setting) { |
| 311 NSHTTPCookieAcceptPolicy policy = (setting == ALLOW) | 318 NSHTTPCookieAcceptPolicy policy = (setting == ALLOW) |
| 312 ? NSHTTPCookieAcceptPolicyAlways | 319 ? NSHTTPCookieAcceptPolicyAlways |
| 313 : NSHTTPCookieAcceptPolicyNever; | 320 : NSHTTPCookieAcceptPolicyNever; |
| 314 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | 321 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
| 315 NSHTTPCookieAcceptPolicy current_policy = [store cookieAcceptPolicy]; | 322 NSHTTPCookieAcceptPolicy current_policy = [store cookieAcceptPolicy]; |
| 316 if (current_policy == policy) | 323 if (current_policy == policy) |
| 317 return; | 324 return; |
| 318 [store setCookieAcceptPolicy:policy]; | 325 [store setCookieAcceptPolicy:policy]; |
| 319 NotificationTrampoline::GetInstance()->NotifyCookiePolicyChanged(); | 326 NotificationTrampoline::GetInstance()->NotifyCookiePolicyChanged(); |
| 320 } | 327 } |
| 321 | 328 |
| 322 // static | 329 // static |
| 323 CookieStoreIOS* CookieStoreIOS::CreateCookieStore( | 330 scoped_ptr<CookieStoreIOS> CookieStoreIOS::CreateCookieStore( |
| 324 NSHTTPCookieStorage* cookie_storage) { | 331 NSHTTPCookieStorage* cookie_storage) { |
| 325 DCHECK(cookie_storage); | 332 DCHECK(cookie_storage); |
| 326 // TODO(huey): Update this when CrNet supports multiple cookie jars. | 333 // TODO(huey): Update this when CrNet supports multiple cookie jars. |
| 327 [cookie_storage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; | 334 [cookie_storage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
| 328 | 335 |
| 329 // Create a cookie store with no persistent store backing. Then, populate | 336 // Create a cookie store with no persistent store backing. Then, populate |
| 330 // it from the system's cookie jar. | 337 // it from the system's cookie jar. |
| 331 CookieStoreIOS* cookie_store = new CookieStoreIOS(nullptr, cookie_storage); | 338 scoped_ptr<CookieStoreIOS> cookie_store( |
| 339 new CookieStoreIOS(nullptr, cookie_storage)); |
| 332 cookie_store->synchronization_state_ = SYNCHRONIZED; | 340 cookie_store->synchronization_state_ = SYNCHRONIZED; |
| 333 cookie_store->FlushStore(base::Closure()); | 341 cookie_store->FlushStore(base::Closure()); |
| 334 return cookie_store; | 342 return cookie_store; |
| 335 } | 343 } |
| 336 | 344 |
| 337 // static | 345 // static |
| 338 void CookieStoreIOS::SwitchSynchronizedStore(CookieStoreIOS* old_store, | 346 void CookieStoreIOS::SwitchSynchronizedStore(CookieStoreIOS* old_store, |
| 339 CookieStoreIOS* new_store) { | 347 CookieStoreIOS* new_store) { |
| 340 DCHECK(new_store); | 348 DCHECK(new_store); |
| 341 DCHECK_NE(new_store, old_store); | 349 DCHECK_NE(new_store, old_store); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 371 const SetCookiesCallback& callback) { | 379 const SetCookiesCallback& callback) { |
| 372 DCHECK(thread_checker_.CalledOnValidThread()); | 380 DCHECK(thread_checker_.CalledOnValidThread()); |
| 373 | 381 |
| 374 switch (synchronization_state_) { | 382 switch (synchronization_state_) { |
| 375 case NOT_SYNCHRONIZED: | 383 case NOT_SYNCHRONIZED: |
| 376 cookie_monster_->SetCookieWithOptionsAsync(url, cookie_line, options, | 384 cookie_monster_->SetCookieWithOptionsAsync(url, cookie_line, options, |
| 377 WrapSetCallback(callback)); | 385 WrapSetCallback(callback)); |
| 378 break; | 386 break; |
| 379 case SYNCHRONIZING: | 387 case SYNCHRONIZING: |
| 380 tasks_pending_synchronization_.push_back( | 388 tasks_pending_synchronization_.push_back( |
| 381 base::Bind(&CookieStoreIOS::SetCookieWithOptionsAsync, this, url, | 389 base::Bind(&CookieStoreIOS::SetCookieWithOptionsAsync, |
| 382 cookie_line, options, WrapSetCallback(callback))); | 390 weak_factory_.GetWeakPtr(), url, cookie_line, options, |
| 391 WrapSetCallback(callback))); |
| 383 break; | 392 break; |
| 384 case SYNCHRONIZED: | 393 case SYNCHRONIZED: |
| 385 // The exclude_httponly() option would only be used by a javascript | 394 // The exclude_httponly() option would only be used by a javascript |
| 386 // engine. | 395 // engine. |
| 387 DCHECK(!options.exclude_httponly()); | 396 DCHECK(!options.exclude_httponly()); |
| 388 // If cookies are not allowed, they are stashed in the CookieMonster, and | 397 // If cookies are not allowed, they are stashed in the CookieMonster, and |
| 389 // should be written there instead. | 398 // should be written there instead. |
| 390 DCHECK(SystemCookiesAllowed()); | 399 DCHECK(SystemCookiesAllowed()); |
| 391 | 400 |
| 392 base::Time server_time = | 401 base::Time server_time = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 DCHECK(thread_checker_.CalledOnValidThread()); | 456 DCHECK(thread_checker_.CalledOnValidThread()); |
| 448 | 457 |
| 449 switch (synchronization_state_) { | 458 switch (synchronization_state_) { |
| 450 case NOT_SYNCHRONIZED: | 459 case NOT_SYNCHRONIZED: |
| 451 cookie_monster_->SetCookieWithDetailsAsync( | 460 cookie_monster_->SetCookieWithDetailsAsync( |
| 452 url, name, value, domain, path, creation_time, expiration_time, | 461 url, name, value, domain, path, creation_time, expiration_time, |
| 453 last_access_time, secure, http_only, same_site, enforce_strict_secure, | 462 last_access_time, secure, http_only, same_site, enforce_strict_secure, |
| 454 priority, WrapSetCallback(callback)); | 463 priority, WrapSetCallback(callback)); |
| 455 break; | 464 break; |
| 456 case SYNCHRONIZING: | 465 case SYNCHRONIZING: |
| 457 tasks_pending_synchronization_.push_back(base::Bind( | 466 tasks_pending_synchronization_.push_back( |
| 458 &CookieStoreIOS::SetCookieWithDetailsAsync, this, url, name, value, | 467 base::Bind(&CookieStoreIOS::SetCookieWithDetailsAsync, |
| 459 domain, path, creation_time, expiration_time, last_access_time, | 468 weak_factory_.GetWeakPtr(), url, name, value, domain, path, |
| 460 secure, http_only, same_site, enforce_strict_secure, priority, | 469 creation_time, expiration_time, last_access_time, secure, |
| 461 WrapSetCallback(callback))); | 470 http_only, same_site, enforce_strict_secure, priority, |
| 471 WrapSetCallback(callback))); |
| 462 break; | 472 break; |
| 463 case SYNCHRONIZED: | 473 case SYNCHRONIZED: |
| 464 // If cookies are not allowed, they are stashed in the CookieMonster, and | 474 // If cookies are not allowed, they are stashed in the CookieMonster, and |
| 465 // should be written there instead. | 475 // should be written there instead. |
| 466 DCHECK(SystemCookiesAllowed()); | 476 DCHECK(SystemCookiesAllowed()); |
| 467 | 477 |
| 468 bool success = false; | 478 bool success = false; |
| 469 | 479 |
| 470 if (creation_time.is_null()) | 480 if (creation_time.is_null()) |
| 471 creation_time = base::Time::Now(); | 481 creation_time = base::Time::Now(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 502 const net::CookieOptions& options, | 512 const net::CookieOptions& options, |
| 503 const GetCookiesCallback& callback) { | 513 const GetCookiesCallback& callback) { |
| 504 DCHECK(thread_checker_.CalledOnValidThread()); | 514 DCHECK(thread_checker_.CalledOnValidThread()); |
| 505 | 515 |
| 506 switch (synchronization_state_) { | 516 switch (synchronization_state_) { |
| 507 case NOT_SYNCHRONIZED: | 517 case NOT_SYNCHRONIZED: |
| 508 cookie_monster_->GetCookiesWithOptionsAsync(url, options, callback); | 518 cookie_monster_->GetCookiesWithOptionsAsync(url, options, callback); |
| 509 break; | 519 break; |
| 510 case SYNCHRONIZING: | 520 case SYNCHRONIZING: |
| 511 tasks_pending_synchronization_.push_back( | 521 tasks_pending_synchronization_.push_back( |
| 512 base::Bind(&CookieStoreIOS::GetCookiesWithOptionsAsync, this, url, | 522 base::Bind(&CookieStoreIOS::GetCookiesWithOptionsAsync, |
| 513 options, callback)); | 523 weak_factory_.GetWeakPtr(), url, options, callback)); |
| 514 break; | 524 break; |
| 515 case SYNCHRONIZED: | 525 case SYNCHRONIZED: |
| 516 // If cookies are not allowed, they are stashed in the CookieMonster, and | 526 // If cookies are not allowed, they are stashed in the CookieMonster, and |
| 517 // should be read from there instead. | 527 // should be read from there instead. |
| 518 DCHECK(SystemCookiesAllowed()); | 528 DCHECK(SystemCookiesAllowed()); |
| 519 // The exclude_httponly() option would only be used by a javascript | 529 // The exclude_httponly() option would only be used by a javascript |
| 520 // engine. | 530 // engine. |
| 521 DCHECK(!options.exclude_httponly()); | 531 DCHECK(!options.exclude_httponly()); |
| 522 | 532 |
| 523 // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass | 533 // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass |
| (...skipping 11 matching lines...) Expand all Loading... |
| 535 const net::CookieOptions& options, | 545 const net::CookieOptions& options, |
| 536 const GetCookieListCallback& callback) { | 546 const GetCookieListCallback& callback) { |
| 537 DCHECK(thread_checker_.CalledOnValidThread()); | 547 DCHECK(thread_checker_.CalledOnValidThread()); |
| 538 | 548 |
| 539 switch (synchronization_state_) { | 549 switch (synchronization_state_) { |
| 540 case NOT_SYNCHRONIZED: | 550 case NOT_SYNCHRONIZED: |
| 541 cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback); | 551 cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback); |
| 542 break; | 552 break; |
| 543 case SYNCHRONIZING: | 553 case SYNCHRONIZING: |
| 544 tasks_pending_synchronization_.push_back( | 554 tasks_pending_synchronization_.push_back( |
| 545 base::Bind(&CookieStoreIOS::GetCookieListWithOptionsAsync, this, url, | 555 base::Bind(&CookieStoreIOS::GetCookieListWithOptionsAsync, |
| 546 options, callback)); | 556 weak_factory_.GetWeakPtr(), url, options, callback)); |
| 547 break; | 557 break; |
| 548 case SYNCHRONIZED: | 558 case SYNCHRONIZED: |
| 549 if (!SystemCookiesAllowed()) { | 559 if (!SystemCookiesAllowed()) { |
| 550 // If cookies are not allowed, the cookies are stashed in the | 560 // If cookies are not allowed, the cookies are stashed in the |
| 551 // CookieMonster, so get them from there. | 561 // CookieMonster, so get them from there. |
| 552 cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback); | 562 cookie_monster_->GetCookieListWithOptionsAsync(url, options, callback); |
| 553 return; | 563 return; |
| 554 } | 564 } |
| 555 | 565 |
| 556 // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass | 566 // TODO(mkwst): If/when iOS supports Same-Site cookies, we'll need to pass |
| 557 // options in here as well. https://crbug.com/459154 | 567 // options in here as well. https://crbug.com/459154 |
| 558 NSArray* cookies = GetCookiesForURL(system_store_, | 568 NSArray* cookies = GetCookiesForURL(system_store_, |
| 559 url, creation_time_manager_.get()); | 569 url, creation_time_manager_.get()); |
| 560 net::CookieList cookie_list = CanonicalCookieListFromSystemCookies( | 570 net::CookieList cookie_list = CanonicalCookieListFromSystemCookies( |
| 561 cookies); | 571 cookies); |
| 562 if (!callback.is_null()) | 572 if (!callback.is_null()) |
| 563 callback.Run(cookie_list); | 573 callback.Run(cookie_list); |
| 564 break; | 574 break; |
| 565 } | 575 } |
| 566 } | 576 } |
| 567 | 577 |
| 568 void CookieStoreIOS::GetAllCookiesAsync(const GetCookieListCallback& callback) { | 578 void CookieStoreIOS::GetAllCookiesAsync(const GetCookieListCallback& callback) { |
| 569 DCHECK(thread_checker_.CalledOnValidThread()); | 579 DCHECK(thread_checker_.CalledOnValidThread()); |
| 570 | 580 |
| 571 switch (synchronization_state_) { | 581 switch (synchronization_state_) { |
| 572 case NOT_SYNCHRONIZED: | 582 case NOT_SYNCHRONIZED: |
| 573 cookie_monster_->GetAllCookiesAsync(callback); | 583 cookie_monster_->GetAllCookiesAsync(callback); |
| 574 break; | 584 break; |
| 575 case SYNCHRONIZING: | 585 case SYNCHRONIZING: |
| 576 tasks_pending_synchronization_.push_back(base::Bind( | 586 tasks_pending_synchronization_.push_back( |
| 577 &CookieStoreIOS::GetAllCookiesAsync, this, callback)); | 587 base::Bind(&CookieStoreIOS::GetAllCookiesAsync, |
| 588 weak_factory_.GetWeakPtr(), callback)); |
| 578 break; | 589 break; |
| 579 case SYNCHRONIZED: | 590 case SYNCHRONIZED: |
| 580 if (!SystemCookiesAllowed()) { | 591 if (!SystemCookiesAllowed()) { |
| 581 // If cookies are not allowed, the cookies are stashed in the | 592 // If cookies are not allowed, the cookies are stashed in the |
| 582 // CookieMonster, so get them from there. | 593 // CookieMonster, so get them from there. |
| 583 cookie_monster_->GetAllCookiesAsync(callback); | 594 cookie_monster_->GetAllCookiesAsync(callback); |
| 584 return; | 595 return; |
| 585 } | 596 } |
| 586 | 597 |
| 587 NSArray* cookies = GetAllCookies(system_store_, | 598 NSArray* cookies = GetAllCookies(system_store_, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 599 const std::string& cookie_name, | 610 const std::string& cookie_name, |
| 600 const base::Closure& callback) { | 611 const base::Closure& callback) { |
| 601 DCHECK(thread_checker_.CalledOnValidThread()); | 612 DCHECK(thread_checker_.CalledOnValidThread()); |
| 602 | 613 |
| 603 switch (synchronization_state_) { | 614 switch (synchronization_state_) { |
| 604 case NOT_SYNCHRONIZED: | 615 case NOT_SYNCHRONIZED: |
| 605 cookie_monster_->DeleteCookieAsync(url, cookie_name, | 616 cookie_monster_->DeleteCookieAsync(url, cookie_name, |
| 606 WrapClosure(callback)); | 617 WrapClosure(callback)); |
| 607 break; | 618 break; |
| 608 case SYNCHRONIZING: | 619 case SYNCHRONIZING: |
| 609 tasks_pending_synchronization_.push_back( | 620 tasks_pending_synchronization_.push_back(base::Bind( |
| 610 base::Bind(&CookieStoreIOS::DeleteCookieAsync, this, url, cookie_name, | 621 &CookieStoreIOS::DeleteCookieAsync, weak_factory_.GetWeakPtr(), url, |
| 611 WrapClosure(callback))); | 622 cookie_name, WrapClosure(callback))); |
| 612 break; | 623 break; |
| 613 case SYNCHRONIZED: | 624 case SYNCHRONIZED: |
| 614 NSArray* cookies = GetCookiesForURL(system_store_, | 625 NSArray* cookies = GetCookiesForURL(system_store_, |
| 615 url, creation_time_manager_.get()); | 626 url, creation_time_manager_.get()); |
| 616 for (NSHTTPCookie* cookie in cookies) { | 627 for (NSHTTPCookie* cookie in cookies) { |
| 617 if ([[cookie name] | 628 if ([[cookie name] |
| 618 isEqualToString:base::SysUTF8ToNSString(cookie_name)]) { | 629 isEqualToString:base::SysUTF8ToNSString(cookie_name)]) { |
| 619 [system_store_ deleteCookie:cookie]; | 630 [system_store_ deleteCookie:cookie]; |
| 620 creation_time_manager_->DeleteCreationTime(cookie); | 631 creation_time_manager_->DeleteCreationTime(cookie); |
| 621 } | 632 } |
| 622 } | 633 } |
| 623 if (!callback.is_null()) | 634 if (!callback.is_null()) |
| 624 callback.Run(); | 635 callback.Run(); |
| 625 break; | 636 break; |
| 626 } | 637 } |
| 627 } | 638 } |
| 628 | 639 |
| 629 void CookieStoreIOS::DeleteCanonicalCookieAsync( | 640 void CookieStoreIOS::DeleteCanonicalCookieAsync( |
| 630 const CanonicalCookie& cookie, | 641 const CanonicalCookie& cookie, |
| 631 const DeleteCallback& callback) { | 642 const DeleteCallback& callback) { |
| 632 DCHECK(thread_checker_.CalledOnValidThread()); | 643 DCHECK(thread_checker_.CalledOnValidThread()); |
| 633 | 644 |
| 634 switch (synchronization_state_) { | 645 switch (synchronization_state_) { |
| 635 case NOT_SYNCHRONIZED: | 646 case NOT_SYNCHRONIZED: |
| 636 cookie_monster_->DeleteCanonicalCookieAsync(cookie, | 647 cookie_monster_->DeleteCanonicalCookieAsync(cookie, |
| 637 WrapDeleteCallback(callback)); | 648 WrapDeleteCallback(callback)); |
| 638 break; | 649 break; |
| 639 case SYNCHRONIZING: | 650 case SYNCHRONIZING: |
| 640 tasks_pending_synchronization_.push_back( | 651 tasks_pending_synchronization_.push_back(base::Bind( |
| 641 base::Bind(&CookieStoreIOS::DeleteCanonicalCookieAsync, this, cookie, | 652 &CookieStoreIOS::DeleteCanonicalCookieAsync, |
| 642 WrapDeleteCallback(callback))); | 653 weak_factory_.GetWeakPtr(), cookie, WrapDeleteCallback(callback))); |
| 643 break; | 654 break; |
| 644 case SYNCHRONIZED: | 655 case SYNCHRONIZED: |
| 645 // This relies on the fact cookies are given unique creation dates. | 656 // This relies on the fact cookies are given unique creation dates. |
| 646 CookieFilterFunction filter = base::Bind( | 657 CookieFilterFunction filter = base::Bind( |
| 647 IsCookieCreatedBetween, cookie.CreationDate(), cookie.CreationDate()); | 658 IsCookieCreatedBetween, cookie.CreationDate(), cookie.CreationDate()); |
| 648 DeleteCookiesWithFilter(filter, callback); | 659 DeleteCookiesWithFilter(filter, callback); |
| 649 } | 660 } |
| 650 } | 661 } |
| 651 | 662 |
| 652 void CookieStoreIOS::DeleteAllCreatedBetweenAsync( | 663 void CookieStoreIOS::DeleteAllCreatedBetweenAsync( |
| 653 const base::Time& delete_begin, | 664 const base::Time& delete_begin, |
| 654 const base::Time& delete_end, | 665 const base::Time& delete_end, |
| 655 const DeleteCallback& callback) { | 666 const DeleteCallback& callback) { |
| 656 DCHECK(thread_checker_.CalledOnValidThread()); | 667 DCHECK(thread_checker_.CalledOnValidThread()); |
| 657 | 668 |
| 658 if (metrics_enabled_) | 669 if (metrics_enabled_) |
| 659 ResetCookieCountMetrics(); | 670 ResetCookieCountMetrics(); |
| 660 | 671 |
| 661 switch (synchronization_state_) { | 672 switch (synchronization_state_) { |
| 662 case NOT_SYNCHRONIZED: | 673 case NOT_SYNCHRONIZED: |
| 663 cookie_monster_->DeleteAllCreatedBetweenAsync( | 674 cookie_monster_->DeleteAllCreatedBetweenAsync( |
| 664 delete_begin, delete_end, WrapDeleteCallback(callback)); | 675 delete_begin, delete_end, WrapDeleteCallback(callback)); |
| 665 break; | 676 break; |
| 666 case SYNCHRONIZING: | 677 case SYNCHRONIZING: |
| 667 tasks_pending_synchronization_.push_back( | 678 tasks_pending_synchronization_.push_back( |
| 668 base::Bind(&CookieStoreIOS::DeleteAllCreatedBetweenAsync, this, | 679 base::Bind(&CookieStoreIOS::DeleteAllCreatedBetweenAsync, |
| 669 delete_begin, delete_end, WrapDeleteCallback(callback))); | 680 weak_factory_.GetWeakPtr(), delete_begin, delete_end, |
| 681 WrapDeleteCallback(callback))); |
| 670 break; | 682 break; |
| 671 case SYNCHRONIZED: | 683 case SYNCHRONIZED: |
| 672 CookieFilterFunction filter = | 684 CookieFilterFunction filter = |
| 673 base::Bind(&IsCookieCreatedBetween, delete_begin, delete_end); | 685 base::Bind(&IsCookieCreatedBetween, delete_begin, delete_end); |
| 674 DeleteCookiesWithFilter(filter, callback); | 686 DeleteCookiesWithFilter(filter, callback); |
| 675 break; | 687 break; |
| 676 } | 688 } |
| 677 } | 689 } |
| 678 | 690 |
| 679 void CookieStoreIOS::DeleteAllCreatedBetweenForHostAsync( | 691 void CookieStoreIOS::DeleteAllCreatedBetweenForHostAsync( |
| 680 const base::Time delete_begin, | 692 const base::Time delete_begin, |
| 681 const base::Time delete_end, | 693 const base::Time delete_end, |
| 682 const GURL& url, | 694 const GURL& url, |
| 683 const DeleteCallback& callback) { | 695 const DeleteCallback& callback) { |
| 684 DCHECK(thread_checker_.CalledOnValidThread()); | 696 DCHECK(thread_checker_.CalledOnValidThread()); |
| 685 | 697 |
| 686 if (metrics_enabled_) | 698 if (metrics_enabled_) |
| 687 ResetCookieCountMetrics(); | 699 ResetCookieCountMetrics(); |
| 688 | 700 |
| 689 switch (synchronization_state_) { | 701 switch (synchronization_state_) { |
| 690 case NOT_SYNCHRONIZED: | 702 case NOT_SYNCHRONIZED: |
| 691 cookie_monster_->DeleteAllCreatedBetweenForHostAsync( | 703 cookie_monster_->DeleteAllCreatedBetweenForHostAsync( |
| 692 delete_begin, delete_end, url, WrapDeleteCallback(callback)); | 704 delete_begin, delete_end, url, WrapDeleteCallback(callback)); |
| 693 break; | 705 break; |
| 694 case SYNCHRONIZING: | 706 case SYNCHRONIZING: |
| 695 tasks_pending_synchronization_.push_back(base::Bind( | 707 tasks_pending_synchronization_.push_back( |
| 696 &CookieStoreIOS::DeleteAllCreatedBetweenForHostAsync, this, | 708 base::Bind(&CookieStoreIOS::DeleteAllCreatedBetweenForHostAsync, |
| 697 delete_begin, delete_end, url, WrapDeleteCallback(callback))); | 709 weak_factory_.GetWeakPtr(), delete_begin, delete_end, url, |
| 710 WrapDeleteCallback(callback))); |
| 698 break; | 711 break; |
| 699 case SYNCHRONIZED: | 712 case SYNCHRONIZED: |
| 700 NSString* host = base::SysUTF8ToNSString(url.host()); | 713 NSString* host = base::SysUTF8ToNSString(url.host()); |
| 701 CookieFilterFunction filter = base::Bind(IsCookieCreatedBetweenForHost, | 714 CookieFilterFunction filter = base::Bind(IsCookieCreatedBetweenForHost, |
| 702 delete_begin, delete_end, host); | 715 delete_begin, delete_end, host); |
| 703 DeleteCookiesWithFilter(filter, callback); | 716 DeleteCookiesWithFilter(filter, callback); |
| 704 break; | 717 break; |
| 705 } | 718 } |
| 706 } | 719 } |
| 707 | 720 |
| 708 void CookieStoreIOS::DeleteSessionCookiesAsync(const DeleteCallback& callback) { | 721 void CookieStoreIOS::DeleteSessionCookiesAsync(const DeleteCallback& callback) { |
| 709 DCHECK(thread_checker_.CalledOnValidThread()); | 722 DCHECK(thread_checker_.CalledOnValidThread()); |
| 710 | 723 |
| 711 if (metrics_enabled_) | 724 if (metrics_enabled_) |
| 712 ResetCookieCountMetrics(); | 725 ResetCookieCountMetrics(); |
| 713 | 726 |
| 714 switch (synchronization_state_) { | 727 switch (synchronization_state_) { |
| 715 case NOT_SYNCHRONIZED: | 728 case NOT_SYNCHRONIZED: |
| 716 cookie_monster_->DeleteSessionCookiesAsync(WrapDeleteCallback(callback)); | 729 cookie_monster_->DeleteSessionCookiesAsync(WrapDeleteCallback(callback)); |
| 717 break; | 730 break; |
| 718 case SYNCHRONIZING: | 731 case SYNCHRONIZING: |
| 719 tasks_pending_synchronization_.push_back( | 732 tasks_pending_synchronization_.push_back( |
| 720 base::Bind(&CookieStoreIOS::DeleteSessionCookiesAsync, this, | 733 base::Bind(&CookieStoreIOS::DeleteSessionCookiesAsync, |
| 721 WrapDeleteCallback(callback))); | 734 weak_factory_.GetWeakPtr(), WrapDeleteCallback(callback))); |
| 722 break; | 735 break; |
| 723 case SYNCHRONIZED: | 736 case SYNCHRONIZED: |
| 724 CookieFilterFunction filter = base::Bind(&IsCookieSessionCookie); | 737 CookieFilterFunction filter = base::Bind(&IsCookieSessionCookie); |
| 725 DeleteCookiesWithFilter(filter, callback); | 738 DeleteCookiesWithFilter(filter, callback); |
| 726 break; | 739 break; |
| 727 } | 740 } |
| 728 } | 741 } |
| 729 | 742 |
| 730 void CookieStoreIOS::FlushStore(const base::Closure& closure) { | 743 void CookieStoreIOS::FlushStore(const base::Closure& closure) { |
| 731 DCHECK(thread_checker_.CalledOnValidThread()); | 744 DCHECK(thread_checker_.CalledOnValidThread()); |
| 732 | 745 |
| 733 if (SystemCookiesAllowed()) { | 746 if (SystemCookiesAllowed()) { |
| 734 // If cookies are disabled, the system store is empty, and the cookies are | 747 // If cookies are disabled, the system store is empty, and the cookies are |
| 735 // stashed on disk. Do not delete the cookies on the disk in this case. | 748 // stashed on disk. Do not delete the cookies on the disk in this case. |
| 736 WriteToCookieMonster([system_store_ cookies]); | 749 WriteToCookieMonster([system_store_ cookies]); |
| 737 } | 750 } |
| 738 cookie_monster_->FlushStore(closure); | 751 cookie_monster_->FlushStore(closure); |
| 739 flush_closure_.Cancel(); | 752 flush_closure_.Cancel(); |
| 740 } | 753 } |
| 741 | 754 |
| 742 #pragma mark - | 755 #pragma mark - |
| 743 #pragma mark Protected methods | |
| 744 | |
| 745 CookieStoreIOS::~CookieStoreIOS() { | |
| 746 NotificationTrampoline::GetInstance()->RemoveObserver(this); | |
| 747 STLDeleteContainerPairSecondPointers(hook_map_.begin(), hook_map_.end()); | |
| 748 } | |
| 749 | |
| 750 #pragma mark - | |
| 751 #pragma mark Private methods | 756 #pragma mark Private methods |
| 752 | 757 |
| 753 void CookieStoreIOS::ClearSystemStore() { | 758 void CookieStoreIOS::ClearSystemStore() { |
| 754 DCHECK(thread_checker_.CalledOnValidThread()); | 759 DCHECK(thread_checker_.CalledOnValidThread()); |
| 755 base::scoped_nsobject<NSArray> copy( | 760 base::scoped_nsobject<NSArray> copy( |
| 756 [[NSArray alloc] initWithArray:[system_store_ cookies]]); | 761 [[NSArray alloc] initWithArray:[system_store_ cookies]]); |
| 757 for (NSHTTPCookie* cookie in copy.get()) | 762 for (NSHTTPCookie* cookie in copy.get()) |
| 758 [system_store_ deleteCookie:cookie]; | 763 [system_store_ deleteCookie:cookie]; |
| 759 DCHECK_EQ(0u, [[system_store_ cookies] count]); | 764 DCHECK_EQ(0u, [[system_store_ cookies] count]); |
| 760 creation_time_manager_->Clear(); | 765 creation_time_manager_->Clear(); |
| 761 } | 766 } |
| 762 | 767 |
| 763 void CookieStoreIOS::OnSystemCookiePolicyChanged() { | 768 void CookieStoreIOS::OnSystemCookiePolicyChanged() { |
| 764 DCHECK(thread_checker_.CalledOnValidThread()); | 769 DCHECK(thread_checker_.CalledOnValidThread()); |
| 765 | 770 |
| 766 // If the CookieStoreIOS is not synchronized or is not backed by | 771 // If the CookieStoreIOS is not synchronized or is not backed by |
| 767 // |NSHTTPCookieStorage sharedHTTPCookieStorage| this callback is irrelevant. | 772 // |NSHTTPCookieStorage sharedHTTPCookieStorage| this callback is irrelevant. |
| 768 if (synchronization_state_ == NOT_SYNCHRONIZED || | 773 if (synchronization_state_ == NOT_SYNCHRONIZED || |
| 769 system_store_ != [NSHTTPCookieStorage sharedHTTPCookieStorage]) { | 774 system_store_ != [NSHTTPCookieStorage sharedHTTPCookieStorage]) { |
| 770 return; | 775 return; |
| 771 } | 776 } |
| 772 | 777 |
| 773 NSHTTPCookieAcceptPolicy policy = | 778 NSHTTPCookieAcceptPolicy policy = |
| 774 [system_store_ cookieAcceptPolicy]; | 779 [system_store_ cookieAcceptPolicy]; |
| 775 if (policy == NSHTTPCookieAcceptPolicyAlways) { | 780 if (policy == NSHTTPCookieAcceptPolicyAlways) { |
| 776 // If cookies are disabled, the system cookie store should be empty. | 781 // If cookies are disabled, the system cookie store should be empty. |
| 777 DCHECK(![[system_store_ cookies] count]); | 782 DCHECK(![[system_store_ cookies] count]); |
| 778 DCHECK(synchronization_state_ != SYNCHRONIZING); | 783 DCHECK(synchronization_state_ != SYNCHRONIZING); |
| 779 synchronization_state_ = SYNCHRONIZING; | 784 synchronization_state_ = SYNCHRONIZING; |
| 780 cookie_monster_->GetAllCookiesAsync( | 785 cookie_monster_->GetAllCookiesAsync(base::Bind( |
| 781 base::Bind(&CookieStoreIOS::AddCookiesToSystemStore, this)); | 786 &CookieStoreIOS::AddCookiesToSystemStore, weak_factory_.GetWeakPtr())); |
| 782 } else { | 787 } else { |
| 783 DCHECK_EQ(NSHTTPCookieAcceptPolicyNever, policy); | 788 DCHECK_EQ(NSHTTPCookieAcceptPolicyNever, policy); |
| 784 // FlushStore() does not write the cookies to disk when they are disabled. | 789 // FlushStore() does not write the cookies to disk when they are disabled. |
| 785 // Explicitly copy them. | 790 // Explicitly copy them. |
| 786 WriteToCookieMonster([system_store_ cookies]); | 791 WriteToCookieMonster([system_store_ cookies]); |
| 787 FlushStore(base::Closure()); | 792 FlushStore(base::Closure()); |
| 788 ClearSystemStore(); | 793 ClearSystemStore(); |
| 789 if (synchronization_state_ == SYNCHRONIZING) { | 794 if (synchronization_state_ == SYNCHRONIZING) { |
| 790 // If synchronization was in progress, abort it and leave the cookie store | 795 // If synchronization was in progress, abort it and leave the cookie store |
| 791 // empty. | 796 // empty. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 DCHECK(policy == NSHTTPCookieAcceptPolicyAlways || | 830 DCHECK(policy == NSHTTPCookieAcceptPolicyAlways || |
| 826 ![[system_store_ cookies] count]); | 831 ![[system_store_ cookies] count]); |
| 827 | 832 |
| 828 // If cookies are disabled, nothing is done now, the work will be done when | 833 // If cookies are disabled, nothing is done now, the work will be done when |
| 829 // cookies are re-enabled. | 834 // cookies are re-enabled. |
| 830 if (policy == NSHTTPCookieAcceptPolicyAlways) { | 835 if (policy == NSHTTPCookieAcceptPolicyAlways) { |
| 831 if (synchronized) { | 836 if (synchronized) { |
| 832 synchronization_state_ = SYNCHRONIZING; | 837 synchronization_state_ = SYNCHRONIZING; |
| 833 ClearSystemStore(); | 838 ClearSystemStore(); |
| 834 cookie_monster_->GetAllCookiesAsync( | 839 cookie_monster_->GetAllCookiesAsync( |
| 835 base::Bind(&CookieStoreIOS::AddCookiesToSystemStore, this)); | 840 base::Bind(&CookieStoreIOS::AddCookiesToSystemStore, |
| 841 weak_factory_.GetWeakPtr())); |
| 836 return; | 842 return; |
| 837 } else { | 843 } else { |
| 838 // Copy the cookies from the global store to |cookie_monster_|. | 844 // Copy the cookies from the global store to |cookie_monster_|. |
| 839 FlushStore(base::Closure()); | 845 FlushStore(base::Closure()); |
| 840 } | 846 } |
| 841 } | 847 } |
| 842 synchronization_state_ = synchronized ? SYNCHRONIZED : NOT_SYNCHRONIZED; | 848 synchronization_state_ = synchronized ? SYNCHRONIZED : NOT_SYNCHRONIZED; |
| 843 | 849 |
| 844 if (synchronization_state_ == NOT_SYNCHRONIZED) { | 850 if (synchronization_state_ == NOT_SYNCHRONIZED) { |
| 845 // If there are pending tasks, then it means that the synchronization is | 851 // If there are pending tasks, then it means that the synchronization is |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 RunCallbacksForCookies(key.first, key.second, removed_cookies, true); | 969 RunCallbacksForCookies(key.first, key.second, removed_cookies, true); |
| 964 RunCallbacksForCookies(key.first, key.second, added_cookies, false); | 970 RunCallbacksForCookies(key.first, key.second, added_cookies, false); |
| 965 } | 971 } |
| 966 } | 972 } |
| 967 | 973 |
| 968 // Do not schedule a flush if one is already scheduled. | 974 // Do not schedule a flush if one is already scheduled. |
| 969 if (!flush_closure_.IsCancelled()) | 975 if (!flush_closure_.IsCancelled()) |
| 970 return; | 976 return; |
| 971 | 977 |
| 972 flush_closure_.Reset(base::Bind(&CookieStoreIOS::FlushStore, | 978 flush_closure_.Reset(base::Bind(&CookieStoreIOS::FlushStore, |
| 973 base::Unretained(this), base::Closure())); | 979 weak_factory_.GetWeakPtr(), base::Closure())); |
| 974 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 980 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 975 FROM_HERE, flush_closure_.callback(), flush_delay_); | 981 FROM_HERE, flush_closure_.callback(), flush_delay_); |
| 976 } | 982 } |
| 977 | 983 |
| 978 scoped_ptr<net::CookieStore::CookieChangedSubscription> | 984 scoped_ptr<net::CookieStore::CookieChangedSubscription> |
| 979 CookieStoreIOS::AddCallbackForCookie(const GURL& gurl, | 985 CookieStoreIOS::AddCallbackForCookie(const GURL& gurl, |
| 980 const std::string& name, | 986 const std::string& name, |
| 981 const CookieChangedCallback& callback) { | 987 const CookieChangedCallback& callback) { |
| 982 DCHECK(thread_checker_.CalledOnValidThread()); | 988 DCHECK(thread_checker_.CalledOnValidThread()); |
| 983 | 989 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 | 1064 |
| 1059 void CookieStoreIOS::DidClearNSHTTPCookieStorageCookies( | 1065 void CookieStoreIOS::DidClearNSHTTPCookieStorageCookies( |
| 1060 const DeleteCallback& delete_callback, | 1066 const DeleteCallback& delete_callback, |
| 1061 int num_deleted) { | 1067 int num_deleted) { |
| 1062 DCHECK(thread_checker_.CalledOnValidThread()); | 1068 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1063 | 1069 |
| 1064 CookieStoreIOSClient* client = net::GetCookieStoreIOSClient(); | 1070 CookieStoreIOSClient* client = net::GetCookieStoreIOSClient(); |
| 1065 DCHECK(client); | 1071 DCHECK(client); |
| 1066 auto sequenced_task_runner = client->GetTaskRunner(); | 1072 auto sequenced_task_runner = client->GetTaskRunner(); |
| 1067 DCHECK(sequenced_task_runner); | 1073 DCHECK(sequenced_task_runner); |
| 1068 auto callback = base::Bind(&CookieStoreIOS::DidClearBinaryCookiesFileCookies, | 1074 auto callback = |
| 1069 this, delete_callback, num_deleted); | 1075 base::Bind(&CookieStoreIOS::DidClearBinaryCookiesFileCookies, |
| 1076 weak_factory_.GetWeakPtr(), delete_callback, num_deleted); |
| 1070 sequenced_task_runner.get()->PostTaskAndReply( | 1077 sequenced_task_runner.get()->PostTaskAndReply( |
| 1071 FROM_HERE, base::Bind(&ClearAllCookiesFromBinaryCookiesFile), callback); | 1078 FROM_HERE, base::Bind(&ClearAllCookiesFromBinaryCookiesFile), callback); |
| 1072 } | 1079 } |
| 1073 | 1080 |
| 1074 void CookieStoreIOS::DidClearBinaryCookiesFileCookies( | 1081 void CookieStoreIOS::DidClearBinaryCookiesFileCookies( |
| 1075 const DeleteCallback& callback, | 1082 const DeleteCallback& callback, |
| 1076 int num_deleted_from_nshttp_cookie_storage) { | 1083 int num_deleted_from_nshttp_cookie_storage) { |
| 1077 DCHECK(thread_checker_.CalledOnValidThread()); | 1084 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1078 | 1085 |
| 1079 CookieStoreIOSClient* client = net::GetCookieStoreIOSClient(); | 1086 CookieStoreIOSClient* client = net::GetCookieStoreIOSClient(); |
| 1080 DCHECK(client); | 1087 DCHECK(client); |
| 1081 client->DidChangeCookieStorage(); | 1088 client->DidChangeCookieStorage(); |
| 1082 if (!callback.is_null()) | 1089 if (!callback.is_null()) |
| 1083 callback.Run(num_deleted_from_nshttp_cookie_storage); | 1090 callback.Run(num_deleted_from_nshttp_cookie_storage); |
| 1084 } | 1091 } |
| 1085 | 1092 |
| 1086 void CookieStoreIOS::UpdateCachesFromCookieMonster() { | 1093 void CookieStoreIOS::UpdateCachesFromCookieMonster() { |
| 1087 DCHECK(thread_checker_.CalledOnValidThread()); | 1094 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1088 for (const auto& hook_map_entry : hook_map_) { | 1095 for (const auto& hook_map_entry : hook_map_) { |
| 1089 std::pair<GURL, std::string> key = hook_map_entry.first; | 1096 std::pair<GURL, std::string> key = hook_map_entry.first; |
| 1090 GetCookieListCallback callback = | 1097 GetCookieListCallback callback = base::Bind( |
| 1091 base::Bind(&CookieStoreIOS::GotCookieListFor, this, key); | 1098 &CookieStoreIOS::GotCookieListFor, weak_factory_.GetWeakPtr(), key); |
| 1092 cookie_monster_->GetAllCookiesForURLAsync(key.first, callback); | 1099 cookie_monster_->GetAllCookiesForURLAsync(key.first, callback); |
| 1093 } | 1100 } |
| 1094 } | 1101 } |
| 1095 | 1102 |
| 1096 void CookieStoreIOS::UpdateCachesAfterSet(const SetCookiesCallback& callback, | 1103 void CookieStoreIOS::UpdateCachesAfterSet(const SetCookiesCallback& callback, |
| 1097 bool success) { | 1104 bool success) { |
| 1098 DCHECK(thread_checker_.CalledOnValidThread()); | 1105 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1099 if (success) | 1106 if (success) |
| 1100 UpdateCachesFromCookieMonster(); | 1107 UpdateCachesFromCookieMonster(); |
| 1101 if (!callback.is_null()) | 1108 if (!callback.is_null()) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1124 for (NSHTTPCookie* cookie in cookies) { | 1131 for (NSHTTPCookie* cookie in cookies) { |
| 1125 base::Time created = creation_time_manager_->GetCreationTime(cookie); | 1132 base::Time created = creation_time_manager_->GetCreationTime(cookie); |
| 1126 cookie_list.push_back(CanonicalCookieFromSystemCookie(cookie, created)); | 1133 cookie_list.push_back(CanonicalCookieFromSystemCookie(cookie, created)); |
| 1127 } | 1134 } |
| 1128 return cookie_list; | 1135 return cookie_list; |
| 1129 } | 1136 } |
| 1130 | 1137 |
| 1131 CookieStoreIOS::SetCookiesCallback CookieStoreIOS::WrapSetCallback( | 1138 CookieStoreIOS::SetCookiesCallback CookieStoreIOS::WrapSetCallback( |
| 1132 const SetCookiesCallback& callback) { | 1139 const SetCookiesCallback& callback) { |
| 1133 DCHECK(thread_checker_.CalledOnValidThread()); | 1140 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1134 return base::Bind(&CookieStoreIOS::UpdateCachesAfterSet, this, callback); | 1141 return base::Bind(&CookieStoreIOS::UpdateCachesAfterSet, |
| 1142 weak_factory_.GetWeakPtr(), callback); |
| 1135 } | 1143 } |
| 1136 | 1144 |
| 1137 CookieStoreIOS::DeleteCallback CookieStoreIOS::WrapDeleteCallback( | 1145 CookieStoreIOS::DeleteCallback CookieStoreIOS::WrapDeleteCallback( |
| 1138 const DeleteCallback& callback) { | 1146 const DeleteCallback& callback) { |
| 1139 DCHECK(thread_checker_.CalledOnValidThread()); | 1147 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1140 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, this, callback); | 1148 return base::Bind(&CookieStoreIOS::UpdateCachesAfterDelete, |
| 1149 weak_factory_.GetWeakPtr(), callback); |
| 1141 } | 1150 } |
| 1142 | 1151 |
| 1143 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { | 1152 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { |
| 1144 DCHECK(thread_checker_.CalledOnValidThread()); | 1153 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1145 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, this, callback); | 1154 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, |
| 1155 weak_factory_.GetWeakPtr(), callback); |
| 1146 } | 1156 } |
| 1147 | 1157 |
| 1148 } // namespace net | 1158 } // namespace net |
| OLD | NEW |