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

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

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 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
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 <memory>
8 #include <utility>
9
7 #include "base/bind.h" 10 #include "base/bind.h"
8 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
9 #include "base/values.h" 12 #include "base/values.h"
10 #include "content/grit/content_resources.h" 13 #include "content/grit/content_resources.h"
11 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
12 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
13 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
14 #include "net/log/net_log_util.h" 17 #include "net/log/net_log_util.h"
15 18
16 static const char kDataFile[] = "network-error-data.json"; 19 static const char kDataFile[] = "network-error-data.json";
(...skipping 20 matching lines...) Expand all
37 40
38 std::unique_ptr<base::ListValue> error_list(new base::ListValue()); 41 std::unique_ptr<base::ListValue> error_list(new base::ListValue());
39 42
40 for (base::DictionaryValue::Iterator itr(*net_error_codes_dict); 43 for (base::DictionaryValue::Iterator itr(*net_error_codes_dict);
41 !itr.IsAtEnd(); itr.Advance()) { 44 !itr.IsAtEnd(); itr.Advance()) {
42 int error_code; 45 int error_code;
43 itr.value().GetAsInteger(&error_code); 46 itr.value().GetAsInteger(&error_code);
44 // Exclude the aborted and pending codes as these don't return a page. 47 // Exclude the aborted and pending codes as these don't return a page.
45 if (error_code != net::Error::ERR_IO_PENDING && 48 if (error_code != net::Error::ERR_IO_PENDING &&
46 error_code != net::Error::ERR_ABORTED) { 49 error_code != net::Error::ERR_ABORTED) {
47 base::DictionaryValue* error = new base::DictionaryValue(); 50 std::unique_ptr<base::DictionaryValue> error(new base::DictionaryValue());
48 error->SetInteger(kErrorIdField, error_code); 51 error->SetInteger(kErrorIdField, error_code);
49 error->SetString(kErrorCodeField, itr.key()); 52 error->SetString(kErrorCodeField, itr.key());
50 error_list->Append(error); 53 error_list->Append(std::move(error));
51 } 54 }
52 } 55 }
53 return error_list; 56 return error_list;
54 } 57 }
55 58
56 bool HandleRequestCallback(BrowserContext* current_context, 59 bool HandleRequestCallback(BrowserContext* current_context,
57 const std::string& path, 60 const std::string& path,
58 const WebUIDataSource::GotDataCallback& callback) { 61 const WebUIDataSource::GotDataCallback& callback) {
59 if (path != kDataFile) 62 if (path != kDataFile)
60 return false; 63 return false;
(...skipping 24 matching lines...) Expand all
85 html_source->SetRequestFilter( 88 html_source->SetRequestFilter(
86 base::Bind(&HandleRequestCallback, 89 base::Bind(&HandleRequestCallback,
87 web_ui->GetWebContents()->GetBrowserContext())); 90 web_ui->GetWebContents()->GetBrowserContext()));
88 91
89 BrowserContext* browser_context = 92 BrowserContext* browser_context =
90 web_ui->GetWebContents()->GetBrowserContext(); 93 web_ui->GetWebContents()->GetBrowserContext();
91 WebUIDataSource::Add(browser_context, html_source); 94 WebUIDataSource::Add(browser_context, html_source);
92 } 95 }
93 96
94 } // namespace content 97 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_internals.cc ('k') | content/browser/service_worker/service_worker_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698