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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
9 * | 9 * |
10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 domain_(domain), | 421 domain_(domain), |
422 path_(path), | 422 path_(path), |
423 expiration_time_(expiration_time), | 423 expiration_time_(expiration_time), |
424 secure_(secure), | 424 secure_(secure), |
425 http_only_(http_only), | 425 http_only_(http_only), |
426 priority_(priority), | 426 priority_(priority), |
427 callback_(callback) { | 427 callback_(callback) { |
428 } | 428 } |
429 | 429 |
430 // CookieMonsterTask: | 430 // CookieMonsterTask: |
431 virtual void Run() OVERRIDE; | 431 virtual void Run() override; |
432 | 432 |
433 protected: | 433 protected: |
434 virtual ~SetCookieWithDetailsTask() {} | 434 virtual ~SetCookieWithDetailsTask() {} |
435 | 435 |
436 private: | 436 private: |
437 GURL url_; | 437 GURL url_; |
438 std::string name_; | 438 std::string name_; |
439 std::string value_; | 439 std::string value_; |
440 std::string domain_; | 440 std::string domain_; |
441 std::string path_; | 441 std::string path_; |
(...skipping 19 matching lines...) Expand all Loading... |
461 // Task class for GetAllCookies call. | 461 // Task class for GetAllCookies call. |
462 class CookieMonster::GetAllCookiesTask : public CookieMonsterTask { | 462 class CookieMonster::GetAllCookiesTask : public CookieMonsterTask { |
463 public: | 463 public: |
464 GetAllCookiesTask(CookieMonster* cookie_monster, | 464 GetAllCookiesTask(CookieMonster* cookie_monster, |
465 const GetCookieListCallback& callback) | 465 const GetCookieListCallback& callback) |
466 : CookieMonsterTask(cookie_monster), | 466 : CookieMonsterTask(cookie_monster), |
467 callback_(callback) { | 467 callback_(callback) { |
468 } | 468 } |
469 | 469 |
470 // CookieMonsterTask | 470 // CookieMonsterTask |
471 virtual void Run() OVERRIDE; | 471 virtual void Run() override; |
472 | 472 |
473 protected: | 473 protected: |
474 virtual ~GetAllCookiesTask() {} | 474 virtual ~GetAllCookiesTask() {} |
475 | 475 |
476 private: | 476 private: |
477 GetCookieListCallback callback_; | 477 GetCookieListCallback callback_; |
478 | 478 |
479 DISALLOW_COPY_AND_ASSIGN(GetAllCookiesTask); | 479 DISALLOW_COPY_AND_ASSIGN(GetAllCookiesTask); |
480 }; | 480 }; |
481 | 481 |
(...skipping 14 matching lines...) Expand all Loading... |
496 const GURL& url, | 496 const GURL& url, |
497 const CookieOptions& options, | 497 const CookieOptions& options, |
498 const GetCookieListCallback& callback) | 498 const GetCookieListCallback& callback) |
499 : CookieMonsterTask(cookie_monster), | 499 : CookieMonsterTask(cookie_monster), |
500 url_(url), | 500 url_(url), |
501 options_(options), | 501 options_(options), |
502 callback_(callback) { | 502 callback_(callback) { |
503 } | 503 } |
504 | 504 |
505 // CookieMonsterTask: | 505 // CookieMonsterTask: |
506 virtual void Run() OVERRIDE; | 506 virtual void Run() override; |
507 | 507 |
508 protected: | 508 protected: |
509 virtual ~GetAllCookiesForURLWithOptionsTask() {} | 509 virtual ~GetAllCookiesForURLWithOptionsTask() {} |
510 | 510 |
511 private: | 511 private: |
512 GURL url_; | 512 GURL url_; |
513 CookieOptions options_; | 513 CookieOptions options_; |
514 GetCookieListCallback callback_; | 514 GetCookieListCallback callback_; |
515 | 515 |
516 DISALLOW_COPY_AND_ASSIGN(GetAllCookiesForURLWithOptionsTask); | 516 DISALLOW_COPY_AND_ASSIGN(GetAllCookiesForURLWithOptionsTask); |
(...skipping 20 matching lines...) Expand all Loading... |
537 template <typename Result> | 537 template <typename Result> |
538 class CookieMonster::DeleteTask : public CookieMonsterTask { | 538 class CookieMonster::DeleteTask : public CookieMonsterTask { |
539 public: | 539 public: |
540 DeleteTask(CookieMonster* cookie_monster, | 540 DeleteTask(CookieMonster* cookie_monster, |
541 const typename CallbackType<Result>::Type& callback) | 541 const typename CallbackType<Result>::Type& callback) |
542 : CookieMonsterTask(cookie_monster), | 542 : CookieMonsterTask(cookie_monster), |
543 callback_(callback) { | 543 callback_(callback) { |
544 } | 544 } |
545 | 545 |
546 // CookieMonsterTask: | 546 // CookieMonsterTask: |
547 virtual void Run() OVERRIDE; | 547 virtual void Run() override; |
548 | 548 |
549 private: | 549 private: |
550 // Runs the delete task and returns a result. | 550 // Runs the delete task and returns a result. |
551 virtual Result RunDeleteTask() = 0; | 551 virtual Result RunDeleteTask() = 0; |
552 base::Closure RunDeleteTaskAndBindCallback(); | 552 base::Closure RunDeleteTaskAndBindCallback(); |
553 void FlushDone(const base::Closure& callback); | 553 void FlushDone(const base::Closure& callback); |
554 | 554 |
555 typename CallbackType<Result>::Type callback_; | 555 typename CallbackType<Result>::Type callback_; |
556 | 556 |
557 DISALLOW_COPY_AND_ASSIGN(DeleteTask); | 557 DISALLOW_COPY_AND_ASSIGN(DeleteTask); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 // Task class for DeleteAll call. | 590 // Task class for DeleteAll call. |
591 class CookieMonster::DeleteAllTask : public DeleteTask<int> { | 591 class CookieMonster::DeleteAllTask : public DeleteTask<int> { |
592 public: | 592 public: |
593 DeleteAllTask(CookieMonster* cookie_monster, | 593 DeleteAllTask(CookieMonster* cookie_monster, |
594 const DeleteCallback& callback) | 594 const DeleteCallback& callback) |
595 : DeleteTask<int>(cookie_monster, callback) { | 595 : DeleteTask<int>(cookie_monster, callback) { |
596 } | 596 } |
597 | 597 |
598 // DeleteTask: | 598 // DeleteTask: |
599 virtual int RunDeleteTask() OVERRIDE; | 599 virtual int RunDeleteTask() override; |
600 | 600 |
601 protected: | 601 protected: |
602 virtual ~DeleteAllTask() {} | 602 virtual ~DeleteAllTask() {} |
603 | 603 |
604 private: | 604 private: |
605 DISALLOW_COPY_AND_ASSIGN(DeleteAllTask); | 605 DISALLOW_COPY_AND_ASSIGN(DeleteAllTask); |
606 }; | 606 }; |
607 | 607 |
608 int CookieMonster::DeleteAllTask::RunDeleteTask() { | 608 int CookieMonster::DeleteAllTask::RunDeleteTask() { |
609 return this->cookie_monster()->DeleteAll(true); | 609 return this->cookie_monster()->DeleteAll(true); |
610 } | 610 } |
611 | 611 |
612 // Task class for DeleteAllCreatedBetween call. | 612 // Task class for DeleteAllCreatedBetween call. |
613 class CookieMonster::DeleteAllCreatedBetweenTask : public DeleteTask<int> { | 613 class CookieMonster::DeleteAllCreatedBetweenTask : public DeleteTask<int> { |
614 public: | 614 public: |
615 DeleteAllCreatedBetweenTask(CookieMonster* cookie_monster, | 615 DeleteAllCreatedBetweenTask(CookieMonster* cookie_monster, |
616 const Time& delete_begin, | 616 const Time& delete_begin, |
617 const Time& delete_end, | 617 const Time& delete_end, |
618 const DeleteCallback& callback) | 618 const DeleteCallback& callback) |
619 : DeleteTask<int>(cookie_monster, callback), | 619 : DeleteTask<int>(cookie_monster, callback), |
620 delete_begin_(delete_begin), | 620 delete_begin_(delete_begin), |
621 delete_end_(delete_end) { | 621 delete_end_(delete_end) { |
622 } | 622 } |
623 | 623 |
624 // DeleteTask: | 624 // DeleteTask: |
625 virtual int RunDeleteTask() OVERRIDE; | 625 virtual int RunDeleteTask() override; |
626 | 626 |
627 protected: | 627 protected: |
628 virtual ~DeleteAllCreatedBetweenTask() {} | 628 virtual ~DeleteAllCreatedBetweenTask() {} |
629 | 629 |
630 private: | 630 private: |
631 Time delete_begin_; | 631 Time delete_begin_; |
632 Time delete_end_; | 632 Time delete_end_; |
633 | 633 |
634 DISALLOW_COPY_AND_ASSIGN(DeleteAllCreatedBetweenTask); | 634 DISALLOW_COPY_AND_ASSIGN(DeleteAllCreatedBetweenTask); |
635 }; | 635 }; |
636 | 636 |
637 int CookieMonster::DeleteAllCreatedBetweenTask::RunDeleteTask() { | 637 int CookieMonster::DeleteAllCreatedBetweenTask::RunDeleteTask() { |
638 return this->cookie_monster()-> | 638 return this->cookie_monster()-> |
639 DeleteAllCreatedBetween(delete_begin_, delete_end_); | 639 DeleteAllCreatedBetween(delete_begin_, delete_end_); |
640 } | 640 } |
641 | 641 |
642 // Task class for DeleteAllForHost call. | 642 // Task class for DeleteAllForHost call. |
643 class CookieMonster::DeleteAllForHostTask : public DeleteTask<int> { | 643 class CookieMonster::DeleteAllForHostTask : public DeleteTask<int> { |
644 public: | 644 public: |
645 DeleteAllForHostTask(CookieMonster* cookie_monster, | 645 DeleteAllForHostTask(CookieMonster* cookie_monster, |
646 const GURL& url, | 646 const GURL& url, |
647 const DeleteCallback& callback) | 647 const DeleteCallback& callback) |
648 : DeleteTask<int>(cookie_monster, callback), | 648 : DeleteTask<int>(cookie_monster, callback), |
649 url_(url) { | 649 url_(url) { |
650 } | 650 } |
651 | 651 |
652 // DeleteTask: | 652 // DeleteTask: |
653 virtual int RunDeleteTask() OVERRIDE; | 653 virtual int RunDeleteTask() override; |
654 | 654 |
655 protected: | 655 protected: |
656 virtual ~DeleteAllForHostTask() {} | 656 virtual ~DeleteAllForHostTask() {} |
657 | 657 |
658 private: | 658 private: |
659 GURL url_; | 659 GURL url_; |
660 | 660 |
661 DISALLOW_COPY_AND_ASSIGN(DeleteAllForHostTask); | 661 DISALLOW_COPY_AND_ASSIGN(DeleteAllForHostTask); |
662 }; | 662 }; |
663 | 663 |
(...skipping 11 matching lines...) Expand all Loading... |
675 Time delete_end, | 675 Time delete_end, |
676 const GURL& url, | 676 const GURL& url, |
677 const DeleteCallback& callback) | 677 const DeleteCallback& callback) |
678 : DeleteTask<int>(cookie_monster, callback), | 678 : DeleteTask<int>(cookie_monster, callback), |
679 delete_begin_(delete_begin), | 679 delete_begin_(delete_begin), |
680 delete_end_(delete_end), | 680 delete_end_(delete_end), |
681 url_(url) { | 681 url_(url) { |
682 } | 682 } |
683 | 683 |
684 // DeleteTask: | 684 // DeleteTask: |
685 virtual int RunDeleteTask() OVERRIDE; | 685 virtual int RunDeleteTask() override; |
686 | 686 |
687 protected: | 687 protected: |
688 virtual ~DeleteAllCreatedBetweenForHostTask() {} | 688 virtual ~DeleteAllCreatedBetweenForHostTask() {} |
689 | 689 |
690 private: | 690 private: |
691 Time delete_begin_; | 691 Time delete_begin_; |
692 Time delete_end_; | 692 Time delete_end_; |
693 GURL url_; | 693 GURL url_; |
694 | 694 |
695 DISALLOW_COPY_AND_ASSIGN(DeleteAllCreatedBetweenForHostTask); | 695 DISALLOW_COPY_AND_ASSIGN(DeleteAllCreatedBetweenForHostTask); |
696 }; | 696 }; |
697 | 697 |
698 int CookieMonster::DeleteAllCreatedBetweenForHostTask::RunDeleteTask() { | 698 int CookieMonster::DeleteAllCreatedBetweenForHostTask::RunDeleteTask() { |
699 return this->cookie_monster()->DeleteAllCreatedBetweenForHost( | 699 return this->cookie_monster()->DeleteAllCreatedBetweenForHost( |
700 delete_begin_, delete_end_, url_); | 700 delete_begin_, delete_end_, url_); |
701 } | 701 } |
702 | 702 |
703 // Task class for DeleteCanonicalCookie call. | 703 // Task class for DeleteCanonicalCookie call. |
704 class CookieMonster::DeleteCanonicalCookieTask : public DeleteTask<bool> { | 704 class CookieMonster::DeleteCanonicalCookieTask : public DeleteTask<bool> { |
705 public: | 705 public: |
706 DeleteCanonicalCookieTask(CookieMonster* cookie_monster, | 706 DeleteCanonicalCookieTask(CookieMonster* cookie_monster, |
707 const CanonicalCookie& cookie, | 707 const CanonicalCookie& cookie, |
708 const DeleteCookieCallback& callback) | 708 const DeleteCookieCallback& callback) |
709 : DeleteTask<bool>(cookie_monster, callback), | 709 : DeleteTask<bool>(cookie_monster, callback), |
710 cookie_(cookie) { | 710 cookie_(cookie) { |
711 } | 711 } |
712 | 712 |
713 // DeleteTask: | 713 // DeleteTask: |
714 virtual bool RunDeleteTask() OVERRIDE; | 714 virtual bool RunDeleteTask() override; |
715 | 715 |
716 protected: | 716 protected: |
717 virtual ~DeleteCanonicalCookieTask() {} | 717 virtual ~DeleteCanonicalCookieTask() {} |
718 | 718 |
719 private: | 719 private: |
720 CanonicalCookie cookie_; | 720 CanonicalCookie cookie_; |
721 | 721 |
722 DISALLOW_COPY_AND_ASSIGN(DeleteCanonicalCookieTask); | 722 DISALLOW_COPY_AND_ASSIGN(DeleteCanonicalCookieTask); |
723 }; | 723 }; |
724 | 724 |
(...skipping 10 matching lines...) Expand all Loading... |
735 const CookieOptions& options, | 735 const CookieOptions& options, |
736 const SetCookiesCallback& callback) | 736 const SetCookiesCallback& callback) |
737 : CookieMonsterTask(cookie_monster), | 737 : CookieMonsterTask(cookie_monster), |
738 url_(url), | 738 url_(url), |
739 cookie_line_(cookie_line), | 739 cookie_line_(cookie_line), |
740 options_(options), | 740 options_(options), |
741 callback_(callback) { | 741 callback_(callback) { |
742 } | 742 } |
743 | 743 |
744 // CookieMonsterTask: | 744 // CookieMonsterTask: |
745 virtual void Run() OVERRIDE; | 745 virtual void Run() override; |
746 | 746 |
747 protected: | 747 protected: |
748 virtual ~SetCookieWithOptionsTask() {} | 748 virtual ~SetCookieWithOptionsTask() {} |
749 | 749 |
750 private: | 750 private: |
751 GURL url_; | 751 GURL url_; |
752 std::string cookie_line_; | 752 std::string cookie_line_; |
753 CookieOptions options_; | 753 CookieOptions options_; |
754 SetCookiesCallback callback_; | 754 SetCookiesCallback callback_; |
755 | 755 |
(...skipping 16 matching lines...) Expand all Loading... |
772 const GURL& url, | 772 const GURL& url, |
773 const CookieOptions& options, | 773 const CookieOptions& options, |
774 const GetCookiesCallback& callback) | 774 const GetCookiesCallback& callback) |
775 : CookieMonsterTask(cookie_monster), | 775 : CookieMonsterTask(cookie_monster), |
776 url_(url), | 776 url_(url), |
777 options_(options), | 777 options_(options), |
778 callback_(callback) { | 778 callback_(callback) { |
779 } | 779 } |
780 | 780 |
781 // CookieMonsterTask: | 781 // CookieMonsterTask: |
782 virtual void Run() OVERRIDE; | 782 virtual void Run() override; |
783 | 783 |
784 protected: | 784 protected: |
785 virtual ~GetCookiesWithOptionsTask() {} | 785 virtual ~GetCookiesWithOptionsTask() {} |
786 | 786 |
787 private: | 787 private: |
788 GURL url_; | 788 GURL url_; |
789 CookieOptions options_; | 789 CookieOptions options_; |
790 GetCookiesCallback callback_; | 790 GetCookiesCallback callback_; |
791 | 791 |
792 DISALLOW_COPY_AND_ASSIGN(GetCookiesWithOptionsTask); | 792 DISALLOW_COPY_AND_ASSIGN(GetCookiesWithOptionsTask); |
(...skipping 14 matching lines...) Expand all Loading... |
807 DeleteCookieTask(CookieMonster* cookie_monster, | 807 DeleteCookieTask(CookieMonster* cookie_monster, |
808 const GURL& url, | 808 const GURL& url, |
809 const std::string& cookie_name, | 809 const std::string& cookie_name, |
810 const base::Closure& callback) | 810 const base::Closure& callback) |
811 : DeleteTask<void>(cookie_monster, callback), | 811 : DeleteTask<void>(cookie_monster, callback), |
812 url_(url), | 812 url_(url), |
813 cookie_name_(cookie_name) { | 813 cookie_name_(cookie_name) { |
814 } | 814 } |
815 | 815 |
816 // DeleteTask: | 816 // DeleteTask: |
817 virtual void RunDeleteTask() OVERRIDE; | 817 virtual void RunDeleteTask() override; |
818 | 818 |
819 protected: | 819 protected: |
820 virtual ~DeleteCookieTask() {} | 820 virtual ~DeleteCookieTask() {} |
821 | 821 |
822 private: | 822 private: |
823 GURL url_; | 823 GURL url_; |
824 std::string cookie_name_; | 824 std::string cookie_name_; |
825 | 825 |
826 DISALLOW_COPY_AND_ASSIGN(DeleteCookieTask); | 826 DISALLOW_COPY_AND_ASSIGN(DeleteCookieTask); |
827 }; | 827 }; |
828 | 828 |
829 void CookieMonster::DeleteCookieTask::RunDeleteTask() { | 829 void CookieMonster::DeleteCookieTask::RunDeleteTask() { |
830 this->cookie_monster()->DeleteCookie(url_, cookie_name_); | 830 this->cookie_monster()->DeleteCookie(url_, cookie_name_); |
831 } | 831 } |
832 | 832 |
833 // Task class for DeleteSessionCookies call. | 833 // Task class for DeleteSessionCookies call. |
834 class CookieMonster::DeleteSessionCookiesTask : public DeleteTask<int> { | 834 class CookieMonster::DeleteSessionCookiesTask : public DeleteTask<int> { |
835 public: | 835 public: |
836 DeleteSessionCookiesTask(CookieMonster* cookie_monster, | 836 DeleteSessionCookiesTask(CookieMonster* cookie_monster, |
837 const DeleteCallback& callback) | 837 const DeleteCallback& callback) |
838 : DeleteTask<int>(cookie_monster, callback) { | 838 : DeleteTask<int>(cookie_monster, callback) { |
839 } | 839 } |
840 | 840 |
841 // DeleteTask: | 841 // DeleteTask: |
842 virtual int RunDeleteTask() OVERRIDE; | 842 virtual int RunDeleteTask() override; |
843 | 843 |
844 protected: | 844 protected: |
845 virtual ~DeleteSessionCookiesTask() {} | 845 virtual ~DeleteSessionCookiesTask() {} |
846 | 846 |
847 private: | 847 private: |
848 DISALLOW_COPY_AND_ASSIGN(DeleteSessionCookiesTask); | 848 DISALLOW_COPY_AND_ASSIGN(DeleteSessionCookiesTask); |
849 }; | 849 }; |
850 | 850 |
851 int CookieMonster::DeleteSessionCookiesTask::RunDeleteTask() { | 851 int CookieMonster::DeleteSessionCookiesTask::RunDeleteTask() { |
852 return this->cookie_monster()->DeleteSessionCookies(); | 852 return this->cookie_monster()->DeleteSessionCookies(); |
853 } | 853 } |
854 | 854 |
855 // Task class for HasCookiesForETLDP1Task call. | 855 // Task class for HasCookiesForETLDP1Task call. |
856 class CookieMonster::HasCookiesForETLDP1Task : public CookieMonsterTask { | 856 class CookieMonster::HasCookiesForETLDP1Task : public CookieMonsterTask { |
857 public: | 857 public: |
858 HasCookiesForETLDP1Task( | 858 HasCookiesForETLDP1Task( |
859 CookieMonster* cookie_monster, | 859 CookieMonster* cookie_monster, |
860 const std::string& etldp1, | 860 const std::string& etldp1, |
861 const HasCookiesForETLDP1Callback& callback) | 861 const HasCookiesForETLDP1Callback& callback) |
862 : CookieMonsterTask(cookie_monster), | 862 : CookieMonsterTask(cookie_monster), |
863 etldp1_(etldp1), | 863 etldp1_(etldp1), |
864 callback_(callback) { | 864 callback_(callback) { |
865 } | 865 } |
866 | 866 |
867 // CookieMonsterTask: | 867 // CookieMonsterTask: |
868 virtual void Run() OVERRIDE; | 868 virtual void Run() override; |
869 | 869 |
870 protected: | 870 protected: |
871 virtual ~HasCookiesForETLDP1Task() {} | 871 virtual ~HasCookiesForETLDP1Task() {} |
872 | 872 |
873 private: | 873 private: |
874 std::string etldp1_; | 874 std::string etldp1_; |
875 HasCookiesForETLDP1Callback callback_; | 875 HasCookiesForETLDP1Callback callback_; |
876 | 876 |
877 DISALLOW_COPY_AND_ASSIGN(HasCookiesForETLDP1Task); | 877 DISALLOW_COPY_AND_ASSIGN(HasCookiesForETLDP1Task); |
878 }; | 878 }; |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 | 2297 |
2298 return true; | 2298 return true; |
2299 } | 2299 } |
2300 | 2300 |
2301 bool CookieMonster::loaded() { | 2301 bool CookieMonster::loaded() { |
2302 base::AutoLock autolock(lock_); | 2302 base::AutoLock autolock(lock_); |
2303 return loaded_; | 2303 return loaded_; |
2304 } | 2304 } |
2305 | 2305 |
2306 } // namespace net | 2306 } // namespace net |
OLD | NEW |