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 #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 |
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/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/browsing_data_cookie_helper.h" | 15 #include "chrome/browser/browsing_data_cookie_helper.h" |
16 #include "chrome/browser/browsing_data_server_bound_cert_helper.h" | 16 #include "chrome/browser/browsing_data_server_bound_cert_helper.h" |
17 #include "chrome/browser/content_settings/cookie_settings.h" | 17 #include "chrome/browser/content_settings/cookie_settings.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 19 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
20 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
23 #include "grit/ui_resources.h" | 23 #include "grit/ui_resources.h" |
24 #include "net/base/registry_controlled_domain.h" | 24 #include "net/base/registry_controlled_domain.h" |
25 #include "net/cookies/cookie_monster.h" | 25 #include "net/cookies/canonical_cookie.h" |
26 #include "net/url_request/url_request_context.h" | 26 #include "net/url_request/url_request_context.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/gfx/image/image_skia.h" | 29 #include "ui/gfx/image/image_skia.h" |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 struct NodeTitleComparator { | 33 struct NodeTitleComparator { |
34 bool operator()(const CookieTreeNode* lhs, const CookieTreeNode* rhs) { | 34 bool operator()(const CookieTreeNode* lhs, const CookieTreeNode* rhs) { |
35 return lhs->GetTitle() < rhs->GetTitle(); | 35 return lhs->GetTitle() < rhs->GetTitle(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitHost( | 175 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitHost( |
176 const std::string& app_id, | 176 const std::string& app_id, |
177 const std::string& app_name) { | 177 const std::string& app_name) { |
178 Init(TYPE_HOST); | 178 Init(TYPE_HOST); |
179 this->app_name = app_name; | 179 this->app_name = app_name; |
180 this->app_id = app_id; | 180 this->app_id = app_id; |
181 return *this; | 181 return *this; |
182 } | 182 } |
183 | 183 |
184 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitCookie( | 184 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitCookie( |
185 const net::CookieMonster::CanonicalCookie* cookie) { | 185 const net::CanonicalCookie* cookie) { |
186 Init(TYPE_COOKIE); | 186 Init(TYPE_COOKIE); |
187 this->cookie = cookie; | 187 this->cookie = cookie; |
188 return *this; | 188 return *this; |
189 } | 189 } |
190 | 190 |
191 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitDatabase( | 191 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitDatabase( |
192 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { | 192 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { |
193 Init(TYPE_DATABASE); | 193 Init(TYPE_DATABASE); |
194 this->database_info = database_info; | 194 this->database_info = database_info; |
195 origin = GURL(database_info->origin); | 195 origin = GURL(database_info->origin); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (parent()) | 266 if (parent()) |
267 return parent()->GetModel(); | 267 return parent()->GetModel(); |
268 else | 268 else |
269 return NULL; | 269 return NULL; |
270 } | 270 } |
271 | 271 |
272 /////////////////////////////////////////////////////////////////////////////// | 272 /////////////////////////////////////////////////////////////////////////////// |
273 // CookieTreeCookieNode, public: | 273 // CookieTreeCookieNode, public: |
274 | 274 |
275 CookieTreeCookieNode::CookieTreeCookieNode( | 275 CookieTreeCookieNode::CookieTreeCookieNode( |
276 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie) | 276 std::list<net::CanonicalCookie>::iterator cookie) |
277 : CookieTreeNode(UTF8ToUTF16(cookie->Name())), | 277 : CookieTreeNode(UTF8ToUTF16(cookie->Name())), |
278 cookie_(cookie) { | 278 cookie_(cookie) { |
279 } | 279 } |
280 | 280 |
281 CookieTreeCookieNode::~CookieTreeCookieNode() {} | 281 CookieTreeCookieNode::~CookieTreeCookieNode() {} |
282 | 282 |
283 void CookieTreeCookieNode::DeleteStoredObjects() { | 283 void CookieTreeCookieNode::DeleteStoredObjects() { |
284 LocalDataContainer* container = GetLocalDataContainerForNode(this); | 284 LocalDataContainer* container = GetLocalDataContainerForNode(this); |
285 CHECK(container); | 285 CHECK(container); |
286 container->cookie_helper_->DeleteCookie(*cookie_); | 286 container->cookie_helper_->DeleteCookie(*cookie_); |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 cookies_observer_list_, | 1316 cookies_observer_list_, |
1317 TreeModelEndBatch(this)); | 1317 TreeModelEndBatch(this)); |
1318 } | 1318 } |
1319 } | 1319 } |
1320 | 1320 |
1321 LocalDataContainer* CookiesTreeModel::GetLocalDataContainer( | 1321 LocalDataContainer* CookiesTreeModel::GetLocalDataContainer( |
1322 const std::string& app_id) { | 1322 const std::string& app_id) { |
1323 LocalDataContainer* container = app_data_map_[app_id]; | 1323 LocalDataContainer* container = app_data_map_[app_id]; |
1324 return container; | 1324 return container; |
1325 } | 1325 } |
OLD | NEW |