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

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

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent 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
« no previous file with comments | « content/shell/browser/shell_net_log.h ('k') | content/shell/browser/shell_platform_data_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/scoped_file.h" 12 #include "base/files/scoped_file.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "net/log/net_log_util.h" 16 #include "net/log/net_log_util.h"
17 #include "net/log/write_to_file_net_log_observer.h" 17 #include "net/log/write_to_file_net_log_observer.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 namespace { 21 namespace {
22 22
23 base::DictionaryValue* GetShellConstants(const std::string& app_name) { 23 base::DictionaryValue* GetShellConstants(const std::string& app_name) {
24 scoped_ptr<base::DictionaryValue> constants_dict = net::GetNetConstants(); 24 std::unique_ptr<base::DictionaryValue> constants_dict =
25 net::GetNetConstants();
25 26
26 // Add a dictionary with client information 27 // Add a dictionary with client information
27 base::DictionaryValue* dict = new base::DictionaryValue(); 28 base::DictionaryValue* dict = new base::DictionaryValue();
28 29
29 dict->SetString("name", app_name); 30 dict->SetString("name", app_name);
30 dict->SetString( 31 dict->SetString(
31 "command_line", 32 "command_line",
32 base::CommandLine::ForCurrentProcess()->GetCommandLineString()); 33 base::CommandLine::ForCurrentProcess()->GetCommandLineString());
33 34
34 constants_dict->Set("clientInfo", dict); 35 constants_dict->Set("clientInfo", dict);
(...skipping 22 matching lines...) Expand all
57 #if defined(OS_WIN) 58 #if defined(OS_WIN)
58 file.reset(_wfopen(log_path.value().c_str(), L"w")); 59 file.reset(_wfopen(log_path.value().c_str(), L"w"));
59 #elif defined(OS_POSIX) 60 #elif defined(OS_POSIX)
60 file.reset(fopen(log_path.value().c_str(), "w")); 61 file.reset(fopen(log_path.value().c_str(), "w"));
61 #endif 62 #endif
62 63
63 if (!file) { 64 if (!file) {
64 LOG(ERROR) << "Could not open file " << log_path.value() 65 LOG(ERROR) << "Could not open file " << log_path.value()
65 << " for net logging"; 66 << " for net logging";
66 } else { 67 } else {
67 scoped_ptr<base::Value> constants(GetShellConstants(app_name)); 68 std::unique_ptr<base::Value> constants(GetShellConstants(app_name));
68 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); 69 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver());
69 write_to_file_observer_->StartObserving(this, std::move(file), 70 write_to_file_observer_->StartObserving(this, std::move(file),
70 constants.get(), nullptr); 71 constants.get(), nullptr);
71 } 72 }
72 } 73 }
73 } 74 }
74 75
75 ShellNetLog::~ShellNetLog() { 76 ShellNetLog::~ShellNetLog() {
76 // Remove the observer we own before we're destroyed. 77 // Remove the observer we own before we're destroyed.
77 if (write_to_file_observer_) 78 if (write_to_file_observer_)
78 write_to_file_observer_->StopObserving(nullptr); 79 write_to_file_observer_->StopObserving(nullptr);
79 } 80 }
80 81
81 } // namespace content 82 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_net_log.h ('k') | content/shell/browser/shell_platform_data_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698