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

Side by Side Diff: chrome/browser/browsing_data_quota_helper_impl.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) 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_quota_helper_impl.h" 5 #include "chrome/browser/browsing_data_quota_helper_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
14 #include "content/public/browser/child_process_security_policy.h"
14 #include "webkit/quota/quota_manager.h" 15 #include "webkit/quota/quota_manager.h"
15 16
16 using content::BrowserThread; 17 using content::BrowserThread;
17 18
18 // static 19 // static
19 BrowsingDataQuotaHelper* BrowsingDataQuotaHelper::Create(Profile* profile) { 20 BrowsingDataQuotaHelper* BrowsingDataQuotaHelper::Create(Profile* profile) {
20 return new BrowsingDataQuotaHelperImpl( 21 return new BrowsingDataQuotaHelperImpl(
21 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 22 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
22 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 23 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
23 content::BrowserContext::GetQuotaManager(profile)); 24 content::BrowserContext::GetQuotaManager(profile));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 quota_manager_->GetOriginsModifiedSince( 80 quota_manager_->GetOriginsModifiedSince(
80 quota::kStorageTypeTemporary, 81 quota::kStorageTypeTemporary,
81 base::Time(), 82 base::Time(),
82 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins, 83 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins,
83 weak_factory_.GetWeakPtr())); 84 weak_factory_.GetWeakPtr()));
84 } 85 }
85 86
86 void BrowsingDataQuotaHelperImpl::GotOrigins( 87 void BrowsingDataQuotaHelperImpl::GotOrigins(
87 const std::set<GURL>& origins, quota::StorageType type) { 88 const std::set<GURL>& origins, quota::StorageType type) {
89 content::ChildProcessSecurityPolicy* policy =
90 content::ChildProcessSecurityPolicy::GetInstance();
88 for (std::set<GURL>::const_iterator itr = origins.begin(); 91 for (std::set<GURL>::const_iterator itr = origins.begin();
89 itr != origins.end(); 92 itr != origins.end();
90 ++itr) 93 ++itr)
91 if (!itr->SchemeIs(chrome::kExtensionScheme)) 94 if (policy->IsWebSafeScheme(itr->scheme()))
92 pending_hosts_.insert(std::make_pair(itr->host(), type)); 95 pending_hosts_.insert(std::make_pair(itr->host(), type));
93 96
94 DCHECK(type == quota::kStorageTypeTemporary || 97 DCHECK(type == quota::kStorageTypeTemporary ||
95 type == quota::kStorageTypePersistent); 98 type == quota::kStorageTypePersistent);
96 99
97 if (type == quota::kStorageTypeTemporary) { 100 if (type == quota::kStorageTypeTemporary) {
98 quota_manager_->GetOriginsModifiedSince( 101 quota_manager_->GetOriginsModifiedSince(
99 quota::kStorageTypePersistent, 102 quota::kStorageTypePersistent,
100 base::Time(), 103 base::Time(),
101 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins, 104 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 callback_.Run(result); 179 callback_.Run(result);
177 callback_.Reset(); 180 callback_.Reset();
178 } 181 }
179 182
180 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( 183 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota(
181 quota::QuotaStatusCode status_unused, 184 quota::QuotaStatusCode status_unused,
182 const std::string& host_unused, 185 const std::string& host_unused,
183 quota::StorageType type_unused, 186 quota::StorageType type_unused,
184 int64 quota_unused) { 187 int64 quota_unused) {
185 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698