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

Side by Side Diff: content/browser/net/network_errors_listing_ui.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "content/browser/net/network_errors_listing_ui.h" 5 #include "content/browser/net/network_errors_listing_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/grit/content_resources.h" 10 #include "content/grit/content_resources.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/log/net_log_util.h" 14 #include "net/log/net_log_util.h"
15 15
16 static const char kDataFile[] = "network-error-data.json"; 16 static const char kDataFile[] = "network-error-data.json";
17 static const char kErrorCodeField[] = "errorCode"; 17 static const char kErrorCodeField[] = "errorCode";
18 static const char kErrorCodesDataName[] = "errorCodes"; 18 static const char kErrorCodesDataName[] = "errorCodes";
19 static const char kErrorIdField[] = "errorId"; 19 static const char kErrorIdField[] = "errorId";
20 static const char kNetworkErrorKey[] = "netError"; 20 static const char kNetworkErrorKey[] = "netError";
21 21
22 namespace content { 22 namespace content {
23 23
24 namespace { 24 namespace {
25 25
26 scoped_ptr<base::ListValue> GetNetworkErrorData() { 26 std::unique_ptr<base::ListValue> GetNetworkErrorData() {
27 scoped_ptr<base::DictionaryValue> error_codes = net::GetNetConstants(); 27 std::unique_ptr<base::DictionaryValue> error_codes = net::GetNetConstants();
28 const base::DictionaryValue* net_error_codes_dict = nullptr; 28 const base::DictionaryValue* net_error_codes_dict = nullptr;
29 29
30 for (base::DictionaryValue::Iterator itr(*error_codes); !itr.IsAtEnd(); 30 for (base::DictionaryValue::Iterator itr(*error_codes); !itr.IsAtEnd();
31 itr.Advance()) { 31 itr.Advance()) {
32 if (itr.key() == kNetworkErrorKey) { 32 if (itr.key() == kNetworkErrorKey) {
33 itr.value().GetAsDictionary(&net_error_codes_dict); 33 itr.value().GetAsDictionary(&net_error_codes_dict);
34 break; 34 break;
35 } 35 }
36 } 36 }
37 37
38 scoped_ptr<base::ListValue> error_list(new base::ListValue()); 38 std::unique_ptr<base::ListValue> error_list(new base::ListValue());
39 39
40 for (base::DictionaryValue::Iterator itr(*net_error_codes_dict); 40 for (base::DictionaryValue::Iterator itr(*net_error_codes_dict);
41 !itr.IsAtEnd(); itr.Advance()) { 41 !itr.IsAtEnd(); itr.Advance()) {
42 int error_code; 42 int error_code;
43 itr.value().GetAsInteger(&error_code); 43 itr.value().GetAsInteger(&error_code);
44 // Exclude the aborted and pending codes as these don't return a page. 44 // Exclude the aborted and pending codes as these don't return a page.
45 if (error_code != net::Error::ERR_IO_PENDING && 45 if (error_code != net::Error::ERR_IO_PENDING &&
46 error_code != net::Error::ERR_ABORTED) { 46 error_code != net::Error::ERR_ABORTED) {
47 base::DictionaryValue* error = new base::DictionaryValue(); 47 base::DictionaryValue* error = new base::DictionaryValue();
48 error->SetInteger(kErrorIdField, error_code); 48 error->SetInteger(kErrorIdField, error_code);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 html_source->SetRequestFilter( 85 html_source->SetRequestFilter(
86 base::Bind(&HandleRequestCallback, 86 base::Bind(&HandleRequestCallback,
87 web_ui->GetWebContents()->GetBrowserContext())); 87 web_ui->GetWebContents()->GetBrowserContext()));
88 88
89 BrowserContext* browser_context = 89 BrowserContext* browser_context =
90 web_ui->GetWebContents()->GetBrowserContext(); 90 web_ui->GetWebContents()->GetBrowserContext();
91 WebUIDataSource::Add(browser_context, html_source); 91 WebUIDataSource::Add(browser_context, html_source);
92 } 92 }
93 93
94 } // namespace content 94 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo_shell_browsertest.cc ('k') | content/browser/net/quota_policy_cookie_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698