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

Side by Side Diff: chrome/browser/ui/webui/quota_internals/quota_internals_handler.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) 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/ui/webui/quota_internals/quota_internals_handler.h" 5 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h" 13 #include "chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h"
14 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h" 14 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h"
15 #include "content/public/browser/storage_partition.h" 15 #include "content/public/browser/storage_partition.h"
16 #include "content/public/browser/web_ui.h" 16 #include "content/public/browser/web_ui.h"
17 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
18 18
19 using content::BrowserContext; 19 using content::BrowserContext;
20 20
21 namespace quota_internals { 21 namespace quota_internals {
22 22
23 QuotaInternalsHandler::QuotaInternalsHandler() {} 23 QuotaInternalsHandler::QuotaInternalsHandler() {}
24 24
25 QuotaInternalsHandler::~QuotaInternalsHandler() { 25 QuotaInternalsHandler::~QuotaInternalsHandler() {
26 if (proxy_) 26 if (proxy_.get())
27 proxy_->handler_ = NULL; 27 proxy_->handler_ = NULL;
28 } 28 }
29 29
30 void QuotaInternalsHandler::RegisterMessages() { 30 void QuotaInternalsHandler::RegisterMessages() {
31 web_ui()->RegisterMessageCallback("requestInfo", 31 web_ui()->RegisterMessageCallback("requestInfo",
32 base::Bind(&QuotaInternalsHandler::OnRequestInfo, 32 base::Bind(&QuotaInternalsHandler::OnRequestInfo,
33 base::Unretained(this))); 33 base::Unretained(this)));
34 } 34 }
35 35
36 void QuotaInternalsHandler::ReportAvailableSpace(int64 available_space) { 36 void QuotaInternalsHandler::ReportAvailableSpace(int64 available_space) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 void QuotaInternalsHandler::SendMessage(const std::string& message, 79 void QuotaInternalsHandler::SendMessage(const std::string& message,
80 const base::Value& value) { 80 const base::Value& value) {
81 scoped_ptr<base::Value> message_data(base::Value::CreateStringValue(message)); 81 scoped_ptr<base::Value> message_data(base::Value::CreateStringValue(message));
82 web_ui()->CallJavascriptFunction("cr.quota.messageHandler", 82 web_ui()->CallJavascriptFunction("cr.quota.messageHandler",
83 *message_data, 83 *message_data,
84 value); 84 value);
85 } 85 }
86 86
87 void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) { 87 void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) {
88 if (!proxy_) 88 if (!proxy_.get())
89 proxy_ = new QuotaInternalsProxy(this); 89 proxy_ = new QuotaInternalsProxy(this);
90 proxy_->RequestInfo( 90 proxy_->RequestInfo(
91 BrowserContext::GetDefaultStoragePartition( 91 BrowserContext::GetDefaultStoragePartition(
92 Profile::FromWebUI(web_ui()))->GetQuotaManager()); 92 Profile::FromWebUI(web_ui()))->GetQuotaManager());
93 } 93 }
94 94
95 } // namespace quota_internals 95 } // namespace quota_internals
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698