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

Side by Side Diff: chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/api/data_reduction_proxy/data_reduction_prox y_api.h" 5 #include "chrome/browser/extensions/api/data_reduction_proxy/data_reduction_prox y_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
(...skipping 22 matching lines...) Expand all
33 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 33 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
34 browser_context()); 34 browser_context());
35 settings->data_reduction_proxy_service() 35 settings->data_reduction_proxy_service()
36 ->compression_stats() 36 ->compression_stats()
37 ->GetHistoricalDataUsage(base::Bind( 37 ->GetHistoricalDataUsage(base::Bind(
38 &DataReductionProxyGetDataUsageFunction::ReplyWithDataUsage, this)); 38 &DataReductionProxyGetDataUsageFunction::ReplyWithDataUsage, this));
39 return RespondLater(); 39 return RespondLater();
40 } 40 }
41 41
42 void DataReductionProxyGetDataUsageFunction::ReplyWithDataUsage( 42 void DataReductionProxyGetDataUsageFunction::ReplyWithDataUsage(
43 scoped_ptr<std::vector<data_reduction_proxy::DataUsageBucket>> data_usage) { 43 std::unique_ptr<std::vector<data_reduction_proxy::DataUsageBucket>>
44 data_usage) {
44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 45 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
45 46
46 scoped_ptr<base::ListValue> data_usage_buckets(new base::ListValue()); 47 std::unique_ptr<base::ListValue> data_usage_buckets(new base::ListValue());
47 for (const auto& data_usage_bucket : *data_usage) { 48 for (const auto& data_usage_bucket : *data_usage) {
48 scoped_ptr<base::ListValue> connection_usage_list(new base::ListValue()); 49 std::unique_ptr<base::ListValue> connection_usage_list(
50 new base::ListValue());
49 for (auto connection_usage : data_usage_bucket.connection_usage()) { 51 for (auto connection_usage : data_usage_bucket.connection_usage()) {
50 scoped_ptr<base::ListValue> site_usage_list(new base::ListValue()); 52 std::unique_ptr<base::ListValue> site_usage_list(new base::ListValue());
51 for (auto site_usage : connection_usage.site_usage()) { 53 for (auto site_usage : connection_usage.site_usage()) {
52 scoped_ptr<base::DictionaryValue> usage(new base::DictionaryValue()); 54 std::unique_ptr<base::DictionaryValue> usage(
55 new base::DictionaryValue());
53 usage->SetString("hostname", site_usage.hostname()); 56 usage->SetString("hostname", site_usage.hostname());
54 usage->SetDouble("data_used", site_usage.data_used()); 57 usage->SetDouble("data_used", site_usage.data_used());
55 usage->SetDouble("original_size", site_usage.original_size()); 58 usage->SetDouble("original_size", site_usage.original_size());
56 site_usage_list->Append(std::move(usage)); 59 site_usage_list->Append(std::move(usage));
57 } 60 }
58 connection_usage_list->Append(std::move(site_usage_list)); 61 connection_usage_list->Append(std::move(site_usage_list));
59 } 62 }
60 data_usage_buckets->Append(std::move(connection_usage_list)); 63 data_usage_buckets->Append(std::move(connection_usage_list));
61 } 64 }
62 65
63 base::DictionaryValue* result = new base::DictionaryValue(); 66 base::DictionaryValue* result = new base::DictionaryValue();
64 result->Set("data_usage_buckets", std::move(data_usage_buckets)); 67 result->Set("data_usage_buckets", std::move(data_usage_buckets));
65 Respond(OneArgument(result)); 68 Respond(OneArgument(result));
66 } 69 }
67 70
68 } // namespace extensions 71 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698