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

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

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
11 #include <map> 11 #include <map>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 18 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
19 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 19 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
20 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" 20 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
21 #include "chrome/browser/content_settings/cookie_settings_factory.h" 21 #include "chrome/browser/content_settings/cookie_settings_factory.h"
22 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
23 #include "chrome/grit/theme_resources.h" 23 #include "chrome/grit/theme_resources.h"
24 #include "components/content_settings/core/browser/cookie_settings.h" 24 #include "components/content_settings/core/browser/cookie_settings.h"
25 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
26 #include "extensions/features/features.h"
26 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 27 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
27 #include "net/cookies/canonical_cookie.h" 28 #include "net/cookies/canonical_cookie.h"
28 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/image/image_skia.h" 32 #include "ui/gfx/image/image_skia.h"
32 #include "ui/resources/grit/ui_resources.h" 33 #include "ui/resources/grit/ui_resources.h"
33 #include "url/gurl.h" 34 #include "url/gurl.h"
34 #include "url/origin.h" 35 #include "url/origin.h"
35 36
36 #if defined(ENABLE_EXTENSIONS) 37 #if BUILDFLAG(ENABLE_EXTENSIONS)
37 #include "chrome/browser/extensions/extension_special_storage_policy.h" 38 #include "chrome/browser/extensions/extension_special_storage_policy.h"
38 #include "extensions/common/extension_set.h" 39 #include "extensions/common/extension_set.h"
39 #endif 40 #endif
40 41
41 namespace { 42 namespace {
42 43
43 struct NodeTitleComparator { 44 struct NodeTitleComparator {
44 bool operator()(const std::unique_ptr<CookieTreeNode>& lhs, 45 bool operator()(const std::unique_ptr<CookieTreeNode>& lhs,
45 const std::unique_ptr<CookieTreeNode>& rhs) { 46 const std::unique_ptr<CookieTreeNode>& rhs) {
46 return lhs->GetTitle() < rhs->GetTitle(); 47 return lhs->GetTitle() < rhs->GetTitle();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (next_dot == std::string::npos) { 122 if (next_dot == std::string::npos) {
122 retval += host.substr(0, position); 123 retval += host.substr(0, position);
123 break; 124 break;
124 } 125 }
125 retval += host.substr(next_dot + 1, position - (next_dot + 1)); 126 retval += host.substr(next_dot + 1, position - (next_dot + 1));
126 position = next_dot; 127 position = next_dot;
127 } 128 }
128 return retval; 129 return retval;
129 } 130 }
130 131
131 #if defined(ENABLE_EXTENSIONS) 132 #if BUILDFLAG(ENABLE_EXTENSIONS)
132 bool TypeIsProtected(CookieTreeNode::DetailedInfo::NodeType type) { 133 bool TypeIsProtected(CookieTreeNode::DetailedInfo::NodeType type) {
133 switch (type) { 134 switch (type) {
134 // Fall through each below cases to return true. 135 // Fall through each below cases to return true.
135 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: 136 case CookieTreeNode::DetailedInfo::TYPE_DATABASE:
136 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: 137 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE:
137 case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE: 138 case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE:
138 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: 139 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE:
139 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: 140 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
140 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: 141 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM:
141 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: 142 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER:
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1021 }
1021 } 1022 }
1022 1023
1023 /////////////////////////////////////////////////////////////////////////////// 1024 ///////////////////////////////////////////////////////////////////////////////
1024 // CookiesTreeModel, public: 1025 // CookiesTreeModel, public:
1025 CookiesTreeModel::CookiesTreeModel( 1026 CookiesTreeModel::CookiesTreeModel(
1026 LocalDataContainer* data_container, 1027 LocalDataContainer* data_container,
1027 ExtensionSpecialStoragePolicy* special_storage_policy) 1028 ExtensionSpecialStoragePolicy* special_storage_policy)
1028 : ui::TreeNodeModel<CookieTreeNode>( 1029 : ui::TreeNodeModel<CookieTreeNode>(
1029 base::MakeUnique<CookieTreeRootNode>(this)), 1030 base::MakeUnique<CookieTreeRootNode>(this)),
1030 #if defined(ENABLE_EXTENSIONS) 1031 #if BUILDFLAG(ENABLE_EXTENSIONS)
1031 special_storage_policy_(special_storage_policy), 1032 special_storage_policy_(special_storage_policy),
1032 #endif 1033 #endif
1033 data_container_(data_container) { 1034 data_container_(data_container) {
1034 data_container_->Init(this); 1035 data_container_->Init(this);
1035 } 1036 }
1036 1037
1037 CookiesTreeModel::~CookiesTreeModel() { 1038 CookiesTreeModel::~CookiesTreeModel() {
1038 } 1039 }
1039 1040
1040 // static 1041 // static
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 PopulateSessionStorageInfoWithFilter(data_container(), &notifier, filter); 1130 PopulateSessionStorageInfoWithFilter(data_container(), &notifier, filter);
1130 PopulateAppCacheInfoWithFilter(data_container(), &notifier, filter); 1131 PopulateAppCacheInfoWithFilter(data_container(), &notifier, filter);
1131 PopulateIndexedDBInfoWithFilter(data_container(), &notifier, filter); 1132 PopulateIndexedDBInfoWithFilter(data_container(), &notifier, filter);
1132 PopulateFileSystemInfoWithFilter(data_container(), &notifier, filter); 1133 PopulateFileSystemInfoWithFilter(data_container(), &notifier, filter);
1133 PopulateQuotaInfoWithFilter(data_container(), &notifier, filter); 1134 PopulateQuotaInfoWithFilter(data_container(), &notifier, filter);
1134 PopulateChannelIDInfoWithFilter(data_container(), &notifier, filter); 1135 PopulateChannelIDInfoWithFilter(data_container(), &notifier, filter);
1135 PopulateServiceWorkerUsageInfoWithFilter(data_container(), &notifier, filter); 1136 PopulateServiceWorkerUsageInfoWithFilter(data_container(), &notifier, filter);
1136 PopulateCacheStorageUsageInfoWithFilter(data_container(), &notifier, filter); 1137 PopulateCacheStorageUsageInfoWithFilter(data_container(), &notifier, filter);
1137 } 1138 }
1138 1139
1139 #if defined(ENABLE_EXTENSIONS) 1140 #if BUILDFLAG(ENABLE_EXTENSIONS)
1140 const extensions::ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode( 1141 const extensions::ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode(
1141 const CookieTreeNode& cookie_node) { 1142 const CookieTreeNode& cookie_node) {
1142 if (!special_storage_policy_.get()) 1143 if (!special_storage_policy_.get())
1143 return nullptr; 1144 return nullptr;
1144 1145
1145 CookieTreeNode::DetailedInfo info = cookie_node.GetDetailedInfo(); 1146 CookieTreeNode::DetailedInfo info = cookie_node.GetDetailedInfo();
1146 1147
1147 if (!TypeIsProtected(info.node_type)) 1148 if (!TypeIsProtected(info.node_type))
1148 return nullptr; 1149 return nullptr;
1149 1150
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 void CookiesTreeModel::MaybeNotifyBatchesEnded() { 1617 void CookiesTreeModel::MaybeNotifyBatchesEnded() {
1617 // Only notify the observers if this is the outermost call to EndBatch() if 1618 // Only notify the observers if this is the outermost call to EndBatch() if
1618 // called in a nested manner. 1619 // called in a nested manner.
1619 if (batches_ended_ == batches_started_ && 1620 if (batches_ended_ == batches_started_ &&
1620 batches_seen_ == batches_expected_) { 1621 batches_seen_ == batches_expected_) {
1621 for (Observer& observer : cookies_observer_list_) 1622 for (Observer& observer : cookies_observer_list_)
1622 observer.TreeModelEndBatch(this); 1623 observer.TreeModelEndBatch(this);
1623 SetBatchExpectation(0, true); 1624 SetBatchExpectation(0, true);
1624 } 1625 }
1625 } 1626 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/cookies_tree_model.h ('k') | chrome/browser/browsing_data/cookies_tree_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698