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

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

Issue 17003010: Port BrowsingDataDatabaseHelper to webkit_database::DatabaseIdentifier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 7 years, 6 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
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const net::CanonicalCookie* cookie) { 182 const net::CanonicalCookie* cookie) {
183 Init(TYPE_COOKIE); 183 Init(TYPE_COOKIE);
184 this->cookie = cookie; 184 this->cookie = cookie;
185 return *this; 185 return *this;
186 } 186 }
187 187
188 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitDatabase( 188 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitDatabase(
189 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { 189 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) {
190 Init(TYPE_DATABASE); 190 Init(TYPE_DATABASE);
191 this->database_info = database_info; 191 this->database_info = database_info;
192 origin = GURL(database_info->origin); 192 origin = database_info->identifier.ToOrigin();
193 return *this; 193 return *this;
194 } 194 }
195 195
196 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitLocalStorage( 196 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitLocalStorage(
197 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 197 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
198 local_storage_info) { 198 local_storage_info) {
199 Init(TYPE_LOCAL_STORAGE); 199 Init(TYPE_LOCAL_STORAGE);
200 this->local_storage_info = local_storage_info; 200 this->local_storage_info = local_storage_info;
201 origin = local_storage_info->origin_url; 201 origin = local_storage_info->origin_url;
202 return *this; 202 return *this;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 database_info_(database_info) { 335 database_info_(database_info) {
336 } 336 }
337 337
338 CookieTreeDatabaseNode::~CookieTreeDatabaseNode() {} 338 CookieTreeDatabaseNode::~CookieTreeDatabaseNode() {}
339 339
340 void CookieTreeDatabaseNode::DeleteStoredObjects() { 340 void CookieTreeDatabaseNode::DeleteStoredObjects() {
341 LocalDataContainer* container = GetLocalDataContainerForNode(this); 341 LocalDataContainer* container = GetLocalDataContainerForNode(this);
342 342
343 if (container) { 343 if (container) {
344 container->database_helper_->DeleteDatabase( 344 container->database_helper_->DeleteDatabase(
345 database_info_->origin_identifier, database_info_->database_name); 345 database_info_->identifier.ToString(), database_info_->database_name);
346 container->database_info_list_.erase(database_info_); 346 container->database_info_list_.erase(database_info_);
347 } 347 }
348 } 348 }
349 349
350 CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const { 350 CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const {
351 return DetailedInfo().InitDatabase(&*database_info_); 351 return DetailedInfo().InitDatabase(&*database_info_);
352 } 352 }
353 353
354 /////////////////////////////////////////////////////////////////////////////// 354 ///////////////////////////////////////////////////////////////////////////////
355 // CookieTreeLocalStorageNode, public: 355 // CookieTreeLocalStorageNode, public:
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1106 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1107 1107
1108 if (container->database_info_list_.empty()) 1108 if (container->database_info_list_.empty())
1109 return; 1109 return;
1110 1110
1111 notifier->StartBatchUpdate(); 1111 notifier->StartBatchUpdate();
1112 for (DatabaseInfoList::iterator database_info = 1112 for (DatabaseInfoList::iterator database_info =
1113 container->database_info_list_.begin(); 1113 container->database_info_list_.begin();
1114 database_info != container->database_info_list_.end(); 1114 database_info != container->database_info_list_.end();
1115 ++database_info) { 1115 ++database_info) {
1116 GURL origin(database_info->origin); 1116 GURL origin(database_info->identifier.ToOrigin());
1117 1117
1118 if (!filter.size() || 1118 if (!filter.size() ||
1119 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != 1119 (CookieTreeHostNode::TitleForUrl(origin).find(filter) !=
1120 string16::npos)) { 1120 string16::npos)) {
1121 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1121 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1122 CookieTreeDatabasesNode* databases_node = 1122 CookieTreeDatabasesNode* databases_node =
1123 host_node->GetOrCreateDatabasesNode(); 1123 host_node->GetOrCreateDatabasesNode();
1124 databases_node->AddDatabaseNode( 1124 databases_node->AddDatabaseNode(
1125 new CookieTreeDatabaseNode(database_info)); 1125 new CookieTreeDatabaseNode(database_info));
1126 } 1126 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 1328
1329 void CookiesTreeModel::NotifyObserverEndBatch() { 1329 void CookiesTreeModel::NotifyObserverEndBatch() {
1330 // Only notify the observers if this is the outermost call to EndBatch() if 1330 // Only notify the observers if this is the outermost call to EndBatch() if
1331 // called in a nested manner. 1331 // called in a nested manner.
1332 if (--batch_update_ == 0) { 1332 if (--batch_update_ == 0) {
1333 FOR_EACH_OBSERVER(Observer, 1333 FOR_EACH_OBSERVER(Observer,
1334 cookies_observer_list_, 1334 cookies_observer_list_,
1335 TreeModelEndBatch(this)); 1335 TreeModelEndBatch(this));
1336 } 1336 }
1337 } 1337 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698