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

Side by Side Diff: chromecast/browser/cast_net_log.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix 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 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 "chromecast/browser/cast_net_log.h" 5 #include "chromecast/browser/cast_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 "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
15 #include "net/log/net_log_util.h" 17 #include "net/log/net_log_util.h"
16 #include "net/log/write_to_file_net_log_observer.h" 18 #include "net/log/write_to_file_net_log_observer.h"
17 19
18 namespace chromecast { 20 namespace chromecast {
19 21
20 namespace { 22 namespace {
21 23
22 base::DictionaryValue* GetShellConstants() { 24 std::unique_ptr<base::DictionaryValue> GetShellConstants() {
23 std::unique_ptr<base::DictionaryValue> constants_dict = 25 std::unique_ptr<base::DictionaryValue> constants_dict =
24 net::GetNetConstants(); 26 net::GetNetConstants();
25 27
26 // Add a dictionary with client information 28 // Add a dictionary with client information
27 base::DictionaryValue* dict = new base::DictionaryValue(); 29 auto dict = base::MakeUnique<base::DictionaryValue>();
28 30
29 dict->SetString("name", "cast_shell"); 31 dict->SetString("name", "cast_shell");
30 dict->SetString( 32 dict->SetString(
31 "command_line", 33 "command_line",
32 base::CommandLine::ForCurrentProcess()->GetCommandLineString()); 34 base::CommandLine::ForCurrentProcess()->GetCommandLineString());
33 35
34 constants_dict->Set("clientInfo", dict); 36 constants_dict->Set("clientInfo", std::move(dict));
35 37
36 return constants_dict.release(); 38 return constants_dict;
37 } 39 }
38 40
39 } // namespace 41 } // namespace
40 42
41 CastNetLog::CastNetLog() { 43 CastNetLog::CastNetLog() {
42 // TODO(derekjchow): This code is virtually identical to ShellNetLog which is 44 // TODO(derekjchow): This code is virtually identical to ShellNetLog which is
43 // nearly identical to code in ChromeNetLog. Consider merging the code. 45 // nearly identical to code in ChromeNetLog. Consider merging the code.
44 const base::CommandLine* command_line = 46 const base::CommandLine* command_line =
45 base::CommandLine::ForCurrentProcess(); 47 base::CommandLine::ForCurrentProcess();
46 48
(...skipping 21 matching lines...) Expand all
68 } 70 }
69 } 71 }
70 72
71 CastNetLog::~CastNetLog() { 73 CastNetLog::~CastNetLog() {
72 // Remove the observer we own before we're destroyed. 74 // Remove the observer we own before we're destroyed.
73 if (write_to_file_observer_) 75 if (write_to_file_observer_)
74 write_to_file_observer_->StopObserving(nullptr); 76 write_to_file_observer_->StopObserving(nullptr);
75 } 77 }
76 78
77 } // namespace chromecast 79 } // namespace chromecast
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/server/http_handler.cc ('k') | chromeos/dbus/fake_shill_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698