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

Side by Side Diff: content/shell/browser/shell_net_log.cc

Issue 2891933004: Remove raw base::DictionaryValue::Set in //content (Closed)
Patch Set: Rebase Created 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shell/browser/shell_net_log.h" 5 #include "content/shell/browser/shell_net_log.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
14 #include "base/memory/ptr_util.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "build/build_config.h" 16 #include "build/build_config.h"
15 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
16 #include "net/log/net_log_util.h" 18 #include "net/log/net_log_util.h"
17 #include "net/log/write_to_file_net_log_observer.h" 19 #include "net/log/write_to_file_net_log_observer.h"
18 20
19 namespace content { 21 namespace content {
20 22
21 namespace { 23 namespace {
22 24
23 base::DictionaryValue* GetShellConstants(const std::string& app_name) { 25 std::unique_ptr<base::DictionaryValue> GetShellConstants(
26 const std::string& app_name) {
24 std::unique_ptr<base::DictionaryValue> constants_dict = 27 std::unique_ptr<base::DictionaryValue> constants_dict =
25 net::GetNetConstants(); 28 net::GetNetConstants();
26 29
27 // Add a dictionary with client information 30 // Add a dictionary with client information
28 base::DictionaryValue* dict = new base::DictionaryValue(); 31 auto dict = base::MakeUnique<base::DictionaryValue>();
29 32
30 dict->SetString("name", app_name); 33 dict->SetString("name", app_name);
31 dict->SetString( 34 dict->SetString(
32 "command_line", 35 "command_line",
33 base::CommandLine::ForCurrentProcess()->GetCommandLineString()); 36 base::CommandLine::ForCurrentProcess()->GetCommandLineString());
34 37
35 constants_dict->Set("clientInfo", dict); 38 constants_dict->Set("clientInfo", std::move(dict));
36 39
37 return constants_dict.release(); 40 return constants_dict;
38 } 41 }
39 42
40 } // namespace 43 } // namespace
41 44
42 ShellNetLog::ShellNetLog(const std::string& app_name) { 45 ShellNetLog::ShellNetLog(const std::string& app_name) {
43 // TODO(mmenke): Other than a different set of constants, this code is 46 // TODO(mmenke): Other than a different set of constants, this code is
44 // identical to code in ChromeNetLog. Consider merging the code. 47 // identical to code in ChromeNetLog. Consider merging the code.
45 const base::CommandLine* command_line = 48 const base::CommandLine* command_line =
46 base::CommandLine::ForCurrentProcess(); 49 base::CommandLine::ForCurrentProcess();
47 50
(...skipping 25 matching lines...) Expand all
73 } 76 }
74 } 77 }
75 78
76 ShellNetLog::~ShellNetLog() { 79 ShellNetLog::~ShellNetLog() {
77 // Remove the observer we own before we're destroyed. 80 // Remove the observer we own before we're destroyed.
78 if (write_to_file_observer_) 81 if (write_to_file_observer_)
79 write_to_file_observer_->StopObserving(nullptr); 82 write_to_file_observer_->StopObserving(nullptr);
80 } 83 }
81 84
82 } // namespace content 85 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_devtools_bindings.cc ('k') | content/shell/renderer/layout_test/leak_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698