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

Side by Side Diff: chrome/browser/sessions/session_data_deleter.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "chrome/browser/browser_shutdown.h" 8 #include "chrome/browser/browser_shutdown.h"
9 #include "chrome/browser/prefs/session_startup_pref.h" 9 #include "chrome/browser/prefs/session_startup_pref.h"
10 #include "chrome/browser/profiles/profile_io_data.h" 10 #include "chrome/browser/profiles/profile_io_data.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace { 23 namespace {
24 24
25 void CookieDeleted(bool success) { 25 void CookieDeleted(bool success) {
26 DCHECK(success); 26 DCHECK(success);
27 } 27 }
28 28
29 class SessionDataDeleter 29 class SessionDataDeleter
30 : public base::RefCountedThreadSafe<SessionDataDeleter> { 30 : public base::RefCountedThreadSafe<SessionDataDeleter> {
31 public: 31 public:
32 SessionDataDeleter(quota::SpecialStoragePolicy* storage_policy, 32 SessionDataDeleter(storage::SpecialStoragePolicy* storage_policy,
33 bool delete_only_by_session_only_policy); 33 bool delete_only_by_session_only_policy);
34 34
35 void Run(content::StoragePartition* storage_partition, 35 void Run(content::StoragePartition* storage_partition,
36 ProfileIOData* profile_io_data); 36 ProfileIOData* profile_io_data);
37 37
38 private: 38 private:
39 friend class base::RefCountedThreadSafe<SessionDataDeleter>; 39 friend class base::RefCountedThreadSafe<SessionDataDeleter>;
40 ~SessionDataDeleter(); 40 ~SessionDataDeleter();
41 41
42 // Deletes the local storage described by |usages| for origins which are 42 // Deletes the local storage described by |usages| for origins which are
43 // session-only. 43 // session-only.
44 void ClearSessionOnlyLocalStorage( 44 void ClearSessionOnlyLocalStorage(
45 content::StoragePartition* storage_partition, 45 content::StoragePartition* storage_partition,
46 const std::vector<content::LocalStorageUsageInfo>& usages); 46 const std::vector<content::LocalStorageUsageInfo>& usages);
47 47
48 // Deletes all cookies that are session only if 48 // Deletes all cookies that are session only if
49 // |delete_only_by_session_only_policy_| is false. Once completed or skipped, 49 // |delete_only_by_session_only_policy_| is false. Once completed or skipped,
50 // this arranges for DeleteSessionOnlyOriginCookies to be called with a list 50 // this arranges for DeleteSessionOnlyOriginCookies to be called with a list
51 // of all remaining cookies. 51 // of all remaining cookies.
52 void DeleteSessionCookiesOnIOThread(ProfileIOData* profile_io_data); 52 void DeleteSessionCookiesOnIOThread(ProfileIOData* profile_io_data);
53 53
54 // Called when all session-only cookies have been deleted. 54 // Called when all session-only cookies have been deleted.
55 void DeleteSessionCookiesDone(int num_deleted); 55 void DeleteSessionCookiesDone(int num_deleted);
56 56
57 // Deletes the cookies in |cookies| that are for origins which are 57 // Deletes the cookies in |cookies| that are for origins which are
58 // session-only. 58 // session-only.
59 void DeleteSessionOnlyOriginCookies(const net::CookieList& cookies); 59 void DeleteSessionOnlyOriginCookies(const net::CookieList& cookies);
60 60
61 scoped_refptr<net::CookieMonster> cookie_monster_; 61 scoped_refptr<net::CookieMonster> cookie_monster_;
62 scoped_refptr<quota::SpecialStoragePolicy> storage_policy_; 62 scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
63 const bool delete_only_by_session_only_policy_; 63 const bool delete_only_by_session_only_policy_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(SessionDataDeleter); 65 DISALLOW_COPY_AND_ASSIGN(SessionDataDeleter);
66 }; 66 };
67 67
68 SessionDataDeleter::SessionDataDeleter( 68 SessionDataDeleter::SessionDataDeleter(
69 quota::SpecialStoragePolicy* storage_policy, 69 storage::SpecialStoragePolicy* storage_policy,
70 bool delete_only_by_session_only_policy) 70 bool delete_only_by_session_only_policy)
71 : storage_policy_(storage_policy), 71 : storage_policy_(storage_policy),
72 delete_only_by_session_only_policy_(delete_only_by_session_only_policy) {} 72 delete_only_by_session_only_policy_(delete_only_by_session_only_policy) {
73 }
73 74
74 void SessionDataDeleter::Run(content::StoragePartition* storage_partition, 75 void SessionDataDeleter::Run(content::StoragePartition* storage_partition,
75 ProfileIOData* profile_io_data) { 76 ProfileIOData* profile_io_data) {
76 if (storage_policy_ && storage_policy_->HasSessionOnlyOrigins()) { 77 if (storage_policy_ && storage_policy_->HasSessionOnlyOrigins()) {
77 storage_partition->GetDOMStorageContext()->GetLocalStorageUsage( 78 storage_partition->GetDOMStorageContext()->GetLocalStorageUsage(
78 base::Bind(&SessionDataDeleter::ClearSessionOnlyLocalStorage, 79 base::Bind(&SessionDataDeleter::ClearSessionOnlyLocalStorage,
79 this, 80 this,
80 storage_partition)); 81 storage_partition));
81 } 82 }
82 content::BrowserThread::PostTask( 83 content::BrowserThread::PostTask(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 *CommandLine::ForCurrentProcess(), profile).type; 155 *CommandLine::ForCurrentProcess(), profile).type;
155 #endif 156 #endif
156 157
157 scoped_refptr<SessionDataDeleter> deleter( 158 scoped_refptr<SessionDataDeleter> deleter(
158 new SessionDataDeleter(profile->GetSpecialStoragePolicy(), 159 new SessionDataDeleter(profile->GetSpecialStoragePolicy(),
159 startup_pref_type == SessionStartupPref::LAST)); 160 startup_pref_type == SessionStartupPref::LAST));
160 deleter->Run( 161 deleter->Run(
161 Profile::GetDefaultStoragePartition(profile), 162 Profile::GetDefaultStoragePartition(profile),
162 ProfileIOData::FromResourceContext(profile->GetResourceContext())); 163 ProfileIOData::FromResourceContext(profile->GetResourceContext()));
163 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698