OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 566 } |
567 | 567 |
568 // Returns the index of the icon to use for |node|. Return -1 to use the | 568 // Returns the index of the icon to use for |node|. Return -1 to use the |
569 // default icon. The index is relative to the list of icons returned from | 569 // default icon. The index is relative to the list of icons returned from |
570 // GetIcons. | 570 // GetIcons. |
571 int CookiesTreeModel::GetIconIndex(TreeModelNode* node) { | 571 int CookiesTreeModel::GetIconIndex(TreeModelNode* node) { |
572 CookieTreeNode* ct_node = static_cast<CookieTreeNode*>(node); | 572 CookieTreeNode* ct_node = static_cast<CookieTreeNode*>(node); |
573 switch (ct_node->GetDetailedInfo().node_type) { | 573 switch (ct_node->GetDetailedInfo().node_type) { |
574 case CookieTreeNode::DetailedInfo::TYPE_ORIGIN: | 574 case CookieTreeNode::DetailedInfo::TYPE_ORIGIN: |
575 return ORIGIN; | 575 return ORIGIN; |
576 break; | |
577 case CookieTreeNode::DetailedInfo::TYPE_COOKIE: | 576 case CookieTreeNode::DetailedInfo::TYPE_COOKIE: |
578 return COOKIE; | 577 return COOKIE; |
579 break; | |
580 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: | 578 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: |
581 return DATABASE; | 579 return DATABASE; |
582 break; | |
583 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: | 580 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: |
584 return DATABASE; // close enough | 581 return DATABASE; // close enough |
585 break; | |
586 case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE: | 582 case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE: |
587 return DATABASE; // ditto | 583 return DATABASE; // ditto |
588 break; | |
589 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: | 584 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: |
590 return DATABASE; // ditto | 585 return DATABASE; // ditto |
591 break; | |
592 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: | 586 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: |
593 return DATABASE; // ditto | 587 return DATABASE; // ditto |
| 588 default: |
594 break; | 589 break; |
595 default: | |
596 return -1; | |
597 } | 590 } |
| 591 return -1; |
598 } | 592 } |
599 | 593 |
600 void CookiesTreeModel::LoadCookies() { | 594 void CookiesTreeModel::LoadCookies() { |
601 LoadCookiesWithFilter(std::wstring()); | 595 LoadCookiesWithFilter(std::wstring()); |
602 } | 596 } |
603 | 597 |
604 void CookiesTreeModel::LoadCookiesWithFilter(const std::wstring& filter) { | 598 void CookiesTreeModel::LoadCookiesWithFilter(const std::wstring& filter) { |
605 // mmargh mmargh mmargh! | 599 // mmargh mmargh mmargh! |
606 | 600 |
607 all_cookies_ = cookie_monster_->GetAllCookies(); | 601 all_cookies_ = cookie_monster_->GetAllCookies(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 852 |
859 void CookiesTreeModel::NotifyObserverEndBatch() { | 853 void CookiesTreeModel::NotifyObserverEndBatch() { |
860 // Only notify the observers if this is the outermost call to EndBatch() if | 854 // Only notify the observers if this is the outermost call to EndBatch() if |
861 // called in a nested manner. | 855 // called in a nested manner. |
862 if (--batch_update_ == 0) { | 856 if (--batch_update_ == 0) { |
863 FOR_EACH_OBSERVER(Observer, | 857 FOR_EACH_OBSERVER(Observer, |
864 cookies_observer_list_, | 858 cookies_observer_list_, |
865 TreeModelEndBatch(this)); | 859 TreeModelEndBatch(this)); |
866 } | 860 } |
867 } | 861 } |
OLD | NEW |