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

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

Issue 10919307: Move IndexedDBContext into the StoragePartition and ensure isolation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove useless include Created 8 years, 3 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/browsing_data_indexed_db_helper.h" 5 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.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/browsing_data_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_helper.h"
16 #include "chrome/browser/profiles/profile.h"
17 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/indexed_db_context.h" 17 #include "content/public/browser/indexed_db_context.h"
19 #include "webkit/database/database_util.h" 18 #include "webkit/database/database_util.h"
20 #include "webkit/glue/webkit_glue.h" 19 #include "webkit/glue/webkit_glue.h"
21 20
22 using content::BrowserContext;
23 using content::BrowserThread; 21 using content::BrowserThread;
24 using content::IndexedDBContext; 22 using content::IndexedDBContext;
25 using webkit_database::DatabaseUtil; 23 using webkit_database::DatabaseUtil;
26 24
27 namespace { 25 namespace {
28 26
29 class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper { 27 class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper {
30 public: 28 public:
31 explicit BrowsingDataIndexedDBHelperImpl(Profile* profile); 29 explicit BrowsingDataIndexedDBHelperImpl(
30 IndexedDBContext* indexed_db_context);
32 31
33 virtual void StartFetching( 32 virtual void StartFetching(
34 const base::Callback<void(const std::list<IndexedDBInfo>&)>& 33 const base::Callback<void(const std::list<IndexedDBInfo>&)>&
35 callback) OVERRIDE; 34 callback) OVERRIDE;
36 virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE; 35 virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE;
37 36
38 private: 37 private:
39 virtual ~BrowsingDataIndexedDBHelperImpl(); 38 virtual ~BrowsingDataIndexedDBHelperImpl();
40 39
41 // Enumerates all indexed database files in the WEBKIT thread. 40 // Enumerates all indexed database files in the WEBKIT thread.
(...skipping 19 matching lines...) Expand all
61 // Indicates whether or not we're currently fetching information: 60 // Indicates whether or not we're currently fetching information:
62 // it's true when StartFetching() is called in the UI thread, and it's reset 61 // it's true when StartFetching() is called in the UI thread, and it's reset
63 // after we notified the callback in the UI thread. 62 // after we notified the callback in the UI thread.
64 // This only mutates on the UI thread. 63 // This only mutates on the UI thread.
65 bool is_fetching_; 64 bool is_fetching_;
66 65
67 DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl); 66 DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl);
68 }; 67 };
69 68
70 BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl( 69 BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl(
71 Profile* profile) 70 IndexedDBContext* indexed_db_context)
72 : indexed_db_context_(BrowserContext::GetIndexedDBContext(profile)), 71 : indexed_db_context_(indexed_db_context),
73 is_fetching_(false) { 72 is_fetching_(false) {
74 DCHECK(indexed_db_context_.get()); 73 DCHECK(indexed_db_context_.get());
75 } 74 }
76 75
77 BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() { 76 BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() {
78 } 77 }
79 78
80 void BrowsingDataIndexedDBHelperImpl::StartFetching( 79 void BrowsingDataIndexedDBHelperImpl::StartFetching(
81 const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) { 80 const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) {
82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 base::Time last_modified) 143 base::Time last_modified)
145 : origin(origin), 144 : origin(origin),
146 size(size), 145 size(size),
147 last_modified(last_modified) { 146 last_modified(last_modified) {
148 } 147 }
149 148
150 BrowsingDataIndexedDBHelper::IndexedDBInfo::~IndexedDBInfo() {} 149 BrowsingDataIndexedDBHelper::IndexedDBInfo::~IndexedDBInfo() {}
151 150
152 // static 151 // static
153 BrowsingDataIndexedDBHelper* BrowsingDataIndexedDBHelper::Create( 152 BrowsingDataIndexedDBHelper* BrowsingDataIndexedDBHelper::Create(
154 Profile* profile) { 153 IndexedDBContext* indexed_db_context) {
155 return new BrowsingDataIndexedDBHelperImpl(profile); 154 return new BrowsingDataIndexedDBHelperImpl(indexed_db_context);
156 } 155 }
157 156
158 CannedBrowsingDataIndexedDBHelper:: 157 CannedBrowsingDataIndexedDBHelper::
159 PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin, 158 PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin,
160 const string16& name) 159 const string16& name)
161 : origin(origin), 160 : origin(origin),
162 name(name) { 161 name(name) {
163 } 162 }
164 163
165 CannedBrowsingDataIndexedDBHelper:: 164 CannedBrowsingDataIndexedDBHelper::
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 253 }
255 254
256 void CannedBrowsingDataIndexedDBHelper::NotifyInUIThread() { 255 void CannedBrowsingDataIndexedDBHelper::NotifyInUIThread() {
257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
258 DCHECK(is_fetching_); 257 DCHECK(is_fetching_);
259 258
260 completion_callback_.Run(indexed_db_info_); 259 completion_callback_.Run(indexed_db_info_);
261 completion_callback_.Reset(); 260 completion_callback_.Reset();
262 is_fetching_ = false; 261 is_fetching_ = false;
263 } 262 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_indexed_db_helper.h ('k') | chrome/browser/extensions/data_deleter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698