Commit c0e39d57 authored by dcheng's avatar dcheng Committed by Commit bot
Browse files

Convert //chrome from scoped_ptr to std::unique_ptr

BUG=554298
NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/1899083002

Cr-Commit-Position: refs/heads/master@{#388145}
parent 2a0e8dac
......@@ -5,8 +5,9 @@
#ifndef CHROME_APP_ANDROID_CHROME_MAIN_DELEGATE_ANDROID_H_
#define CHROME_APP_ANDROID_CHROME_MAIN_DELEGATE_ANDROID_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/app/chrome_main_delegate.h"
#include "content/public/browser/browser_main_runner.h"
......@@ -35,10 +36,11 @@ class ChromeMainDelegateAndroid : public ChromeMainDelegate {
#endif
private:
scoped_ptr<content::BrowserMainRunner> browser_runner_;
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
#if defined(SAFE_BROWSING_DB_REMOTE)
scoped_ptr<safe_browsing::SafeBrowsingApiHandler> safe_browsing_api_handler_;
std::unique_ptr<safe_browsing::SafeBrowsingApiHandler>
safe_browsing_api_handler_;
#endif
DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegateAndroid);
......
......@@ -78,7 +78,7 @@ bool ChromeCrashReporterClient::GetAlternativeCrashDumpLocation(
base::FilePath* crash_dir) {
// By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
// location to write breakpad crash dumps can be set.
scoped_ptr<base::Environment> env(base::Environment::Create());
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string alternate_crash_dump_location;
if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) {
*crash_dir = base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location);
......@@ -99,7 +99,7 @@ void ChromeCrashReporterClient::GetProductNameAndVersion(
DCHECK(special_build);
DCHECK(channel_name);
scoped_ptr<FileVersionInfo> version_info(
std::unique_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(exe_path));
if (version_info.get()) {
......@@ -123,7 +123,7 @@ void ChromeCrashReporterClient::GetProductNameAndVersion(
bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title,
base::string16* message,
bool* is_rtl_locale) {
scoped_ptr<base::Environment> env(base::Environment::Create());
std::unique_ptr<base::Environment> env(base::Environment::Create());
if (!env->HasVar(env_vars::kShowRestart) ||
!env->HasVar(env_vars::kRestartInfo) ||
env->HasVar(env_vars::kMetroConnected)) {
......@@ -149,7 +149,7 @@ bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title,
}
bool ChromeCrashReporterClient::AboutToRestart() {
scoped_ptr<base::Environment> env(base::Environment::Create());
std::unique_ptr<base::Environment> env(base::Environment::Create());
if (!env->HasVar(env_vars::kRestartInfo))
return false;
......@@ -282,7 +282,7 @@ bool ChromeCrashReporterClient::GetCrashDumpLocation(
base::FilePath* crash_dir) {
// By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
// location to write breakpad crash dumps can be set.
scoped_ptr<base::Environment> env(base::Environment::Create());
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string alternate_crash_dump_location;
if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) {
base::FilePath crash_dumps_dir_path =
......@@ -314,7 +314,7 @@ size_t ChromeCrashReporterClient::RegisterCrashKeys() {
}
bool ChromeCrashReporterClient::IsRunningUnattended() {
scoped_ptr<base::Environment> env(base::Environment::Create());
std::unique_ptr<base::Environment> env(base::Environment::Create());
return env->HasVar(env_vars::kHeadless);
}
......
......@@ -7,9 +7,10 @@
#include <stddef.h>
#include <memory>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "components/crash/content/app/crash_reporter_client.h"
......@@ -74,7 +75,8 @@ class ChromeCrashReporterClient : public crash_reporter::CrashReporterClient {
private:
#if defined(OS_WIN)
scoped_ptr<browser_watcher::CrashReportingMetrics> crash_reporting_metrics_;
std::unique_ptr<browser_watcher::CrashReportingMetrics>
crash_reporting_metrics_;
#endif
DISALLOW_COPY_AND_ASSIGN(ChromeCrashReporterClient);
......
......@@ -364,7 +364,7 @@ void InitializeUserDataDir() {
// support the virtual desktop use-case.
if (user_data_dir.empty()) {
std::string user_data_dir_string;
scoped_ptr<base::Environment> environment(base::Environment::Create());
std::unique_ptr<base::Environment> environment(base::Environment::Create());
if (environment->GetVar("CHROME_USER_DATA_DIR", &user_data_dir_string) &&
base::IsStringUTF8(user_data_dir_string)) {
user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string);
......
......@@ -5,8 +5,9 @@
#ifndef CHROME_APP_CHROME_MAIN_DELEGATE_H_
#define CHROME_APP_CHROME_MAIN_DELEGATE_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/common/chrome_content_client.h"
#include "content/public/app/content_main_delegate.h"
......
......@@ -114,7 +114,7 @@ ChromeWatcherCommandLine::~ChromeWatcherCommandLine() {
<< "Handles left untaken.";
}
scoped_ptr<ChromeWatcherCommandLine>
std::unique_ptr<ChromeWatcherCommandLine>
ChromeWatcherCommandLine::InterpretCommandLine(
const base::CommandLine& command_line) {
base::win::ScopedHandle on_initialized_event_handle;
......@@ -126,9 +126,9 @@ ChromeWatcherCommandLine::InterpretCommandLine(
if (!InterpretChromeWatcherCommandLine(
command_line, &parent_process_handle, &main_thread_id,
&on_initialized_event_handle))
return scoped_ptr<ChromeWatcherCommandLine>();
return std::unique_ptr<ChromeWatcherCommandLine>();
return scoped_ptr<ChromeWatcherCommandLine>(new ChromeWatcherCommandLine(
return std::unique_ptr<ChromeWatcherCommandLine>(new ChromeWatcherCommandLine(
on_initialized_event_handle.Take(), parent_process_handle.Take(),
main_thread_id));
}
......
......@@ -6,11 +6,12 @@
#define CHROME_APP_CHROME_WATCHER_COMMAND_LINE_WIN_H_
#include <windows.h>
#include <memory>
#include <vector>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/win/scoped_handle.h"
// Class for configuring the Chrome watcher process via the command-line. This
......@@ -75,7 +76,7 @@ class ChromeWatcherCommandLine {
// If this fails any successfully opened handles will be closed prior to
// return. Returns a ChromeWatcherCommandLine object on success, nullptr
// otherwise.
static scoped_ptr<ChromeWatcherCommandLine> InterpretCommandLine(
static std::unique_ptr<ChromeWatcherCommandLine> InterpretCommandLine(
const base::CommandLine& command_line);
// Accessors for handles. Any handles not taken from this object at the time
......
......@@ -84,7 +84,7 @@ class ChromeWatcherCommandLineTest : public testing::Test {
base::win::ScopedHandle event_;
TestChromeWatcherCommandLineGenerator generator_;
base::CommandLine cmd_line_;
scoped_ptr<ChromeWatcherCommandLine> interpreted_;
std::unique_ptr<ChromeWatcherCommandLine> interpreted_;
};
// The corresponding death test fixture.
......
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/app/main_dll_loader_win.h"
#include <windows.h> // NOLINT
#include <shlwapi.h> // NOLINT
#include <stddef.h>
#include <userenv.h> // NOLINT
#include "chrome/app/main_dll_loader_win.h"
#include <memory>
#include "base/base_paths.h"
#include "base/base_switches.h"
......@@ -17,7 +19,6 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
......@@ -212,9 +213,9 @@ class ChromeDllLoader : public MainDllLoader {
int OnBeforeExit(int return_code, const base::FilePath& dll_path) override;
private:
scoped_ptr<ChromeWatcherClient> chrome_watcher_client_;
std::unique_ptr<ChromeWatcherClient> chrome_watcher_client_;
#if BUILDFLAG(ENABLE_KASKO)
scoped_ptr<KaskoClient> kasko_client_;
std::unique_ptr<KaskoClient> kasko_client_;
#endif
};
......
......@@ -83,7 +83,8 @@ class DefaultShellClient : public shell::ShellClient,
private:
// TODO(sky): move this into mash.
scoped_ptr<shell::ShellClient> CreateShellClient(const std::string& name) {
std::unique_ptr<shell::ShellClient> CreateShellClient(
const std::string& name) {
if (name == "mojo:ash_sysui")
return base::WrapUnique(new ash::sysui::SysUIApplication);
if (name == "mojo:desktop_wm")
......@@ -112,8 +113,8 @@ class DefaultShellClient : public shell::ShellClient,
}
mojo::BindingSet<ShellClientFactory> shell_client_factory_bindings_;
scoped_ptr<shell::ShellClient> shell_client_;
scoped_ptr<shell::ShellConnection> shell_connection_;
std::unique_ptr<shell::ShellClient> shell_client_;
std::unique_ptr<shell::ShellConnection> shell_connection_;
DISALLOW_COPY_AND_ASSIGN(DefaultShellClient);
};
......@@ -188,7 +189,7 @@ void MashRunner::RunMain() {
// in chrome.
NativeRunnerDelegateImpl native_runner_delegate;
shell::BackgroundShell background_shell;
scoped_ptr<shell::BackgroundShell::InitParams> init_params(
std::unique_ptr<shell::BackgroundShell::InitParams> init_params(
new shell::BackgroundShell::InitParams);
init_params->native_runner_delegate = &native_runner_delegate;
background_shell.Init(std::move(init_params));
......@@ -231,7 +232,7 @@ int MashMain() {
true); // Tick count
// TODO(sky): use MessagePumpMojo.
scoped_ptr<base::MessageLoop> message_loop;
std::unique_ptr<base::MessageLoop> message_loop;
#if defined(OS_LINUX)
base::AtExitManager exit_manager;
#endif
......
......@@ -5,8 +5,9 @@
#ifndef CHROME_APP_MASH_MASH_RUNNER_H_
#define CHROME_APP_MASH_MASH_RUNNER_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "services/shell/public/interfaces/shell_client.mojom.h"
namespace shell {
......@@ -28,8 +29,8 @@ class MashRunner {
void StartChildApp(shell::mojom::ShellClientRequest client_request);
scoped_ptr<shell::ShellClient> shell_client_;
scoped_ptr<shell::ShellConnection> shell_connection_;
std::unique_ptr<shell::ShellClient> shell_client_;
std::unique_ptr<shell::ShellConnection> shell_connection_;
DISALLOW_COPY_AND_ASSIGN(MashRunner);
};
......
......@@ -141,7 +141,7 @@ class AppShimController : public IPC::Listener {
void Close();
base::FilePath user_data_dir_;
scoped_ptr<IPC::ChannelProxy> channel_;
std::unique_ptr<IPC::ChannelProxy> channel_;
base::scoped_nsobject<AppShimDelegate> delegate_;
bool launch_app_done_;
bool ping_chrome_reply_received_;
......
......@@ -9,12 +9,12 @@
// inline code (which shouldn't be inline).
#include <list>
#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
......
......@@ -4,10 +4,10 @@
#include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h"
#include <memory>
#include <utility>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -4,8 +4,9 @@
#include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h"
#include <memory>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/time/time.h"
#include "net/cookies/cookie_options.h"
......
......@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_DOM_DISTILLER_LAZY_DOM_DISTILLER_SERVICE_H_
#define CHROME_BROWSER_DOM_DISTILLER_LAZY_DOM_DISTILLER_SERVICE_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
#include "components/dom_distiller/core/task_tracker.h"
#include "content/public/browser/notification_observer.h"
......
......@@ -4,10 +4,11 @@
#include <stddef.h>
#include <memory>
#include "base/command_line.h"
#include "base/environment.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "ui/base/ui_base_switches.h"
......
......@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/win/windows_version.h"
#include "build/build_config.h"
......
......@@ -12,6 +12,8 @@
#include <stddef.h>
#include <memory>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
......@@ -19,7 +21,6 @@
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
......
......@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
#define CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "chrome/browser/interstitials/security_interstitial_page.h"
#include "chrome/browser/ssl/ssl_cert_reporter.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment