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

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

Issue 428323002: ifdef remaining extensions code in chrome/browser/browsing_data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browsing_data/cookies_tree_model.h" 5 #include "chrome/browser/browsing_data/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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
17 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" 17 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
18 #include "chrome/browser/content_settings/cookie_settings.h" 18 #include "chrome/browser/content_settings/cookie_settings.h"
19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_special_storage_policy.h"
21 #include "content/public/common/url_constants.h" 19 #include "content/public/common/url_constants.h"
22 #include "extensions/common/extension_set.h"
23 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
25 #include "grit/ui_resources.h" 22 #include "grit/ui_resources.h"
26 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 23 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
27 #include "net/cookies/canonical_cookie.h" 24 #include "net/cookies/canonical_cookie.h"
28 #include "net/url_request/url_request_context.h" 25 #include "net/url_request/url_request_context.h"
29 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/image/image_skia.h" 28 #include "ui/gfx/image/image_skia.h"
32 29
30 #if defined(ENABLE_EXTENSIONS)
31 #include "chrome/browser/extensions/extension_special_storage_policy.h"
32 #include "extensions/common/extension_set.h"
33 #endif
34
33 namespace { 35 namespace {
34 36
35 struct NodeTitleComparator { 37 struct NodeTitleComparator {
36 bool operator()(const CookieTreeNode* lhs, const CookieTreeNode* rhs) { 38 bool operator()(const CookieTreeNode* lhs, const CookieTreeNode* rhs) {
37 return lhs->GetTitle() < rhs->GetTitle(); 39 return lhs->GetTitle() < rhs->GetTitle();
38 } 40 }
39 }; 41 };
40 42
41 // Comparison functor, for use in CookieTreeRootNode. 43 // Comparison functor, for use in CookieTreeRootNode.
42 struct HostNodeComparator { 44 struct HostNodeComparator {
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 } 862 }
861 863
862 /////////////////////////////////////////////////////////////////////////////// 864 ///////////////////////////////////////////////////////////////////////////////
863 // CookiesTreeModel, public: 865 // CookiesTreeModel, public:
864 CookiesTreeModel::CookiesTreeModel( 866 CookiesTreeModel::CookiesTreeModel(
865 LocalDataContainer* data_container, 867 LocalDataContainer* data_container,
866 ExtensionSpecialStoragePolicy* special_storage_policy, 868 ExtensionSpecialStoragePolicy* special_storage_policy,
867 bool group_by_cookie_source) 869 bool group_by_cookie_source)
868 : ui::TreeNodeModel<CookieTreeNode>(new CookieTreeRootNode(this)), 870 : ui::TreeNodeModel<CookieTreeNode>(new CookieTreeRootNode(this)),
869 data_container_(data_container), 871 data_container_(data_container),
872 #if defined(ENABLE_EXTENSIONS)
870 special_storage_policy_(special_storage_policy), 873 special_storage_policy_(special_storage_policy),
874 #endif
871 group_by_cookie_source_(group_by_cookie_source), 875 group_by_cookie_source_(group_by_cookie_source),
872 batch_update_(0) { 876 batch_update_(0) {
873 data_container_->Init(this); 877 data_container_->Init(this);
874 } 878 }
875 879
876 CookiesTreeModel::~CookiesTreeModel() { 880 CookiesTreeModel::~CookiesTreeModel() {
877 } 881 }
878 882
879 /////////////////////////////////////////////////////////////////////////////// 883 ///////////////////////////////////////////////////////////////////////////////
880 // CookiesTreeModel, TreeModel methods (public): 884 // CookiesTreeModel, TreeModel methods (public):
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 PopulateDatabaseInfoWithFilter(data_container(), &notifier, filter); 960 PopulateDatabaseInfoWithFilter(data_container(), &notifier, filter);
957 PopulateLocalStorageInfoWithFilter(data_container(), &notifier, filter); 961 PopulateLocalStorageInfoWithFilter(data_container(), &notifier, filter);
958 PopulateSessionStorageInfoWithFilter(data_container(), &notifier, filter); 962 PopulateSessionStorageInfoWithFilter(data_container(), &notifier, filter);
959 PopulateAppCacheInfoWithFilter(data_container(), &notifier, filter); 963 PopulateAppCacheInfoWithFilter(data_container(), &notifier, filter);
960 PopulateIndexedDBInfoWithFilter(data_container(), &notifier, filter); 964 PopulateIndexedDBInfoWithFilter(data_container(), &notifier, filter);
961 PopulateFileSystemInfoWithFilter(data_container(), &notifier, filter); 965 PopulateFileSystemInfoWithFilter(data_container(), &notifier, filter);
962 PopulateQuotaInfoWithFilter(data_container(), &notifier, filter); 966 PopulateQuotaInfoWithFilter(data_container(), &notifier, filter);
963 PopulateChannelIDInfoWithFilter(data_container(), &notifier, filter); 967 PopulateChannelIDInfoWithFilter(data_container(), &notifier, filter);
964 } 968 }
965 969
970 #if defined(ENABLE_EXTENSIONS)
966 const extensions::ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode( 971 const extensions::ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode(
967 const CookieTreeNode& cookie_node) { 972 const CookieTreeNode& cookie_node) {
968 if (!special_storage_policy_.get()) 973 if (!special_storage_policy_)
969 return NULL; 974 return NULL;
970 975
971 CookieTreeNode::DetailedInfo info = cookie_node.GetDetailedInfo(); 976 CookieTreeNode::DetailedInfo info = cookie_node.GetDetailedInfo();
972 977
973 if (!TypeIsProtected(info.node_type)) 978 if (!TypeIsProtected(info.node_type))
974 return NULL; 979 return NULL;
975 980
976 DCHECK(!info.origin.is_empty()); 981 DCHECK(!info.origin.is_empty());
977 return special_storage_policy_->ExtensionsProtectingOrigin(info.origin); 982 return special_storage_policy_->ExtensionsProtectingOrigin(info.origin);
978 } 983 }
984 #endif
979 985
980 void CookiesTreeModel::AddCookiesTreeObserver(Observer* observer) { 986 void CookiesTreeModel::AddCookiesTreeObserver(Observer* observer) {
981 cookies_observer_list_.AddObserver(observer); 987 cookies_observer_list_.AddObserver(observer);
982 // Call super so that TreeNodeModel can notify, too. 988 // Call super so that TreeNodeModel can notify, too.
983 ui::TreeNodeModel<CookieTreeNode>::AddObserver(observer); 989 ui::TreeNodeModel<CookieTreeNode>::AddObserver(observer);
984 } 990 }
985 991
986 void CookiesTreeModel::RemoveCookiesTreeObserver(Observer* observer) { 992 void CookiesTreeModel::RemoveCookiesTreeObserver(Observer* observer) {
987 cookies_observer_list_.RemoveObserver(observer); 993 cookies_observer_list_.RemoveObserver(observer);
988 // Call super so that TreeNodeModel doesn't have dead pointers. 994 // Call super so that TreeNodeModel doesn't have dead pointers.
(...skipping 19 matching lines...) Expand all
1008 ScopedBatchUpdateNotifier notifier(this, GetRoot()); 1014 ScopedBatchUpdateNotifier notifier(this, GetRoot());
1009 PopulateLocalStorageInfoWithFilter(container, &notifier, base::string16()); 1015 PopulateLocalStorageInfoWithFilter(container, &notifier, base::string16());
1010 } 1016 }
1011 1017
1012 void CookiesTreeModel::PopulateSessionStorageInfo( 1018 void CookiesTreeModel::PopulateSessionStorageInfo(
1013 LocalDataContainer* container) { 1019 LocalDataContainer* container) {
1014 ScopedBatchUpdateNotifier notifier(this, GetRoot()); 1020 ScopedBatchUpdateNotifier notifier(this, GetRoot());
1015 PopulateSessionStorageInfoWithFilter(container, &notifier, base::string16()); 1021 PopulateSessionStorageInfoWithFilter(container, &notifier, base::string16());
1016 } 1022 }
1017 1023
1018 void CookiesTreeModel::PopulateIndexedDBInfo(LocalDataContainer* container){ 1024 void CookiesTreeModel::PopulateIndexedDBInfo(LocalDataContainer* container) {
1019 ScopedBatchUpdateNotifier notifier(this, GetRoot()); 1025 ScopedBatchUpdateNotifier notifier(this, GetRoot());
1020 PopulateIndexedDBInfoWithFilter(container, &notifier, base::string16()); 1026 PopulateIndexedDBInfoWithFilter(container, &notifier, base::string16());
1021 } 1027 }
1022 1028
1023 void CookiesTreeModel::PopulateFileSystemInfo(LocalDataContainer* container) { 1029 void CookiesTreeModel::PopulateFileSystemInfo(LocalDataContainer* container) {
1024 ScopedBatchUpdateNotifier notifier(this, GetRoot()); 1030 ScopedBatchUpdateNotifier notifier(this, GetRoot());
1025 PopulateFileSystemInfoWithFilter(container, &notifier, base::string16()); 1031 PopulateFileSystemInfoWithFilter(container, &notifier, base::string16());
1026 } 1032 }
1027 1033
1028 void CookiesTreeModel::PopulateQuotaInfo(LocalDataContainer* container) { 1034 void CookiesTreeModel::PopulateQuotaInfo(LocalDataContainer* container) {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 1341
1336 void CookiesTreeModel::NotifyObserverEndBatch() { 1342 void CookiesTreeModel::NotifyObserverEndBatch() {
1337 // Only notify the observers if this is the outermost call to EndBatch() if 1343 // Only notify the observers if this is the outermost call to EndBatch() if
1338 // called in a nested manner. 1344 // called in a nested manner.
1339 if (--batch_update_ == 0) { 1345 if (--batch_update_ == 0) {
1340 FOR_EACH_OBSERVER(Observer, 1346 FOR_EACH_OBSERVER(Observer,
1341 cookies_observer_list_, 1347 cookies_observer_list_,
1342 TreeModelEndBatch(this)); 1348 TreeModelEndBatch(this));
1343 } 1349 }
1344 } 1350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698