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

Side by Side Diff: chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/ui/webui/quota_internals/quota_internals_proxy.h" 5 #include "chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h" 11 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h"
12 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h" 12 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h"
13 #include "net/base/net_util.h" 13 #include "net/base/net_util.h"
14 14
15 using content::BrowserThread; 15 using content::BrowserThread;
16 16
17 namespace quota_internals { 17 namespace quota_internals {
18 18
19 QuotaInternalsProxy::QuotaInternalsProxy(QuotaInternalsHandler* handler) 19 QuotaInternalsProxy::QuotaInternalsProxy(QuotaInternalsHandler* handler)
20 : handler_(handler), 20 : handler_(handler),
21 weak_factory_(this) { 21 weak_factory_(this) {
22 } 22 }
23 23
24 void QuotaInternalsProxy::RequestInfo( 24 void QuotaInternalsProxy::RequestInfo(
25 scoped_refptr<quota::QuotaManager> quota_manager) { 25 scoped_refptr<quota::QuotaManager> quota_manager) {
26 DCHECK(quota_manager); 26 DCHECK(quota_manager.get());
27 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 27 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
28 BrowserThread::PostTask( 28 BrowserThread::PostTask(
29 BrowserThread::IO, FROM_HERE, 29 BrowserThread::IO, FROM_HERE,
30 base::Bind(&QuotaInternalsProxy::RequestInfo, this, quota_manager)); 30 base::Bind(&QuotaInternalsProxy::RequestInfo, this, quota_manager));
31 return; 31 return;
32 } 32 }
33 33
34 quota_manager_ = quota_manager; 34 quota_manager_ = quota_manager;
35 quota_manager_->GetAvailableSpace( 35 quota_manager_->GetAvailableSpace(
36 base::Bind(&QuotaInternalsProxy::DidGetAvailableSpace, 36 base::Bind(&QuotaInternalsProxy::DidGetAvailableSpace,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ReportPerHostInfo(report_pending_); 170 ReportPerHostInfo(report_pending_);
171 report_pending_.clear(); 171 report_pending_.clear();
172 } 172 }
173 173
174 if (!hosts_pending_.empty()) 174 if (!hosts_pending_.empty())
175 GetHostUsage(hosts_pending_.begin()->first, 175 GetHostUsage(hosts_pending_.begin()->first,
176 hosts_pending_.begin()->second); 176 hosts_pending_.begin()->second);
177 } 177 }
178 178
179 void QuotaInternalsProxy::RequestPerOriginInfo(quota::StorageType type) { 179 void QuotaInternalsProxy::RequestPerOriginInfo(quota::StorageType type) {
180 DCHECK(quota_manager_); 180 DCHECK(quota_manager_.get());
181 181
182 std::set<GURL> origins; 182 std::set<GURL> origins;
183 quota_manager_->GetCachedOrigins(type, &origins); 183 quota_manager_->GetCachedOrigins(type, &origins);
184 184
185 std::vector<PerOriginStorageInfo> origin_info; 185 std::vector<PerOriginStorageInfo> origin_info;
186 origin_info.reserve(origins.size()); 186 origin_info.reserve(origins.size());
187 187
188 std::set<std::string> hosts; 188 std::set<std::string> hosts;
189 std::vector<PerHostStorageInfo> host_info; 189 std::vector<PerHostStorageInfo> host_info;
190 190
(...skipping 19 matching lines...) Expand all
210 if (hosts_visited_.insert(std::make_pair(host, type)).second) { 210 if (hosts_visited_.insert(std::make_pair(host, type)).second) {
211 hosts_pending_.insert(std::make_pair(host, type)); 211 hosts_pending_.insert(std::make_pair(host, type));
212 if (hosts_pending_.size() == 1) { 212 if (hosts_pending_.size() == 1) {
213 GetHostUsage(host, type); 213 GetHostUsage(host, type);
214 } 214 }
215 } 215 }
216 } 216 }
217 217
218 void QuotaInternalsProxy::GetHostUsage(const std::string& host, 218 void QuotaInternalsProxy::GetHostUsage(const std::string& host,
219 quota::StorageType type) { 219 quota::StorageType type) {
220 DCHECK(quota_manager_); 220 DCHECK(quota_manager_.get());
221 quota_manager_->GetHostUsage( 221 quota_manager_->GetHostUsage(host,
222 host, type, 222 type,
223 base::Bind(&QuotaInternalsProxy::DidGetHostUsage, 223 base::Bind(&QuotaInternalsProxy::DidGetHostUsage,
224 weak_factory_.GetWeakPtr(), host, type)); 224 weak_factory_.GetWeakPtr(),
225 host,
226 type));
225 } 227 }
226 228
227 } // namespace quota_internals 229 } // namespace quota_internals
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/quota_internals/quota_internals_handler.cc ('k') | chrome/browser/ui/webui/session_favicon_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698