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

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

Issue 9958107: Limiting the "Cookies and site data" form to "web safe" schemes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: The others. Created 8 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_indexed_db_helper.h" 5 #include "chrome/browser/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/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/child_process_security_policy.h"
17 #include "content/public/browser/indexed_db_context.h" 18 #include "content/public/browser/indexed_db_context.h"
18 #include "webkit/database/database_util.h" 19 #include "webkit/database/database_util.h"
19 #include "webkit/glue/webkit_glue.h" 20 #include "webkit/glue/webkit_glue.h"
20 21
21 using content::BrowserContext; 22 using content::BrowserContext;
22 using content::BrowserThread; 23 using content::BrowserThread;
23 using content::IndexedDBContext; 24 using content::IndexedDBContext;
24 using webkit_database::DatabaseUtil; 25 using webkit_database::DatabaseUtil;
25 26
26 namespace { 27 namespace {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 BrowserThread::PostTask( 99 BrowserThread::PostTask(
99 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, 100 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
100 base::Bind( 101 base::Bind(
101 &BrowsingDataIndexedDBHelperImpl::DeleteIndexedDBInWebKitThread, this, 102 &BrowsingDataIndexedDBHelperImpl::DeleteIndexedDBInWebKitThread, this,
102 origin)); 103 origin));
103 } 104 }
104 105
105 void BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread() { 106 void BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread() {
106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
107 std::vector<GURL> origins = indexed_db_context_->GetAllOrigins(); 108 std::vector<GURL> origins = indexed_db_context_->GetAllOrigins();
109 content::ChildProcessSecurityPolicy* policy =
110 content::ChildProcessSecurityPolicy::GetInstance();
108 for (std::vector<GURL>::const_iterator iter = origins.begin(); 111 for (std::vector<GURL>::const_iterator iter = origins.begin();
109 iter != origins.end(); ++iter) { 112 iter != origins.end(); ++iter) {
110 const GURL& origin = *iter; 113 const GURL& origin = *iter;
111 if (origin.SchemeIs(chrome::kExtensionScheme)) 114 if (!policy->IsWebSafeScheme(origin.scheme()))
112 continue; // Extension state is not considered browsing data. 115 continue; // Non-websafe state is not considered browsing data.
116
113 indexed_db_info_.push_back(IndexedDBInfo( 117 indexed_db_info_.push_back(IndexedDBInfo(
114 origin, 118 origin,
115 indexed_db_context_->GetOriginDiskUsage(origin), 119 indexed_db_context_->GetOriginDiskUsage(origin),
116 indexed_db_context_->GetOriginLastModified(origin))); 120 indexed_db_context_->GetOriginLastModified(origin)));
117 } 121 }
118 122
119 BrowserThread::PostTask( 123 BrowserThread::PostTask(
120 BrowserThread::UI, FROM_HERE, 124 BrowserThread::UI, FROM_HERE,
121 base::Bind(&BrowsingDataIndexedDBHelperImpl::NotifyInUIThread, this)); 125 base::Bind(&BrowsingDataIndexedDBHelperImpl::NotifyInUIThread, this));
122 } 126 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 new CannedBrowsingDataIndexedDBHelper(); 187 new CannedBrowsingDataIndexedDBHelper();
184 188
185 base::AutoLock auto_lock(lock_); 189 base::AutoLock auto_lock(lock_);
186 clone->pending_indexed_db_info_ = pending_indexed_db_info_; 190 clone->pending_indexed_db_info_ = pending_indexed_db_info_;
187 clone->indexed_db_info_ = indexed_db_info_; 191 clone->indexed_db_info_ = indexed_db_info_;
188 return clone; 192 return clone;
189 } 193 }
190 194
191 void CannedBrowsingDataIndexedDBHelper::AddIndexedDB( 195 void CannedBrowsingDataIndexedDBHelper::AddIndexedDB(
192 const GURL& origin, const string16& description) { 196 const GURL& origin, const string16& description) {
197 content::ChildProcessSecurityPolicy* policy =
198 content::ChildProcessSecurityPolicy::GetInstance();
199 if (!policy->IsWebSafeScheme(origin.scheme()))
200 return; // Non-websafe state is not considered browsing data.
201
193 base::AutoLock auto_lock(lock_); 202 base::AutoLock auto_lock(lock_);
194 pending_indexed_db_info_.push_back(PendingIndexedDBInfo(origin, description)); 203 pending_indexed_db_info_.push_back(PendingIndexedDBInfo(origin, description));
195 } 204 }
196 205
197 void CannedBrowsingDataIndexedDBHelper::Reset() { 206 void CannedBrowsingDataIndexedDBHelper::Reset() {
198 base::AutoLock auto_lock(lock_); 207 base::AutoLock auto_lock(lock_);
199 indexed_db_info_.clear(); 208 indexed_db_info_.clear();
200 pending_indexed_db_info_.clear(); 209 pending_indexed_db_info_.clear();
201 } 210 }
202 211
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 completion_callback_.Run(indexed_db_info_); 270 completion_callback_.Run(indexed_db_info_);
262 completion_callback_.Reset(); 271 completion_callback_.Reset();
263 } 272 }
264 is_fetching_ = false; 273 is_fetching_ = false;
265 } 274 }
266 275
267 void CannedBrowsingDataIndexedDBHelper::CancelNotification() { 276 void CannedBrowsingDataIndexedDBHelper::CancelNotification() {
268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
269 completion_callback_.Reset(); 278 completion_callback_.Reset();
270 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698