Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr
BUG=554298
Review URL: https://codereview.chromium.org/1871713002
Cr-Commit-Position: refs/heads/master@{#385980}
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc
index 1950d8c..9a0908a 100644
--- a/chrome/browser/extensions/active_tab_unittest.cc
+++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -2,11 +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 <string>
#include <utility>
#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
diff --git a/chrome/browser/extensions/activity_log/activity_actions.cc b/chrome/browser/extensions/activity_log/activity_actions.cc
index 02ec8715..1e68a0fa 100644
--- a/chrome/browser/extensions/activity_log/activity_actions.cc
+++ b/chrome/browser/extensions/activity_log/activity_actions.cc
@@ -8,6 +8,7 @@
#include "base/format_macros.h"
#include "base/json/json_string_value_serializer.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -64,18 +65,18 @@
new Action(
extension_id(), time(), action_type(), api_name(), action_id()));
if (args())
- clone->set_args(make_scoped_ptr(args()->DeepCopy()));
+ clone->set_args(base::WrapUnique(args()->DeepCopy()));
clone->set_page_url(page_url());
clone->set_page_title(page_title());
clone->set_page_incognito(page_incognito());
clone->set_arg_url(arg_url());
clone->set_arg_incognito(arg_incognito());
if (other())
- clone->set_other(make_scoped_ptr(other()->DeepCopy()));
+ clone->set_other(base::WrapUnique(other()->DeepCopy()));
return clone;
}
-void Action::set_args(scoped_ptr<base::ListValue> args) {
+void Action::set_args(std::unique_ptr<base::ListValue> args) {
args_.reset(args.release());
}
@@ -94,7 +95,7 @@
arg_url_ = arg_url;
}
-void Action::set_other(scoped_ptr<base::DictionaryValue> other) {
+void Action::set_other(std::unique_ptr<base::DictionaryValue> other) {
other_.reset(other.release());
}
@@ -183,7 +184,7 @@
result.arg_url.reset(new std::string(SerializeArgUrl()));
if (other()) {
- scoped_ptr<ExtensionActivity::Other> other_field(
+ std::unique_ptr<ExtensionActivity::Other> other_field(
new ExtensionActivity::Other);
bool prerender;
if (other()->GetBooleanWithoutPathExpansion(constants::kActionPrerender,
diff --git a/chrome/browser/extensions/activity_log/activity_actions.h b/chrome/browser/extensions/activity_log/activity_actions.h
index b0c141a8..900b19b 100644
--- a/chrome/browser/extensions/activity_log/activity_actions.h
+++ b/chrome/browser/extensions/activity_log/activity_actions.h
@@ -78,7 +78,7 @@
// can be modified in place; if the list was null an empty list is created
// first.
const base::ListValue* args() const { return args_.get(); }
- void set_args(scoped_ptr<base::ListValue> args);
+ void set_args(std::unique_ptr<base::ListValue> args);
base::ListValue* mutable_args();
// The URL of the page which was modified or accessed.
@@ -102,7 +102,7 @@
// A dictionary where any additional data can be stored.
const base::DictionaryValue* other() const { return other_.get(); }
- void set_other(scoped_ptr<base::DictionaryValue> other);
+ void set_other(std::unique_ptr<base::DictionaryValue> other);
base::DictionaryValue* mutable_other();
// An ID that identifies an action stored in the Activity Log database. If the
@@ -138,13 +138,13 @@
base::Time time_;
ActionType action_type_;
std::string api_name_;
- scoped_ptr<base::ListValue> args_;
+ std::unique_ptr<base::ListValue> args_;
GURL page_url_;
std::string page_title_;
bool page_incognito_;
GURL arg_url_;
bool arg_incognito_;
- scoped_ptr<base::DictionaryValue> other_;
+ std::unique_ptr<base::DictionaryValue> other_;
int count_;
int64_t action_id_;
diff --git a/chrome/browser/extensions/activity_log/activity_database_unittest.cc b/chrome/browser/extensions/activity_log/activity_database_unittest.cc
index 9608923..62f948aa 100644
--- a/chrome/browser/extensions/activity_log/activity_database_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_database_unittest.cc
@@ -166,7 +166,7 @@
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
ActivityDatabaseTestPolicy* db_delegate_;
diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc
index 0f9d04a..0a5e843 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -578,9 +578,10 @@
}
}
-void ActivityLog::OnApiEventDispatched(const std::string& extension_id,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
+void ActivityLog::OnApiEventDispatched(
+ const std::string& extension_id,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_refptr<Action> action = new Action(extension_id,
base::Time::Now(),
@@ -592,7 +593,7 @@
void ActivityLog::OnApiFunctionCalled(const std::string& extension_id,
const std::string& api_name,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_refptr<Action> action = new Action(extension_id,
base::Time::Now(),
@@ -611,8 +612,8 @@
const std::string& page_url,
const std::string& arg_url,
const int daysAgo,
- const base::Callback
- <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) {
+ const base::Callback<
+ void(std::unique_ptr<std::vector<scoped_refptr<Action>>>)>& callback) {
if (database_policy_) {
database_policy_->ReadFilteredData(
extension_id, type, api_name, page_url, arg_url, daysAgo, callback);
diff --git a/chrome/browser/extensions/activity_log/activity_log.h b/chrome/browser/extensions/activity_log/activity_log.h
index dab84d1..567cda8 100644
--- a/chrome/browser/extensions/activity_log/activity_log.h
+++ b/chrome/browser/extensions/activity_log/activity_log.h
@@ -84,8 +84,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback
- <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback);
+ const base::Callback<
+ void(std::unique_ptr<std::vector<scoped_refptr<Action>>>)>& callback);
// ExtensionRegistryObserver.
// We keep track of whether the whitelisted extension is installed; if it is,
@@ -100,12 +100,14 @@
extensions::UninstallReason reason) override;
// ApiActivityMonitor.
- void OnApiEventDispatched(const std::string& extension_id,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) override;
- void OnApiFunctionCalled(const std::string& extension_id,
- const std::string& api_name,
- scoped_ptr<base::ListValue> event_args) override;
+ void OnApiEventDispatched(
+ const std::string& extension_id,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args) override;
+ void OnApiFunctionCalled(
+ const std::string& extension_id,
+ const std::string& api_name,
+ std::unique_ptr<base::ListValue> event_args) override;
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
diff --git a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc
index 4069efd..fe597714 100644
--- a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc
@@ -41,7 +41,7 @@
static void Prerender_Arguments(
const std::string& extension_id,
uint16_t port,
- scoped_ptr<std::vector<scoped_refptr<Action>>> i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
// This is to exit RunLoop (base::MessageLoop::current()->Run()) below
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
@@ -105,7 +105,7 @@
port));
const gfx::Size kSize(640, 480);
- scoped_ptr<prerender::PrerenderHandle> prerender_handle(
+ std::unique_ptr<prerender::PrerenderHandle> prerender_handle(
prerender_manager->AddPrerenderFromOmnibox(
url,
web_contents->GetController().GetDefaultSessionStorageNamespace(),
diff --git a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc
index e3f9eadc..7d42b96f 100644
--- a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc
@@ -45,13 +45,13 @@
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
};
TEST_F(ActivityLogEnabledTest, NoSwitch) {
- scoped_ptr<TestingProfile> profile(
- static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
EXPECT_FALSE(
profile->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive));
@@ -64,10 +64,10 @@
}
TEST_F(ActivityLogEnabledTest, CommandLineSwitch) {
- scoped_ptr<TestingProfile> profile1(
- static_cast<TestingProfile*>(CreateBrowserContext()));
- scoped_ptr<TestingProfile> profile2(
- static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile1(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile2(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
base::CommandLine saved_cmdline_ = *base::CommandLine::ForCurrentProcess();
@@ -88,12 +88,12 @@
}
TEST_F(ActivityLogEnabledTest, PrefSwitch) {
- scoped_ptr<TestingProfile> profile1(
- static_cast<TestingProfile*>(CreateBrowserContext()));
- scoped_ptr<TestingProfile> profile2(
- static_cast<TestingProfile*>(CreateBrowserContext()));
- scoped_ptr<TestingProfile> profile3(
- static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile1(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile2(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile3(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
EXPECT_EQ(0,
profile1->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive));
@@ -124,10 +124,10 @@
TEST_F(ActivityLogEnabledTest, WatchdogSwitch) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
- scoped_ptr<TestingProfile> profile1(
- static_cast<TestingProfile*>(CreateBrowserContext()));
- scoped_ptr<TestingProfile> profile2(
- static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile1(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile2(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
// Extension service is destroyed by the profile.
ExtensionService* extension_service1 =
static_cast<TestExtensionSystem*>(
@@ -235,8 +235,8 @@
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExtensionActivityLogging);
- scoped_ptr<TestingProfile> profile(
- static_cast<TestingProfile*>(CreateBrowserContext()));
+ std::unique_ptr<TestingProfile> profile(
+ static_cast<TestingProfile*>(CreateBrowserContext()));
// Extension service is destroyed by the profile.
ExtensionService* extension_service =
static_cast<TestExtensionSystem*>(
diff --git a/chrome/browser/extensions/activity_log/activity_log_policy.cc b/chrome/browser/extensions/activity_log/activity_log_policy.cc
index 99ef17c..0d39f9c 100644
--- a/chrome/browser/extensions/activity_log/activity_log_policy.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_policy.cc
@@ -38,7 +38,7 @@
ActivityLogPolicy::~ActivityLogPolicy() {}
-void ActivityLogPolicy::SetClockForTesting(scoped_ptr<base::Clock> clock) {
+void ActivityLogPolicy::SetClockForTesting(std::unique_ptr<base::Clock> clock) {
testing_clock_.reset(clock.release());
}
@@ -134,7 +134,7 @@
if (api_whitelist.find(
std::make_pair(action->action_type(), action->api_name())) ==
api_whitelist.end()) {
- action->set_args(scoped_ptr<base::ListValue>());
+ action->set_args(std::unique_ptr<base::ListValue>());
}
}
diff --git a/chrome/browser/extensions/activity_log/activity_log_policy.h b/chrome/browser/extensions/activity_log/activity_log_policy.h
index dff6d7ac..997e34a2 100644
--- a/chrome/browser/extensions/activity_log/activity_log_policy.h
+++ b/chrome/browser/extensions/activity_log/activity_log_policy.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/activity_log/activity_actions.h"
#include "chrome/browser/extensions/activity_log/activity_database.h"
@@ -80,7 +80,7 @@
virtual void ProcessAction(scoped_refptr<Action> action) = 0;
// For unit testing only.
- void SetClockForTesting(scoped_ptr<base::Clock> clock);
+ void SetClockForTesting(std::unique_ptr<base::Clock> clock);
// A collection of methods that are useful for implementing policies. These
// are all static methods; the ActivityLogPolicy::Util class cannot be
@@ -144,7 +144,7 @@
// Support for a mock clock for testing purposes. This is used by ReadData
// to determine the date for "today" when when interpreting date ranges to
// fetch. This has no effect on batching of writes to the database.
- scoped_ptr<base::Clock> testing_clock_;
+ std::unique_ptr<base::Clock> testing_clock_;
DISALLOW_COPY_AND_ASSIGN(ActivityLogPolicy);
};
@@ -177,8 +177,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback
- <void(scoped_ptr<Action::ActionVector>)>& callback) = 0;
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ callback) = 0;
// Remove actions (rows) which IDs are in the action_ids array.
virtual void RemoveActions(const std::vector<int64_t>& action_ids) = 0;
diff --git a/chrome/browser/extensions/activity_log/activity_log_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
index 49bcafbd..e9b4ba3 100644
--- a/chrome/browser/extensions/activity_log/activity_log_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/activity_log/activity_log.h"
+
#include <stddef.h>
+#include <memory>
+
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/activity_log/activity_action_constants.h"
-#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/prerender/prerender_handle.h"
@@ -84,12 +86,12 @@
}
static void RetrieveActions_LogAndFetchActions0(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(0, static_cast<int>(i->size()));
}
static void RetrieveActions_LogAndFetchActions2(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(2, static_cast<int>(i->size()));
}
@@ -112,7 +114,7 @@
}
static void Arguments_Prerender(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(1U, i->size());
scoped_refptr<Action> last = i->front();
@@ -129,7 +131,7 @@
}
static void RetrieveActions_ArgUrlExtraction(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
const base::DictionaryValue* other = NULL;
int dom_verb = -1;
@@ -168,7 +170,7 @@
}
static void RetrieveActions_ArgUrlApiCalls(
- scoped_ptr<std::vector<scoped_refptr<Action> > > actions) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> actions) {
size_t api_calls_size = arraysize(kUrlApiCalls);
const base::DictionaryValue* other = NULL;
int dom_verb = -1;
@@ -196,7 +198,7 @@
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
};
@@ -207,7 +209,7 @@
TEST_F(ActivityLogTest, LogAndFetchActions) {
ActivityLog* activity_log = ActivityLog::GetInstance(profile());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
ASSERT_TRUE(GetDatabaseEnabled());
// Write some API calls
@@ -252,7 +254,7 @@
Profile::FromBrowserContext(profile()));
const gfx::Size kSize(640, 480);
- scoped_ptr<prerender::PrerenderHandle> prerender_handle(
+ std::unique_ptr<prerender::PrerenderHandle> prerender_handle(
prerender_manager->AddPrerenderFromOmnibox(
url,
web_contents()->GetController().GetDefaultSessionStorageNamespace(),
@@ -284,7 +286,7 @@
TEST_F(ActivityLogTest, ArgUrlExtraction) {
ActivityLog* activity_log = ActivityLog::GetInstance(profile());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::Time now = base::Time::Now();
@@ -359,7 +361,7 @@
.Build();
ActivityLog* activity_log = ActivityLog::GetInstance(profile());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
ASSERT_TRUE(GetDatabaseEnabled());
// Write some API calls
@@ -388,7 +390,7 @@
TEST_F(ActivityLogTest, ArgUrlApiCalls) {
ActivityLog* activity_log = ActivityLog::GetInstance(profile());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::Time now = base::Time::Now();
int api_calls_size = arraysize(kUrlApiCalls);
scoped_refptr<Action> action;
diff --git a/chrome/browser/extensions/activity_log/counting_policy.cc b/chrome/browser/extensions/activity_log/counting_policy.cc
index 92e31eb..8901d09 100644
--- a/chrome/browser/extensions/activity_log/counting_policy.cc
+++ b/chrome/browser/extensions/activity_log/counting_policy.cc
@@ -41,6 +41,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_string_value_serializer.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/common/chrome_constants.h"
@@ -421,7 +422,7 @@
return true;
}
-scoped_ptr<Action::ActionVector> CountingPolicy::DoReadFilteredData(
+std::unique_ptr<Action::ActionVector> CountingPolicy::DoReadFilteredData(
const std::string& extension_id,
const Action::ActionType type,
const std::string& api_name,
@@ -431,7 +432,7 @@
// Ensure data is flushed to the database first so that we query over all
// data.
activity_database()->AdviseFlush(ActivityDatabase::kFlushImmediately);
- scoped_ptr<Action::ActionVector> actions(new Action::ActionVector());
+ std::unique_ptr<Action::ActionVector> actions(new Action::ActionVector());
sql::Connection* db = GetDatabaseConnection();
if (!db)
@@ -499,10 +500,10 @@
query.ColumnString(3), query.ColumnInt64(10));
if (query.ColumnType(4) != sql::COLUMN_TYPE_NULL) {
- scoped_ptr<base::Value> parsed_value =
+ std::unique_ptr<base::Value> parsed_value =
base::JSONReader::Read(query.ColumnString(4));
if (parsed_value && parsed_value->IsType(base::Value::TYPE_LIST)) {
- action->set_args(make_scoped_ptr(
+ action->set_args(base::WrapUnique(
static_cast<base::ListValue*>(parsed_value.release())));
}
}
@@ -512,10 +513,10 @@
action->ParseArgUrl(query.ColumnString(7));
if (query.ColumnType(8) != sql::COLUMN_TYPE_NULL) {
- scoped_ptr<base::Value> parsed_value =
+ std::unique_ptr<base::Value> parsed_value =
base::JSONReader::Read(query.ColumnString(8));
if (parsed_value && parsed_value->IsType(base::Value::TYPE_DICTIONARY)) {
- action->set_other(make_scoped_ptr(
+ action->set_other(base::WrapUnique(
static_cast<base::DictionaryValue*>(parsed_value.release())));
}
}
@@ -724,8 +725,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback
- <void(scoped_ptr<Action::ActionVector>)>& callback) {
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ callback) {
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::DB,
FROM_HERE,
diff --git a/chrome/browser/extensions/activity_log/counting_policy.h b/chrome/browser/extensions/activity_log/counting_policy.h
index 26b090a5..33f24ec 100644
--- a/chrome/browser/extensions/activity_log/counting_policy.h
+++ b/chrome/browser/extensions/activity_log/counting_policy.h
@@ -37,8 +37,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& callback)
- override;
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ callback) override;
void Close() override;
@@ -89,7 +89,7 @@
// Internal method to read data from the database; called on the database
// thread.
- scoped_ptr<Action::ActionVector> DoReadFilteredData(
+ std::unique_ptr<Action::ActionVector> DoReadFilteredData(
const std::string& extension_id,
const Action::ActionType type,
const std::string& api_name,
diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
index 4eca1d9..8b08a4ab 100644
--- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
@@ -6,12 +6,14 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <memory>
#include <utility>
#include "base/cancelable_callback.h"
#include "base/command_line.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_split.h"
@@ -82,11 +84,11 @@
// A wrapper function for CheckReadFilteredData, so that we don't need to
// enter empty string values for parameters we don't care about.
- void CheckReadData(
- ActivityLogDatabasePolicy* policy,
- const std::string& extension_id,
- int day,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ void CheckReadData(ActivityLogDatabasePolicy* policy,
+ const std::string& extension_id,
+ int day,
+ const base::Callback<void(
+ std::unique_ptr<Action::ActionVector>)>& checker) {
CheckReadFilteredData(
policy, extension_id, Action::ACTION_ANY, "", "", "", day, checker);
}
@@ -101,7 +103,8 @@
const std::string& page_url,
const std::string& arg_url,
int day,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ checker) {
// Submit a request to the policy to read back some data, and call the
// checker function when results are available. This will happen on the
// database thread.
@@ -149,10 +152,10 @@
ASSERT_LE(policy->queued_actions_.size(), 200U);
}
- static void CheckWrapper(
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker,
- const base::Closure& done,
- scoped_ptr<Action::ActionVector> results) {
+ static void CheckWrapper(const base::Callback<void(
+ std::unique_ptr<Action::ActionVector>)>& checker,
+ const base::Closure& done,
+ std::unique_ptr<Action::ActionVector> results) {
checker.Run(std::move(results));
done.Run();
}
@@ -163,26 +166,26 @@
}
static void RetrieveActions_FetchFilteredActions0(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(0, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions1(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(1, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions2(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(2, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions300(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(300, static_cast<int>(i->size()));
}
- static void Arguments_Stripped(scoped_ptr<Action::ActionVector> i) {
+ static void Arguments_Stripped(std::unique_ptr<Action::ActionVector> i) {
scoped_refptr<Action> last = i->front();
CheckAction(*last.get(),
"odlameecjipmbmbejkplpemijjgpljce",
@@ -196,7 +199,7 @@
}
static void Arguments_GetSinglesAction(
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(1, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -210,7 +213,7 @@
}
static void Arguments_GetTodaysActions(
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(3, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -242,7 +245,7 @@
}
static void Arguments_GetOlderActions(
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -266,7 +269,7 @@
static void Arguments_CheckMergeCount(
int count,
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
if (count > 0) {
ASSERT_EQ(1u, actions->size());
CheckAction(*actions->at(0).get(),
@@ -286,7 +289,7 @@
static void Arguments_CheckMergeCountAndTime(
int count,
const base::Time& time,
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
if (count > 0) {
ASSERT_EQ(1u, actions->size());
CheckAction(*actions->at(0).get(),
@@ -304,7 +307,7 @@
}
}
- static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
+ static void AllURLsRemoved(std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -326,7 +329,7 @@
1);
}
- static void SomeURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
+ static void SomeURLsRemoved(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(5, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -376,7 +379,7 @@
1);
}
- static void CheckDuplicates(scoped_ptr<Action::ActionVector> actions) {
+ static void CheckDuplicates(std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2u, actions->size());
int total_count = 0;
for (size_t i = 0; i < actions->size(); i++) {
@@ -412,13 +415,14 @@
void CheckRemoveActions(
ActivityLogDatabasePolicy* policy,
const std::vector<int64_t>& action_ids,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ checker) {
// Use a mock clock to ensure that events are not recorded on the wrong day
// when the test is run close to local midnight.
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -459,11 +463,11 @@
policy->DeleteDatabase();
}
- static void AllActionsDeleted(scoped_ptr<Action::ActionVector> actions) {
+ static void AllActionsDeleted(std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(0, static_cast<int>(actions->size()));
}
- static void NoActionsDeleted(scoped_ptr<Action::ActionVector> actions) {
+ static void NoActionsDeleted(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -488,7 +492,7 @@
ASSERT_EQ(1, actions->at(1)->action_id());
}
- static void Action1Deleted(scoped_ptr<Action::ActionVector> actions) {
+ static void Action1Deleted(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(1, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -503,7 +507,7 @@
ASSERT_EQ(2, actions->at(0)->action_id());
}
- static void Action2Deleted(scoped_ptr<Action::ActionVector> actions) {
+ static void Action2Deleted(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(1, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -520,7 +524,7 @@
protected:
ExtensionService* extension_service_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
content::TestBrowserThreadBundle thread_bundle_;
// Used to preserve a copy of the original command line.
// The test framework will do this itself as well. However, by then,
@@ -531,7 +535,7 @@
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
};
@@ -547,7 +551,7 @@
.Build())
.Build();
extension_service_->AddExtension(extension.get());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
scoped_refptr<Action> action = new Action(extension->id(),
base::Time::Now(),
Action::ACTION_API_CALL,
@@ -570,7 +574,7 @@
.Build();
extension_service_->AddExtension(extension.get());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue("hello"));
args->Set(1, new base::StringValue("world"));
scoped_refptr<Action> action = new Action(extension->id(),
@@ -602,7 +606,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -659,7 +663,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -723,14 +727,14 @@
base::Time::Now(),
Action::ACTION_API_CALL,
"tabs.testMethod");
- action_api->set_args(make_scoped_ptr(new base::ListValue()));
+ action_api->set_args(base::WrapUnique(new base::ListValue()));
policy->ProcessAction(action_api);
scoped_refptr<Action> action_dom = new Action(extension->id(),
base::Time::Now(),
Action::ACTION_DOM_ACCESS,
"document.write");
- action_dom->set_args(make_scoped_ptr(new base::ListValue()));
+ action_dom->set_args(base::WrapUnique(new base::ListValue()));
action_dom->set_page_url(gurl);
policy->ProcessAction(action_dom);
@@ -817,7 +821,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// The first two actions should be merged; the last one is on a separate day
// and should not be.
@@ -884,7 +888,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now());
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Insert an action; this should create entries in both the string table (for
// the extension and API name) and the URL table (for page_url).
@@ -940,7 +944,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Create an action 2 days ago, then 1 day ago, then 2 days ago. Make sure
// that we end up with two merged records (one for each day), and each has
@@ -1063,7 +1067,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -1106,7 +1110,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
// This should have the page url and args url cleared.
@@ -1183,7 +1187,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action = new Action("deleteextensiondata",
@@ -1248,7 +1252,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -1344,7 +1348,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record two actions with distinct URLs.
scoped_refptr<Action> action;
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
index d63f08b..f00997b5 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
@@ -13,6 +13,7 @@
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/activity_log/activity_action_constants.h"
@@ -121,7 +122,7 @@
return true;
}
-scoped_ptr<Action::ActionVector> FullStreamUIPolicy::DoReadFilteredData(
+std::unique_ptr<Action::ActionVector> FullStreamUIPolicy::DoReadFilteredData(
const std::string& extension_id,
const Action::ActionType type,
const std::string& api_name,
@@ -131,7 +132,7 @@
// Ensure data is flushed to the database first so that we query over all
// data.
activity_database()->AdviseFlush(ActivityDatabase::kFlushImmediately);
- scoped_ptr<Action::ActionVector> actions(new Action::ActionVector());
+ std::unique_ptr<Action::ActionVector> actions(new Action::ActionVector());
sql::Connection* db = GetDatabaseConnection();
if (!db) {
@@ -197,10 +198,10 @@
query.ColumnString(3), query.ColumnInt64(9));
if (query.ColumnType(4) != sql::COLUMN_TYPE_NULL) {
- scoped_ptr<base::Value> parsed_value =
+ std::unique_ptr<base::Value> parsed_value =
base::JSONReader::Read(query.ColumnString(4));
if (parsed_value && parsed_value->IsType(base::Value::TYPE_LIST)) {
- action->set_args(make_scoped_ptr(
+ action->set_args(base::WrapUnique(
static_cast<base::ListValue*>(parsed_value.release())));
}
}
@@ -210,10 +211,10 @@
action->ParseArgUrl(query.ColumnString(7));
if (query.ColumnType(8) != sql::COLUMN_TYPE_NULL) {
- scoped_ptr<base::Value> parsed_value =
+ std::unique_ptr<base::Value> parsed_value =
base::JSONReader::Read(query.ColumnString(8));
if (parsed_value && parsed_value->IsType(base::Value::TYPE_DICTIONARY)) {
- action->set_other(make_scoped_ptr(
+ action->set_other(base::WrapUnique(
static_cast<base::DictionaryValue*>(parsed_value.release())));
}
}
@@ -398,8 +399,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback
- <void(scoped_ptr<Action::ActionVector>)>& callback) {
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ callback) {
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::DB,
FROM_HERE,
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy.h b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
index b4fa7bf..a85b93ec 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.h
@@ -37,8 +37,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& callback)
- override;
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ callback) override;
void Close() override;
@@ -105,7 +105,7 @@
// Internal method to read data from the database; called on the database
// thread.
- scoped_ptr<Action::ActionVector> DoReadFilteredData(
+ std::unique_ptr<Action::ActionVector> DoReadFilteredData(
const std::string& extension_id,
const Action::ActionType type,
const std::string& api_name,
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
index 1ce3fa8..c1509e4 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
@@ -5,12 +5,14 @@
#include "chrome/browser/extensions/activity_log/fullstream_ui_policy.h"
#include <stdint.h>
+
+#include <memory>
#include <utility>
#include "base/cancelable_callback.h"
#include "base/command_line.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
@@ -73,11 +75,11 @@
// A wrapper function for CheckReadFilteredData, so that we don't need to
// enter empty string values for parameters we don't care about.
- void CheckReadData(
- ActivityLogDatabasePolicy* policy,
- const std::string& extension_id,
- int day,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ void CheckReadData(ActivityLogDatabasePolicy* policy,
+ const std::string& extension_id,
+ int day,
+ const base::Callback<void(
+ std::unique_ptr<Action::ActionVector>)>& checker) {
CheckReadFilteredData(
policy, extension_id, Action::ACTION_ANY, "", "", "", day, checker);
}
@@ -92,7 +94,8 @@
const std::string& page_url,
const std::string& arg_url,
const int days_ago,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ checker) {
// Submit a request to the policy to read back some data, and call the
// checker function when results are available. This will happen on the
// database thread.
@@ -115,10 +118,10 @@
timeout.Cancel();
}
- static void CheckWrapper(
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker,
- const base::Closure& done,
- scoped_ptr<Action::ActionVector> results) {
+ static void CheckWrapper(const base::Callback<void(
+ std::unique_ptr<Action::ActionVector>)>& checker,
+ const base::Closure& done,
+ std::unique_ptr<Action::ActionVector> results) {
checker.Run(std::move(results));
done.Run();
}
@@ -129,31 +132,31 @@
}
static void RetrieveActions_LogAndFetchActions(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(2, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions0(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(0, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions1(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(1, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions2(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(2, static_cast<int>(i->size()));
}
static void RetrieveActions_FetchFilteredActions300(
- scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
ASSERT_EQ(300, static_cast<int>(i->size()));
}
- static void Arguments_Present(scoped_ptr<Action::ActionVector> i) {
+ static void Arguments_Present(std::unique_ptr<Action::ActionVector> i) {
scoped_refptr<Action> last = i->front();
CheckAction(*last.get(),
"odlameecjipmbmbejkplpemijjgpljce",
@@ -166,7 +169,7 @@
}
static void Arguments_GetTodaysActions(
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -187,7 +190,7 @@
}
static void Arguments_GetOlderActions(
- scoped_ptr<Action::ActionVector> actions) {
+ std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -207,7 +210,7 @@
"");
}
- static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
+ static void AllURLsRemoved(std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
"punky",
@@ -227,7 +230,7 @@
"");
}
- static void SomeURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
+ static void SomeURLsRemoved(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(5, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -297,13 +300,14 @@
void CheckRemoveActions(
ActivityLogDatabasePolicy* policy,
const std::vector<int64_t>& action_ids,
- const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ const base::Callback<void(std::unique_ptr<Action::ActionVector>)>&
+ checker) {
// Use a mock clock to ensure that events are not recorded on the wrong day
// when the test is run close to local midnight.
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -344,11 +348,11 @@
policy->DeleteDatabase();
}
- static void AllActionsDeleted(scoped_ptr<Action::ActionVector> actions) {
+ static void AllActionsDeleted(std::unique_ptr<Action::ActionVector> actions) {
ASSERT_EQ(0, static_cast<int>(actions->size()));
}
- static void NoActionsDeleted(scoped_ptr<Action::ActionVector> actions) {
+ static void NoActionsDeleted(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(4, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -389,7 +393,7 @@
ASSERT_EQ(2, actions->at(3)->action_id());
}
- static void Action1Deleted(scoped_ptr<Action::ActionVector> actions) {
+ static void Action1Deleted(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -412,7 +416,7 @@
ASSERT_EQ(4, actions->at(1)->action_id());
}
- static void Action2Deleted(scoped_ptr<Action::ActionVector> actions) {
+ static void Action2Deleted(std::unique_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0).get(),
@@ -437,7 +441,7 @@
protected:
ExtensionService* extension_service_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
content::TestBrowserThreadBundle thread_bundle_;
// Used to preserve a copy of the original command line.
// The test framework will do this itself as well. However, by then,
@@ -448,7 +452,7 @@
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
};
@@ -464,7 +468,7 @@
.Build())
.Build();
extension_service_->AddExtension(extension.get());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
scoped_refptr<Action> action = new Action(extension->id(),
base::Time::Now(),
Action::ACTION_API_CALL,
@@ -493,14 +497,14 @@
base::Time::Now(),
Action::ACTION_API_CALL,
"tabs.testMethod");
- action_api->set_args(make_scoped_ptr(new base::ListValue()));
+ action_api->set_args(base::WrapUnique(new base::ListValue()));
policy->ProcessAction(action_api);
scoped_refptr<Action> action_dom = new Action(extension->id(),
base::Time::Now(),
Action::ACTION_DOM_ACCESS,
"document.write");
- action_dom->set_args(make_scoped_ptr(new base::ListValue()));
+ action_dom->set_args(base::WrapUnique(new base::ListValue()));
action_dom->set_page_url(gurl);
policy->ProcessAction(action_dom);
@@ -532,14 +536,14 @@
base::Time::Now(),
Action::ACTION_API_CALL,
"tabs.testMethod");
- action_api->set_args(make_scoped_ptr(new base::ListValue()));
+ action_api->set_args(base::WrapUnique(new base::ListValue()));
policy->ProcessAction(action_api);
scoped_refptr<Action> action_dom = new Action(extension->id(),
base::Time::Now(),
Action::ACTION_DOM_ACCESS,
"document.write");
- action_dom->set_args(make_scoped_ptr(new base::ListValue()));
+ action_dom->set_args(base::WrapUnique(new base::ListValue()));
action_dom->set_page_url(gurl);
policy->ProcessAction(action_dom);
@@ -625,7 +629,7 @@
.Build();
extension_service_->AddExtension(extension.get());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue("hello"));
args->Set(1, new base::StringValue("world"));
scoped_refptr<Action> action = new Action(extension->id(),
@@ -654,7 +658,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -700,7 +704,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -753,7 +757,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action =
@@ -796,7 +800,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
// This should have the page url and args url cleared.
@@ -872,7 +876,7 @@
base::SimpleTestClock* mock_clock = new base::SimpleTestClock();
mock_clock->SetNow(base::Time::Now().LocalMidnight() +
base::TimeDelta::FromHours(12));
- policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock));
+ policy->SetClockForTesting(std::unique_ptr<base::Clock>(mock_clock));
// Record some actions
scoped_refptr<Action> action = new Action("deleteextensiondata",
@@ -973,14 +977,14 @@
base::Time::Now(),
Action::ACTION_API_CALL,
"tabs.testMethod");
- action_api->set_args(make_scoped_ptr(new base::ListValue()));
+ action_api->set_args(base::WrapUnique(new base::ListValue()));
policy->ProcessAction(action_api);
scoped_refptr<Action> action_dom = new Action(extension->id(),
base::Time::Now(),
Action::ACTION_DOM_ACCESS,
"document.write");
- action_dom->set_args(make_scoped_ptr(new base::ListValue()));
+ action_dom->set_args(base::WrapUnique(new base::ListValue()));
action_dom->set_page_url(gurl);
policy->ProcessAction(action_dom);
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc
index d665c99b..ac60edfd 100644
--- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc
+++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc
@@ -87,10 +87,10 @@
}
void ActivityLogAPI::OnExtensionActivity(scoped_refptr<Action> activity) {
- scoped_ptr<base::ListValue> value(new base::ListValue());
+ std::unique_ptr<base::ListValue> value(new base::ListValue());
ExtensionActivity activity_arg = activity->ConvertToExtensionActivity();
value->Append(activity_arg.ToValue());
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::ACTIVITY_LOG_PRIVATE_ON_EXTENSION_ACTIVITY,
activity_log_private::OnExtensionActivity::kEventName, std::move(value)));
event->restrict_to_browser_context = browser_context_;
@@ -98,12 +98,12 @@
}
bool ActivityLogPrivateGetExtensionActivitiesFunction::RunAsync() {
- scoped_ptr<activity_log_private::GetExtensionActivities::Params> params(
+ std::unique_ptr<activity_log_private::GetExtensionActivities::Params> params(
activity_log_private::GetExtensionActivities::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Get the arguments in the right format.
- scoped_ptr<Filter> filter;
+ std::unique_ptr<Filter> filter;
filter.reset(¶ms.release()->filter);
Action::ActionType action_type = Action::ACTION_API_CALL;
switch (filter->activity_type) {
@@ -159,14 +159,14 @@
}
void ActivityLogPrivateGetExtensionActivitiesFunction::OnLookupCompleted(
- scoped_ptr<std::vector<scoped_refptr<Action> > > activities) {
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> activities) {
// Convert Actions to ExtensionActivities.
std::vector<ExtensionActivity> result_arr;
for (const auto& activity : *activities)
result_arr.push_back(activity->ConvertToExtensionActivity());
// Populate the return object.
- scoped_ptr<ActivityResultSet> result_set(new ActivityResultSet);
+ std::unique_ptr<ActivityResultSet> result_set(new ActivityResultSet);
result_set->activities = std::move(result_arr);
results_ = activity_log_private::GetExtensionActivities::Results::Create(
*result_set);
@@ -175,7 +175,7 @@
}
bool ActivityLogPrivateDeleteActivitiesFunction::RunAsync() {
- scoped_ptr<activity_log_private::DeleteActivities::Params> params(
+ std::unique_ptr<activity_log_private::DeleteActivities::Params> params(
activity_log_private::DeleteActivities::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -201,7 +201,7 @@
}
bool ActivityLogPrivateDeleteUrlsFunction::RunAsync() {
- scoped_ptr<activity_log_private::DeleteUrls::Params> params(
+ std::unique_ptr<activity_log_private::DeleteUrls::Params> params(
activity_log_private::DeleteUrls::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h
index f665e9a..d959128 100644
--- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h
+++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h
@@ -76,7 +76,7 @@
private:
void OnLookupCompleted(
- scoped_ptr<std::vector<scoped_refptr<Action> > > activities);
+ std::unique_ptr<std::vector<scoped_refptr<Action>>> activities);
};
// The implementation of activityLogPrivate.deleteActivities
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc
index 3c24a17..d813ad5e 100644
--- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api_unittest.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h"
+#include <memory>
#include <string>
#include <utility>
-#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/activity_log/activity_action_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,7 +27,7 @@
typedef testing::Test ActivityLogApiUnitTest;
TEST_F(ActivityLogApiUnitTest, ConvertChromeApiAction) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue("hello"));
args->Set(1, new base::StringValue("world"));
scoped_refptr<Action> action(new Action(kExtensionId,
@@ -45,7 +45,7 @@
}
TEST_F(ActivityLogApiUnitTest, ConvertDomAction) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue("hello"));
args->Set(1, new base::StringValue("world"));
scoped_refptr<Action> action(new Action(kExtensionId,
@@ -66,7 +66,7 @@
ASSERT_EQ("Title", *(result.page_title.get()));
ASSERT_EQ(kApiCall, *(result.api_call.get()));
ASSERT_EQ(kArgs, *(result.args.get()));
- scoped_ptr<ExtensionActivity::Other> other(std::move(result.other));
+ std::unique_ptr<ExtensionActivity::Other> other(std::move(result.other));
ASSERT_EQ(api::activity_log_private::EXTENSION_ACTIVITY_DOM_VERB_INSERTED,
other->dom_verb);
ASSERT_TRUE(other->prerender.get());
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_apitest.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_apitest.cc
index 6dafee1..478e75f 100644
--- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_apitest.cc
+++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_apitest.cc
@@ -40,8 +40,8 @@
command_line->AppendSwitch(switches::kEnableExtensionActivityLogging);
}
- scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
- scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse);
+ std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
+ std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse);
response->set_code(net::HTTP_OK);
response->set_content("<html><head><title>ActivityLogTest</title>"
"</head><body>Hello World</body></html>");
diff --git a/chrome/browser/extensions/api/audio_modem/audio_modem_api.cc b/chrome/browser/extensions/api/audio_modem/audio_modem_api.cc
index 14f4f37..65a90d5 100644
--- a/chrome/browser/extensions/api/audio_modem/audio_modem_api.cc
+++ b/chrome/browser/extensions/api/audio_modem/audio_modem_api.cc
@@ -5,7 +5,9 @@
#include "chrome/browser/extensions/api/audio_modem/audio_modem_api.h"
#include <stdint.h>
+
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -15,7 +17,7 @@
#include "base/guid.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/timer/timer.h"
#include "chrome/browser/copresence/chrome_whispernet_client.h"
@@ -104,13 +106,13 @@
AudioModemAPI::AudioModemAPI(content::BrowserContext* context)
: AudioModemAPI(context,
- make_scoped_ptr(new ChromeWhispernetClient(context)),
+ base::WrapUnique(new ChromeWhispernetClient(context)),
audio_modem::Modem::Create()) {}
AudioModemAPI::AudioModemAPI(
content::BrowserContext* context,
- scoped_ptr<audio_modem::WhispernetClient> whispernet_client,
- scoped_ptr<audio_modem::Modem> modem)
+ std::unique_ptr<audio_modem::WhispernetClient> whispernet_client,
+ std::unique_ptr<audio_modem::Modem> modem)
: browser_context_(context),
whispernet_client_(std::move(whispernet_client)),
modem_(std::move(modem)),
@@ -251,17 +253,17 @@
// Construct the event arguments by hand because a given token can be
// present for multiple listeners, so constructing a
// std::vector<ReceivedToken> for each is inefficient.
- scoped_ptr<base::ListValue> tokens_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> tokens_value(new base::ListValue());
for (const ReceivedToken* token : app_tokens)
tokens_value->Append(token->ToValue());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(std::move(tokens_value));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(
- app_id, make_scoped_ptr(new Event(events::AUDIO_MODEM_ON_RECEIVED,
- OnReceived::kEventName,
- std::move(args))));
+ app_id, base::WrapUnique(new Event(events::AUDIO_MODEM_ON_RECEIVED,
+ OnReceived::kEventName,
+ std::move(args))));
}
}
@@ -275,7 +277,7 @@
}
ExtensionFunction::ResponseAction AudioModemTransmitFunction::Run() {
- scoped_ptr<Transmit::Params> params(Transmit::Params::Create(*args_));
+ std::unique_ptr<Transmit::Params> params(Transmit::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
AudioModemAPI* api =
AudioModemAPI::GetFactoryInstance()->Get(browser_context());
@@ -316,7 +318,8 @@
}
ExtensionFunction::ResponseAction AudioModemStopTransmitFunction::Run() {
- scoped_ptr<StopTransmit::Params> params(StopTransmit::Params::Create(*args_));
+ std::unique_ptr<StopTransmit::Params> params(
+ StopTransmit::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
Status status = AudioModemAPI::GetFactoryInstance()->Get(browser_context())
@@ -325,7 +328,7 @@
}
ExtensionFunction::ResponseAction AudioModemReceiveFunction::Run() {
- scoped_ptr<Receive::Params> params(Receive::Params::Create(*args_));
+ std::unique_ptr<Receive::Params> params(Receive::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
AudioModemAPI* api =
AudioModemAPI::GetFactoryInstance()->Get(browser_context());
@@ -351,7 +354,8 @@
}
ExtensionFunction::ResponseAction AudioModemStopReceiveFunction::Run() {
- scoped_ptr<StopReceive::Params> params(StopReceive::Params::Create(*args_));
+ std::unique_ptr<StopReceive::Params> params(
+ StopReceive::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
Status status = AudioModemAPI::GetFactoryInstance()->Get(browser_context())
diff --git a/chrome/browser/extensions/api/audio_modem/audio_modem_api.h b/chrome/browser/extensions/api/audio_modem/audio_modem_api.h
index e5f0776..557e606 100644
--- a/chrome/browser/extensions/api/audio_modem/audio_modem_api.h
+++ b/chrome/browser/extensions/api/audio_modem/audio_modem_api.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_EXTENSIONS_API_AUDIO_MODEM_AUDIO_MODEM_API_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/api/audio_modem.h"
#include "components/audio_modem/public/modem.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
@@ -26,9 +26,10 @@
explicit AudioModemAPI(content::BrowserContext* context);
// Testing constructor: pass in dependencies.
- AudioModemAPI(content::BrowserContext* context,
- scoped_ptr<audio_modem::WhispernetClient> whispernet_client,
- scoped_ptr<audio_modem::Modem> modem);
+ AudioModemAPI(
+ content::BrowserContext* context,
+ std::unique_ptr<audio_modem::WhispernetClient> whispernet_client,
+ std::unique_ptr<audio_modem::Modem> modem);
~AudioModemAPI() override;
@@ -66,8 +67,8 @@
void TokensReceived(const std::vector<audio_modem::AudioToken>& tokens);
content::BrowserContext* const browser_context_;
- scoped_ptr<audio_modem::WhispernetClient> whispernet_client_;
- scoped_ptr<audio_modem::Modem> modem_;
+ std::unique_ptr<audio_modem::WhispernetClient> whispernet_client_;
+ std::unique_ptr<audio_modem::Modem> modem_;
bool init_failed_;
// IDs for the currently transmitting app (if any), indexed by AudioType.
diff --git a/chrome/browser/extensions/api/audio_modem/audio_modem_api_unittest.cc b/chrome/browser/extensions/api/audio_modem/audio_modem_api_unittest.cc
index b180ca7..f72d44a 100644
--- a/chrome/browser/extensions/api/audio_modem/audio_modem_api_unittest.cc
+++ b/chrome/browser/extensions/api/audio_modem/audio_modem_api_unittest.cc
@@ -2,16 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/audio_modem/audio_modem_api.h"
+
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/callback.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chrome/browser/extensions/api/audio_modem/audio_modem_api.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/test_extension_system.h"
@@ -48,13 +50,13 @@
std::map<BrowserContext*, StubModem*> g_modems;
// Create a test AudioModemAPI and store the modem it uses.
-scoped_ptr<KeyedService> ApiFactoryFunction(BrowserContext* context) {
+std::unique_ptr<KeyedService> ApiFactoryFunction(BrowserContext* context) {
StubModem* modem = new StubModem;
g_modems[context] = modem;
- return make_scoped_ptr(new AudioModemAPI(
+ return base::WrapUnique(new AudioModemAPI(
context,
- make_scoped_ptr<audio_modem::WhispernetClient>(new StubWhispernetClient),
- make_scoped_ptr<audio_modem::Modem>(modem)));
+ base::WrapUnique<audio_modem::WhispernetClient>(new StubWhispernetClient),
+ base::WrapUnique<audio_modem::Modem>(modem)));
}
DictionaryValue* CreateParams(const std::string& audio_band) {
@@ -69,14 +71,14 @@
return BinaryValue::CreateWithCopiedBuffer(token.c_str(), token.size());
}
-scoped_ptr<ListValue> CreateList(Value* single_elt) {
- scoped_ptr<ListValue> list(new ListValue);
+std::unique_ptr<ListValue> CreateList(Value* single_elt) {
+ std::unique_ptr<ListValue> list(new ListValue);
list->Append(single_elt);
return list;
}
-scoped_ptr<ListValue> CreateList(Value* elt1, Value* elt2) {
- scoped_ptr<ListValue> list(new ListValue);
+std::unique_ptr<ListValue> CreateList(Value* elt1, Value* elt2) {
+ std::unique_ptr<ListValue> list(new ListValue);
list->Append(elt1);
list->Append(elt2);
return list;
@@ -108,14 +110,14 @@
public:
// Callback to receive events. First argument is
// the extension id to receive the event.
- using EventCallback = base::Callback<void(const std::string&,
- scoped_ptr<Event>)>;
+ using EventCallback =
+ base::Callback<void(const std::string&, std::unique_ptr<Event>)>;
explicit StubEventRouter(BrowserContext* context)
: EventRouter(context, nullptr) {}
void DispatchEventToExtension(const std::string& extension_id,
- scoped_ptr<Event> event) override {
+ std::unique_ptr<Event> event) override {
event_callback_.Run(extension_id, std::move(event));
}
@@ -132,9 +134,9 @@
};
// StubEventRouter factory function
-scoped_ptr<KeyedService> StubEventRouterFactoryFunction(
+std::unique_ptr<KeyedService> StubEventRouterFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(new StubEventRouter(context));
+ return base::WrapUnique(new StubEventRouter(context));
}
} // namespace
@@ -145,8 +147,8 @@
~AudioModemApiUnittest() override {}
protected:
- template<typename Function>
- const std::string RunFunction(scoped_ptr<ListValue> args,
+ template <typename Function>
+ const std::string RunFunction(std::unique_ptr<ListValue> args,
const Extension* extension) {
scoped_refptr<UIThreadExtensionFunction> function(new Function);
function->set_extension(extension);
@@ -160,8 +162,8 @@
return result_status;
}
- template<typename Function>
- const std::string RunFunction(scoped_ptr<ListValue> args) {
+ template <typename Function>
+ const std::string RunFunction(std::unique_ptr<ListValue> args) {
return RunFunction<Function>(std::move(args), GetExtension(std::string()));
}
@@ -171,7 +173,8 @@
const Extension* GetExtension(const std::string& name) {
if (!extensions_by_name_[name].get()) {
- scoped_ptr<DictionaryValue> extension_definition(new DictionaryValue);
+ std::unique_ptr<DictionaryValue> extension_definition(
+ new DictionaryValue);
extension_definition->SetString("name", name);
extension_definition->SetString("version", "1.0");
extensions_by_name_[name] = api_test_utils::CreateExtension(
@@ -181,14 +184,14 @@
return extensions_by_name_[name].get();
}
- const std::vector<scoped_ptr<const Event>>& GetEventsForExtension(
+ const std::vector<std::unique_ptr<const Event>>& GetEventsForExtension(
const std::string& name) {
const Extension* extension = extensions_by_name_[name].get();
DCHECK(extension);
return events_by_extension_id_[extension->id()];
}
- const std::vector<scoped_ptr<const Event>>& GetEvents() {
+ const std::vector<std::unique_ptr<const Event>>& GetEvents() {
return GetEventsForExtension(std::string());
}
@@ -206,13 +209,13 @@
}
void CaptureEvent(const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
events_by_extension_id_[extension_id].push_back(std::move(event));
}
std::map<std::string, scoped_refptr<Extension>> extensions_by_name_;
- std::map<std::string, std::vector<scoped_ptr<const Event>>>
+ std::map<std::string, std::vector<std::unique_ptr<const Event>>>
events_by_extension_id_;
};
@@ -262,7 +265,7 @@
// Check the tokens received.
EXPECT_EQ(1u, GetEvents().size());
- scoped_ptr<ListValue> expected_tokens(new ListValue);
+ std::unique_ptr<ListValue> expected_tokens(new ListValue);
expected_tokens->Append(CreateReceivedToken("1234", "audible"));
expected_tokens->Append(CreateReceivedToken("ABCD", "audible"));
ListValue* received_tokens;
@@ -351,7 +354,7 @@
EXPECT_EQ(1u, GetEventsForExtension("ext2").size());
// Check the token received.
- scoped_ptr<DictionaryValue> expected_token(
+ std::unique_ptr<DictionaryValue> expected_token(
CreateReceivedToken("abcd", "inaudible"));
EXPECT_TRUE(ReceivedSingleToken(GetEventsForExtension("ext1")[0].get(),
expected_token.get()));
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
index 604324f..e3b9265 100644
--- a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
+++ b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
@@ -171,7 +171,7 @@
AutofillPrivateSaveAddressFunction::~AutofillPrivateSaveAddressFunction() {}
ExtensionFunction::ResponseAction AutofillPrivateSaveAddressFunction::Run() {
- scoped_ptr<api::autofill_private::SaveAddress::Params> parameters =
+ std::unique_ptr<api::autofill_private::SaveAddress::Params> parameters =
api::autofill_private::SaveAddress::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -285,8 +285,9 @@
ExtensionFunction::ResponseAction
AutofillPrivateGetAddressComponentsFunction::Run() {
- scoped_ptr<api::autofill_private::GetAddressComponents::Params> parameters =
- api::autofill_private::GetAddressComponents::Params::Create(*args_);
+ std::unique_ptr<api::autofill_private::GetAddressComponents::Params>
+ parameters =
+ api::autofill_private::GetAddressComponents::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
autofill_private::AddressComponents components;
@@ -308,7 +309,7 @@
~AutofillPrivateSaveCreditCardFunction() {}
ExtensionFunction::ResponseAction AutofillPrivateSaveCreditCardFunction::Run() {
- scoped_ptr<api::autofill_private::SaveCreditCard::Params> parameters =
+ std::unique_ptr<api::autofill_private::SaveCreditCard::Params> parameters =
api::autofill_private::SaveCreditCard::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -367,7 +368,7 @@
AutofillPrivateRemoveEntryFunction::~AutofillPrivateRemoveEntryFunction() {}
ExtensionFunction::ResponseAction AutofillPrivateRemoveEntryFunction::Run() {
- scoped_ptr<api::autofill_private::RemoveEntry::Params> parameters =
+ std::unique_ptr<api::autofill_private::RemoveEntry::Params> parameters =
api::autofill_private::RemoveEntry::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -392,14 +393,15 @@
ExtensionFunction::ResponseAction
AutofillPrivateValidatePhoneNumbersFunction::Run() {
- scoped_ptr<api::autofill_private::ValidatePhoneNumbers::Params> parameters =
- api::autofill_private::ValidatePhoneNumbers::Params::Create(*args_);
+ std::unique_ptr<api::autofill_private::ValidatePhoneNumbers::Params>
+ parameters =
+ api::autofill_private::ValidatePhoneNumbers::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
api::autofill_private::ValidatePhoneParams* params = ¶meters->params;
// Extract the phone numbers into a ListValue.
- scoped_ptr<base::ListValue> phoneNumbers(new base::ListValue);
+ std::unique_ptr<base::ListValue> phoneNumbers(new base::ListValue);
phoneNumbers->AppendStrings(params->phone_numbers);
RemoveDuplicatePhoneNumberAtIndex(
@@ -418,7 +420,7 @@
~AutofillPrivateMaskCreditCardFunction() {}
ExtensionFunction::ResponseAction AutofillPrivateMaskCreditCardFunction::Run() {
- scoped_ptr<api::autofill_private::MaskCreditCard::Params> parameters =
+ std::unique_ptr<api::autofill_private::MaskCreditCard::Params> parameters =
api::autofill_private::MaskCreditCard::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
index 17d0d6a2..5162c97 100644
--- a/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
+++ b/chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc
@@ -76,10 +76,10 @@
autofill_util::AddressEntryList addressList =
extensions::autofill_util::GenerateAddressList(*personal_data_);
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::autofill_private::OnAddressListChanged::Create(addressList)
.release());
- scoped_ptr<Event> extension_event(
+ std::unique_ptr<Event> extension_event(
new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED,
api::autofill_private::OnAddressListChanged::kEventName,
std::move(args)));
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_util.cc b/chrome/browser/extensions/api/autofill_private/autofill_util.cc
index ac367e1..adccb1bf 100644
--- a/chrome/browser/extensions/api/autofill_private/autofill_util.cc
+++ b/chrome/browser/extensions/api/autofill_private/autofill_util.cc
@@ -5,8 +5,10 @@
#include "chrome/browser/extensions/api/autofill_private/autofill_util.h"
#include <stddef.h>
+
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -29,9 +31,10 @@
// Get the multi-valued element for |type| and return it as a |vector|.
// TODO(khorimoto): remove this function since multi-valued types are
// deprecated.
-scoped_ptr<std::vector<std::string>> GetValueList(
- const autofill::AutofillProfile& profile, autofill::ServerFieldType type) {
- scoped_ptr<std::vector<std::string>> list(new std::vector<std::string>);
+std::unique_ptr<std::vector<std::string>> GetValueList(
+ const autofill::AutofillProfile& profile,
+ autofill::ServerFieldType type) {
+ std::unique_ptr<std::vector<std::string>> list(new std::vector<std::string>);
std::vector<base::string16> values;
if (autofill::AutofillType(type).group() == autofill::NAME) {
@@ -54,10 +57,10 @@
}
// Gets the string corresponding to |type| from |profile|.
-scoped_ptr<std::string> GetStringFromProfile(
+std::unique_ptr<std::string> GetStringFromProfile(
const autofill::AutofillProfile& profile,
const autofill::ServerFieldType& type) {
- return make_scoped_ptr(
+ return base::WrapUnique(
new std::string(base::UTF16ToUTF8(profile.GetRawInfo(type))));
}
@@ -100,8 +103,8 @@
base::SplitStringUsingSubstr(label, separator, &label_pieces);
// Create address metadata and add it to |address|.
- scoped_ptr<autofill_private::AutofillMetadata>
- metadata(new autofill_private::AutofillMetadata);
+ std::unique_ptr<autofill_private::AutofillMetadata> metadata(
+ new autofill_private::AutofillMetadata);
metadata->summary_label = base::UTF16ToUTF8(label_pieces[0]);
metadata->summary_sublabel.reset(new std::string(base::UTF16ToUTF8(
label.substr(label_pieces[0].size()))));
@@ -128,8 +131,8 @@
credit_card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR))));
// Create address metadata and add it to |address|.
- scoped_ptr<autofill_private::AutofillMetadata>
- metadata(new autofill_private::AutofillMetadata);
+ std::unique_ptr<autofill_private::AutofillMetadata> metadata(
+ new autofill_private::AutofillMetadata);
std::pair<base::string16, base::string16> label_pieces =
credit_card.LabelPieces();
metadata->summary_label = base::UTF16ToUTF8(label_pieces.first);
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_util.h b/chrome/browser/extensions/api/autofill_private/autofill_util.h
index 7518180..5fb4904 100644
--- a/chrome/browser/extensions/api/autofill_private/autofill_util.h
+++ b/chrome/browser/extensions/api/autofill_private/autofill_util.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_EXTENSIONS_API_AUTOFILL_PRIVATE_AUTOFILL_UTIL_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/api/autofill_private.h"
#include "components/autofill/core/browser/personal_data_manager.h"
diff --git a/chrome/browser/extensions/api/automation_internal/automation_event_router.cc b/chrome/browser/extensions/api/automation_internal/automation_event_router.cc
index d0f5c033..291a6108 100644
--- a/chrome/browser/extensions/api/automation_internal/automation_event_router.cc
+++ b/chrome/browser/extensions/api/automation_internal/automation_event_router.cc
@@ -90,9 +90,9 @@
void AutomationEventRouter::DispatchTreeDestroyedEvent(
int tree_id,
content::BrowserContext* browser_context) {
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id));
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED,
api::automation_internal::OnAccessibilityTreeDestroyed::kEventName,
std::move(args)));
diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
index 1770ca5..c826529e 100644
--- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
+++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
@@ -245,7 +245,7 @@
EXTENSION_FUNCTION_VALIDATE(automation_info);
using api::automation_internal::EnableTab::Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
content::WebContents* contents = NULL;
if (params->args.tab_id.get()) {
@@ -295,7 +295,7 @@
// TODO(dtseng): Limited to desktop tree for now pending out of proc iframes.
using api::automation_internal::EnableFrame::Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
content::RenderFrameHost* rfh =
@@ -317,7 +317,7 @@
EXTENSION_FUNCTION_VALIDATE(automation_info && automation_info->interact);
using api::automation_internal::PerformAction::Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->args.tree_id == kDesktopTreeID) {
@@ -389,7 +389,7 @@
return RespondNow(Error("desktop permission must be requested"));
using api::automation_internal::EnableDesktop::Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// This gets removed when the extension process dies.
@@ -414,7 +414,7 @@
EXTENSION_FUNCTION_VALIDATE(automation_info);
using api::automation_internal::QuerySelector::Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->args.tree_id == kDesktopTreeID) {
diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
index 735e981..3974094 100644
--- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
+++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
@@ -82,7 +82,7 @@
}
bool AutotestPrivateShutdownFunction::RunSync() {
- scoped_ptr<api::autotest_private::Shutdown::Params> params(
+ std::unique_ptr<api::autotest_private::Shutdown::Params> params(
api::autotest_private::Shutdown::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -227,7 +227,7 @@
}
bool AutotestPrivateSetTouchpadSensitivityFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetTouchpadSensitivity::Params> params(
+ std::unique_ptr<api::autotest_private::SetTouchpadSensitivity::Params> params(
api::autotest_private::SetTouchpadSensitivity::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -241,7 +241,7 @@
}
bool AutotestPrivateSetTapToClickFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetTapToClick::Params> params(
+ std::unique_ptr<api::autotest_private::SetTapToClick::Params> params(
api::autotest_private::SetTapToClick::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -254,7 +254,7 @@
}
bool AutotestPrivateSetThreeFingerClickFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetThreeFingerClick::Params> params(
+ std::unique_ptr<api::autotest_private::SetThreeFingerClick::Params> params(
api::autotest_private::SetThreeFingerClick::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -268,7 +268,7 @@
}
bool AutotestPrivateSetTapDraggingFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetTapDragging::Params> params(
+ std::unique_ptr<api::autotest_private::SetTapDragging::Params> params(
api::autotest_private::SetTapDragging::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -281,7 +281,7 @@
}
bool AutotestPrivateSetNaturalScrollFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetNaturalScroll::Params> params(
+ std::unique_ptr<api::autotest_private::SetNaturalScroll::Params> params(
api::autotest_private::SetNaturalScroll::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -295,7 +295,7 @@
}
bool AutotestPrivateSetMouseSensitivityFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetMouseSensitivity::Params> params(
+ std::unique_ptr<api::autotest_private::SetMouseSensitivity::Params> params(
api::autotest_private::SetMouseSensitivity::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -309,7 +309,7 @@
}
bool AutotestPrivateSetPrimaryButtonRightFunction::RunSync() {
- scoped_ptr<api::autotest_private::SetPrimaryButtonRight::Params> params(
+ std::unique_ptr<api::autotest_private::SetPrimaryButtonRight::Params> params(
api::autotest_private::SetPrimaryButtonRight::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc
index 7ae127b..8328f82 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc
@@ -132,11 +132,11 @@
callback.Run();
}
-scoped_ptr<device::BluetoothAdvertisement::ManufacturerData>
+std::unique_ptr<device::BluetoothAdvertisement::ManufacturerData>
CreateManufacturerData(
std::vector<apibtle::ManufacturerData>* manufacturer_data) {
- scoped_ptr<device::BluetoothAdvertisement::ManufacturerData> created_data(
- new device::BluetoothAdvertisement::ManufacturerData());
+ std::unique_ptr<device::BluetoothAdvertisement::ManufacturerData>
+ created_data(new device::BluetoothAdvertisement::ManufacturerData());
for (const auto& it : *manufacturer_data) {
std::vector<uint8_t> data(it.data.size());
std::copy(it.data.begin(), it.data.end(), data.begin());
@@ -145,9 +145,9 @@
return created_data;
}
-scoped_ptr<device::BluetoothAdvertisement::ServiceData> CreateServiceData(
+std::unique_ptr<device::BluetoothAdvertisement::ServiceData> CreateServiceData(
std::vector<apibtle::ServiceData>* service_data) {
- scoped_ptr<device::BluetoothAdvertisement::ServiceData> created_data(
+ std::unique_ptr<device::BluetoothAdvertisement::ServiceData> created_data(
new device::BluetoothAdvertisement::ServiceData());
for (const auto& it : *service_data) {
std::vector<uint8_t> data(it.data.size());
@@ -235,7 +235,7 @@
return false;
}
- scoped_ptr<apibtle::Connect::Params> params(
+ std::unique_ptr<apibtle::Connect::Params> params(
apibtle::Connect::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -278,7 +278,7 @@
return false;
}
- scoped_ptr<apibtle::Disconnect::Params> params(
+ std::unique_ptr<apibtle::Disconnect::Params> params(
apibtle::Disconnect::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -315,7 +315,7 @@
return false;
}
- scoped_ptr<apibtle::GetService::Params> params(
+ std::unique_ptr<apibtle::GetService::Params> params(
apibtle::GetService::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -348,7 +348,7 @@
return false;
}
- scoped_ptr<apibtle::GetServices::Params> params(
+ std::unique_ptr<apibtle::GetServices::Params> params(
apibtle::GetServices::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -379,7 +379,7 @@
return false;
}
- scoped_ptr<apibtle::GetCharacteristic::Params> params(
+ std::unique_ptr<apibtle::GetCharacteristic::Params> params(
apibtle::GetCharacteristic::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -416,7 +416,7 @@
return false;
}
- scoped_ptr<apibtle::GetCharacteristics::Params> params(
+ std::unique_ptr<apibtle::GetCharacteristics::Params> params(
apibtle::GetCharacteristics::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -433,7 +433,7 @@
// Manually construct the result instead of using
// apibtle::GetCharacteristics::Result::Create as it doesn't convert lists of
// enums correctly.
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
for (apibtle::Characteristic& characteristic : characteristic_list)
result->Append(apibtle::CharacteristicToValue(&characteristic));
@@ -457,7 +457,7 @@
return false;
}
- scoped_ptr<apibtle::GetIncludedServices::Params> params(
+ std::unique_ptr<apibtle::GetIncludedServices::Params> params(
apibtle::GetIncludedServices::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -490,7 +490,7 @@
return false;
}
- scoped_ptr<apibtle::GetDescriptor::Params> params(
+ std::unique_ptr<apibtle::GetDescriptor::Params> params(
apibtle::GetDescriptor::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -526,7 +526,7 @@
return false;
}
- scoped_ptr<apibtle::GetDescriptors::Params> params(
+ std::unique_ptr<apibtle::GetDescriptors::Params> params(
apibtle::GetDescriptors::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -542,7 +542,7 @@
// Manually construct the result instead of using
// apibtle::GetDescriptors::Result::Create as it doesn't convert lists of
// enums correctly.
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
for (apibtle::Descriptor& descriptor : descriptor_list)
result->Append(apibtle::DescriptorToValue(&descriptor));
@@ -566,7 +566,7 @@
return false;
}
- scoped_ptr<apibtle::ReadCharacteristicValue::Params> params(
+ std::unique_ptr<apibtle::ReadCharacteristicValue::Params> params(
apibtle::ReadCharacteristicValue::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -624,7 +624,7 @@
return false;
}
- scoped_ptr<apibtle::WriteCharacteristicValue::Params> params(
+ std::unique_ptr<apibtle::WriteCharacteristicValue::Params> params(
apibtle::WriteCharacteristicValue::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -668,7 +668,7 @@
return false;
}
- scoped_ptr<apibtle::StartCharacteristicNotifications::Params> params(
+ std::unique_ptr<apibtle::StartCharacteristicNotifications::Params> params(
apibtle::StartCharacteristicNotifications::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -716,7 +716,7 @@
return false;
}
- scoped_ptr<apibtle::StopCharacteristicNotifications::Params> params(
+ std::unique_ptr<apibtle::StopCharacteristicNotifications::Params> params(
apibtle::StopCharacteristicNotifications::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -758,7 +758,7 @@
return false;
}
- scoped_ptr<apibtle::ReadDescriptorValue::Params> params(
+ std::unique_ptr<apibtle::ReadDescriptorValue::Params> params(
apibtle::ReadDescriptorValue::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -815,7 +815,7 @@
return false;
}
- scoped_ptr<apibtle::WriteDescriptorValue::Params> params(
+ std::unique_ptr<apibtle::WriteDescriptorValue::Params> params(
apibtle::WriteDescriptorValue::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
@@ -930,11 +930,11 @@
return false;
}
- scoped_ptr<apibtle::RegisterAdvertisement::Params> params(
+ std::unique_ptr<apibtle::RegisterAdvertisement::Params> params(
apibtle::RegisterAdvertisement::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
- scoped_ptr<device::BluetoothAdvertisement::Data> advertisement_data(
+ std::unique_ptr<device::BluetoothAdvertisement::Data> advertisement_data(
new device::BluetoothAdvertisement::Data(
params->advertisement.type ==
apibtle::AdvertisementType::ADVERTISEMENT_TYPE_BROADCAST
@@ -1021,7 +1021,7 @@
if (!event_router->HasAdapter())
return true;
- scoped_ptr<apibtle::UnregisterAdvertisement::Params> params(
+ std::unique_ptr<apibtle::UnregisterAdvertisement::Params> params(
apibtle::UnregisterAdvertisement::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h
index 9a00f7cf..a7f4ed5 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h"
#include "chrome/browser/extensions/browser_context_keyed_service_factories.h"
#include "device/bluetooth/bluetooth_advertisement.h"
@@ -46,7 +47,7 @@
private:
friend class BrowserContextKeyedAPIFactory<BluetoothLowEnergyAPI>;
- scoped_ptr<BluetoothLowEnergyEventRouter> event_router_;
+ std::unique_ptr<BluetoothLowEnergyEventRouter> event_router_;
DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyAPI);
};
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
index a5aee42..64cd5f93 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
@@ -3,9 +3,10 @@
// found in the LICENSE file.
#include <stdint.h>
+
+#include <memory>
#include <utility>
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h"
#include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h"
#include "chrome/browser/extensions/extension_apitest.h"
@@ -213,15 +214,15 @@
}
testing::StrictMock<MockBluetoothAdapter>* mock_adapter_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device0_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device1_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattService> > service0_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattService> > service1_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattCharacteristic> > chrc0_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattCharacteristic> > chrc1_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattCharacteristic> > chrc2_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattDescriptor> > desc0_;
- scoped_ptr<testing::NiceMock<MockBluetoothGattDescriptor> > desc1_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> device0_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> device1_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattService>> service0_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattService>> service1_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattCharacteristic>> chrc0_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattCharacteristic>> chrc1_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattCharacteristic>> chrc2_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattDescriptor>> desc0_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothGattDescriptor>> desc1_;
private:
scoped_refptr<extensions::Extension> empty_extension_;
@@ -242,7 +243,7 @@
ACTION_TEMPLATE(InvokeCallbackWithScopedPtrArg,
HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
AND_1_VALUE_PARAMS(p0)) {
- ::std::tr1::get<k>(args).Run(scoped_ptr<T>(p0));
+ ::std::tr1::get<k>(args).Run(std::unique_ptr<T>(p0));
}
BluetoothGattConnection* CreateGattConnection(
@@ -1231,7 +1232,7 @@
testing::NiceMock<MockBluetoothGattConnection>* conn =
new testing::NiceMock<MockBluetoothGattConnection>(mock_adapter_,
kTestLeDeviceAddress0);
- scoped_ptr<BluetoothGattConnection> conn_ptr(conn);
+ std::unique_ptr<BluetoothGattConnection> conn_ptr(conn);
EXPECT_CALL(*conn, Disconnect()).Times(1);
EXPECT_CALL(*device0_, CreateGattConnection(_, _))
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
index de9428f..dc9c48e 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
@@ -46,10 +47,10 @@
protected:
chromeos::FakeChromeUserManager* fake_user_manager_;
- scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
+ std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
chromeos::ScopedCrosSettingsTestHelper settings_helper_;
- scoped_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_;
+ std::unique_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_;
void EnterKioskSession() {
fake_user_manager_ = new chromeos::FakeChromeUserManager();
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc
index 0c220de..0cfbbe0 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.cc
@@ -22,11 +22,10 @@
BluetoothLowEnergyConnection::BluetoothLowEnergyConnection(
bool persistent,
const std::string& owner_extension_id,
- scoped_ptr<device::BluetoothGattConnection> connection)
+ std::unique_ptr<device::BluetoothGattConnection> connection)
: ApiResource(owner_extension_id),
persistent_(persistent),
- connection_(connection.release()) {
-}
+ connection_(connection.release()) {}
BluetoothLowEnergyConnection::~BluetoothLowEnergyConnection() {
}
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h
index 0044ae5..28e3d9d8 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_
#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_CONNECTION_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "device/bluetooth/bluetooth_gatt_connection.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/api_resource_manager.h"
@@ -19,7 +20,7 @@
explicit BluetoothLowEnergyConnection(
bool persistent,
const std::string& owner_extension_id,
- scoped_ptr<device::BluetoothGattConnection> connection);
+ std::unique_ptr<device::BluetoothGattConnection> connection);
~BluetoothLowEnergyConnection() override;
// Returns a pointer to the underlying connection object.
@@ -43,7 +44,7 @@
// The connection is owned by this instance and will automatically disconnect
// when deleted.
- scoped_ptr<device::BluetoothGattConnection> connection_;
+ std::unique_ptr<device::BluetoothGattConnection> connection_;
DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnection);
};
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
index 75c0670c..f22ba42e 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
@@ -835,9 +835,9 @@
apibtle::Service api_service;
PopulateService(service, &api_service);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
apibtle::OnServiceRemoved::Create(api_service);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::BLUETOOTH_LOW_ENERGY_ON_SERVICE_REMOVED,
apibtle::OnServiceRemoved::kEventName, std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
@@ -857,9 +857,9 @@
apibtle::Service api_service;
PopulateService(service, &api_service);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
apibtle::OnServiceAdded::Create(api_service);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::BLUETOOTH_LOW_ENERGY_ON_SERVICE_ADDED,
apibtle::OnServiceAdded::kEventName, std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
@@ -993,7 +993,7 @@
// lists of enums correctly.
apibtle::Characteristic api_characteristic;
PopulateCharacteristic(characteristic, &api_characteristic);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(apibtle::CharacteristicToValue(&api_characteristic).release());
DispatchEventToExtensionsWithPermission(
@@ -1023,7 +1023,7 @@
// lists of enums correctly.
apibtle::Descriptor api_descriptor;
PopulateDescriptor(descriptor, &api_descriptor);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(apibtle::DescriptorToValue(&api_descriptor).release());
DispatchEventToExtensionsWithPermission(
@@ -1102,7 +1102,7 @@
const std::string& event_name,
const device::BluetoothUUID& uuid,
const std::string& characteristic_id,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
// Obtain the listeners of |event_name|. The list can contain multiple
// entries for the same extension, so we keep track of the extensions that we
// already sent the event to, since we want the send an event to an extension
@@ -1142,8 +1142,8 @@
continue;
// Send the event.
- scoped_ptr<base::ListValue> args_copy(args->DeepCopy());
- scoped_ptr<Event> event(
+ std::unique_ptr<base::ListValue> args_copy(args->DeepCopy());
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args_copy)));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(extension_id, std::move(event));
@@ -1243,7 +1243,7 @@
const std::string& extension_id,
const std::string& device_address,
const base::Closure& callback,
- scoped_ptr<BluetoothGattConnection> connection) {
+ std::unique_ptr<BluetoothGattConnection> connection) {
VLOG(2) << "GATT connection created.";
DCHECK(connection.get());
DCHECK(!FindConnection(extension_id, device_address));
@@ -1342,7 +1342,7 @@
const std::string& extension_id,
const std::string& characteristic_id,
const base::Closure& callback,
- scoped_ptr<device::BluetoothGattNotifySession> session) {
+ std::unique_ptr<device::BluetoothGattNotifySession> session) {
VLOG(2) << "Value update session created for characteristic: "
<< characteristic_id;
DCHECK(session.get());
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h
index 2498ad85..0629f1ca 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h
@@ -298,7 +298,7 @@
const std::string& event_name,
const device::BluetoothUUID& uuid,
const std::string& characteristic_id,
- scoped_ptr<base::ListValue> args);
+ std::unique_ptr<base::ListValue> args);
// Returns a BluetoothGattService by its instance ID |instance_id|. Returns
// NULL, if the service cannot be found.
@@ -326,7 +326,7 @@
const std::string& extension_id,
const std::string& device_address,
const base::Closure& callback,
- scoped_ptr<device::BluetoothGattConnection> connection);
+ std::unique_ptr<device::BluetoothGattConnection> connection);
// Called by BluetoothGattCharacteristic and BluetoothGattDescriptor in
// case of an error during the read/write operations.
@@ -346,7 +346,7 @@
const std::string& extension_id,
const std::string& characteristic_id,
const base::Closure& callback,
- scoped_ptr<device::BluetoothGattNotifySession> session);
+ std::unique_ptr<device::BluetoothGattNotifySession> session);
// Called by BluetoothGattCharacteristic in response to a call to
// StartNotifySession.
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc
index cfb821b..714a5bf 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.cc
@@ -22,11 +22,10 @@
BluetoothLowEnergyNotifySession::BluetoothLowEnergyNotifySession(
bool persistent,
const std::string& owner_extension_id,
- scoped_ptr<device::BluetoothGattNotifySession> session)
+ std::unique_ptr<device::BluetoothGattNotifySession> session)
: ApiResource(owner_extension_id),
persistent_(persistent),
- session_(session.release()) {
-}
+ session_(session.release()) {}
BluetoothLowEnergyNotifySession::~BluetoothLowEnergyNotifySession() {
}
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h
index 47e2b862..b5a4cae 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_notify_session.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_
#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_NOTIFY_SESSION_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "device/bluetooth/bluetooth_gatt_notify_session.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/api_resource_manager.h"
@@ -21,7 +21,7 @@
explicit BluetoothLowEnergyNotifySession(
bool persistent,
const std::string& owner_extension_id,
- scoped_ptr<device::BluetoothGattNotifySession> session);
+ std::unique_ptr<device::BluetoothGattNotifySession> session);
~BluetoothLowEnergyNotifySession() override;
// Returns a pointer to the underlying session object.
@@ -45,7 +45,7 @@
// The session is owned by this instance and will automatically stop when
// deleted.
- scoped_ptr<device::BluetoothGattNotifySession> session_;
+ std::unique_ptr<device::BluetoothGattNotifySession> session_;
DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyNotifySession);
};
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/utils.cc b/chrome/browser/extensions/api/bluetooth_low_energy/utils.cc
index 69cda09..c3b65d1 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/utils.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/utils.cc
@@ -11,9 +11,9 @@
namespace {
// Converts a list of CharacteristicProperty to a base::ListValue of strings.
-scoped_ptr<base::ListValue> CharacteristicPropertiesToValue(
+std::unique_ptr<base::ListValue> CharacteristicPropertiesToValue(
const std::vector<CharacteristicProperty> properties) {
- scoped_ptr<base::ListValue> property_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> property_list(new base::ListValue());
for (std::vector<CharacteristicProperty>::const_iterator iter =
properties.begin();
iter != properties.end();
@@ -24,24 +24,25 @@
} // namespace
-scoped_ptr<base::DictionaryValue> CharacteristicToValue(Characteristic* from) {
+std::unique_ptr<base::DictionaryValue> CharacteristicToValue(
+ Characteristic* from) {
// Copy the properties. Use Characteristic::ToValue to generate the result
// dictionary without the properties, to prevent json_schema_compiler from
// failing.
std::vector<CharacteristicProperty> properties = from->properties;
from->properties.clear();
- scoped_ptr<base::DictionaryValue> to = from->ToValue();
+ std::unique_ptr<base::DictionaryValue> to = from->ToValue();
to->SetWithoutPathExpansion(
"properties", CharacteristicPropertiesToValue(properties).release());
return to;
}
-scoped_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from) {
+std::unique_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from) {
// Copy the characteristic properties and set them later manually.
std::vector<CharacteristicProperty> properties =
from->characteristic.properties;
from->characteristic.properties.clear();
- scoped_ptr<base::DictionaryValue> to = from->ToValue();
+ std::unique_ptr<base::DictionaryValue> to = from->ToValue();
base::DictionaryValue* chrc_value = NULL;
to->GetDictionaryWithoutPathExpansion("characteristic", &chrc_value);
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/utils.h b/chrome/browser/extensions/api/bluetooth_low_energy/utils.h
index b58a6c54..18821d7 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/utils.h
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/utils.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_UTILS_H_
#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_UTILS_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/values.h"
#include "chrome/common/extensions/api/bluetooth_low_energy.h"
@@ -20,12 +21,13 @@
// json_schema_compiler::util::AddItemToList has no template specialization for
// user defined enums, which get treated as integers. This is because
// Characteristic contains a list of enum CharacteristicProperty.
-scoped_ptr<base::DictionaryValue> CharacteristicToValue(Characteristic* from);
+std::unique_ptr<base::DictionaryValue> CharacteristicToValue(
+ Characteristic* from);
// Converts a Descriptor to a base::Value. This function is necessary as a
// Descriptor embeds a Characteristic and that needs special handling as
// described above.
-scoped_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from);
+std::unique_ptr<base::DictionaryValue> DescriptorToValue(Descriptor* from);
} // namespace bluetooth_low_energy
} // namespace api
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
index edba122..9b57f6c 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -6,11 +6,13 @@
#include <stddef.h>
#include <stdint.h>
+
#include <utility>
#include <vector>
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -185,9 +187,9 @@
void BookmarkManagerPrivateEventRouter::DispatchEvent(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
+ std::unique_ptr<base::ListValue> event_args) {
EventRouter::Get(browser_context_)
- ->BroadcastEvent(make_scoped_ptr(
+ ->BroadcastEvent(base::WrapUnique(
new Event(histogram_value, event_name, std::move(event_args))));
}
@@ -301,12 +303,12 @@
void BookmarkManagerPrivateDragEventRouter::DispatchEvent(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
EventRouter* event_router = EventRouter::Get(profile_);
if (!event_router)
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
event_router->BroadcastEvent(std::move(event));
}
@@ -377,7 +379,7 @@
}
bool BookmarkManagerPrivateCopyFunction::RunOnReady() {
- scoped_ptr<Copy::Params> params(Copy::Params::Create(*args_));
+ std::unique_ptr<Copy::Params> params(Copy::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
return CopyOrCut(false, params->id_list);
}
@@ -386,7 +388,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<Cut::Params> params(Cut::Params::Create(*args_));
+ std::unique_ptr<Cut::Params> params(Cut::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
return CopyOrCut(true, params->id_list);
}
@@ -395,7 +397,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<Paste::Params> params(Paste::Params::Create(*args_));
+ std::unique_ptr<Paste::Params> params(Paste::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id);
@@ -423,7 +425,7 @@
}
bool BookmarkManagerPrivateCanPasteFunction::RunOnReady() {
- scoped_ptr<CanPaste::Params> params(CanPaste::Params::Create(*args_));
+ std::unique_ptr<CanPaste::Params> params(CanPaste::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
@@ -447,7 +449,8 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<SortChildren::Params> params(SortChildren::Params::Create(*args_));
+ std::unique_ptr<SortChildren::Params> params(
+ SortChildren::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
@@ -549,7 +552,7 @@
return false;
}
- scoped_ptr<StartDrag::Params> params(StartDrag::Params::Create(*args_));
+ std::unique_ptr<StartDrag::Params> params(StartDrag::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
@@ -575,7 +578,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<Drop::Params> params(Drop::Params::Create(*args_));
+ std::unique_ptr<Drop::Params> params(Drop::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
@@ -618,7 +621,8 @@
}
bool BookmarkManagerPrivateGetSubtreeFunction::RunOnReady() {
- scoped_ptr<GetSubtree::Params> params(GetSubtree::Params::Create(*args_));
+ std::unique_ptr<GetSubtree::Params> params(
+ GetSubtree::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const BookmarkNode* node = NULL;
@@ -658,7 +662,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<CreateWithMetaInfo::Params> params(
+ std::unique_ptr<CreateWithMetaInfo::Params> params(
CreateWithMetaInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -677,7 +681,8 @@
}
bool BookmarkManagerPrivateGetMetaInfoFunction::RunOnReady() {
- scoped_ptr<GetMetaInfo::Params> params(GetMetaInfo::Params::Create(*args_));
+ std::unique_ptr<GetMetaInfo::Params> params(
+ GetMetaInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
if (params->id) {
@@ -731,7 +736,8 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<SetMetaInfo::Params> params(SetMetaInfo::Params::Create(*args_));
+ std::unique_ptr<SetMetaInfo::Params> params(
+ SetMetaInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const BookmarkNode* node = GetBookmarkNodeFromId(params->id);
@@ -755,7 +761,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<UpdateMetaInfo::Params> params(
+ std::unique_ptr<UpdateMetaInfo::Params> params(
UpdateMetaInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -793,7 +799,8 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<RemoveTrees::Params> params(RemoveTrees::Params::Create(*args_));
+ std::unique_ptr<RemoveTrees::Params> params(
+ RemoveTrees::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
BookmarkModel* model = GetBookmarkModel();
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
index 3943a235..ba4b298 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_PRIVATE_API_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
@@ -51,7 +52,7 @@
// Helper to actually dispatch an event to extension listeners.
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
// Remembers the previous meta info of a node before it was changed.
bookmarks::BookmarkNode::MetaInfoMap prev_meta_info_;
@@ -86,7 +87,7 @@
content::BrowserContext* browser_context_;
// Created lazily upon OnListenerAdded.
- scoped_ptr<BookmarkManagerPrivateEventRouter> event_router_;
+ std::unique_ptr<BookmarkManagerPrivateEventRouter> event_router_;
};
// Class that handles the drag and drop related chrome.bookmarkManagerPrivate
@@ -115,7 +116,7 @@
// Helper to actually dispatch an event to extension listeners.
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args);
+ std::unique_ptr<base::ListValue> args);
Profile* profile_;
content::WebContents* web_contents_;
diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc b/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc
index 8e05d7de..392b95e 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc
@@ -6,7 +6,8 @@
#include <stdint.h>
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
index 8dce0ac..a21f74a1 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h"
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -12,7 +14,7 @@
#include "base/i18n/file_util_icu.h"
#include "base/i18n/time_formatting.h"
#include "base/lazy_instance.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/sha1.h"
#include "base/stl_util.h"
@@ -257,10 +259,10 @@
void BookmarkEventRouter::DispatchEvent(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
+ std::unique_ptr<base::ListValue> event_args) {
EventRouter* event_router = EventRouter::Get(browser_context_);
if (event_router) {
- event_router->BroadcastEvent(make_scoped_ptr(new extensions::Event(
+ event_router->BroadcastEvent(base::WrapUnique(new extensions::Event(
histogram_value, event_name, std::move(event_args))));
}
}
@@ -416,7 +418,7 @@
}
bool BookmarksGetFunction::RunOnReady() {
- scoped_ptr<bookmarks::Get::Params> params(
+ std::unique_ptr<bookmarks::Get::Params> params(
bookmarks::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -445,7 +447,7 @@
}
bool BookmarksGetChildrenFunction::RunOnReady() {
- scoped_ptr<bookmarks::GetChildren::Params> params(
+ std::unique_ptr<bookmarks::GetChildren::Params> params(
bookmarks::GetChildren::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -466,7 +468,7 @@
}
bool BookmarksGetRecentFunction::RunOnReady() {
- scoped_ptr<bookmarks::GetRecent::Params> params(
+ std::unique_ptr<bookmarks::GetRecent::Params> params(
bookmarks::GetRecent::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->number_of_items < 1)
@@ -499,7 +501,7 @@
}
bool BookmarksGetSubTreeFunction::RunOnReady() {
- scoped_ptr<bookmarks::GetSubTree::Params> params(
+ std::unique_ptr<bookmarks::GetSubTree::Params> params(
bookmarks::GetSubTree::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -515,7 +517,7 @@
}
bool BookmarksSearchFunction::RunOnReady() {
- scoped_ptr<bookmarks::Search::Params> params(
+ std::unique_ptr<bookmarks::Search::Params> params(
bookmarks::Search::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -577,7 +579,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<bookmarks::Remove::Params> params(
+ std::unique_ptr<bookmarks::Remove::Params> params(
bookmarks::Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -601,7 +603,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<bookmarks::Create::Params> params(
+ std::unique_ptr<bookmarks::Create::Params> params(
bookmarks::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -629,7 +631,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<bookmarks::Move::Params> params(
+ std::unique_ptr<bookmarks::Move::Params> params(
bookmarks::Move::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -689,7 +691,7 @@
if (!EditBookmarksEnabled())
return false;
- scoped_ptr<bookmarks::Update::Params> params(
+ std::unique_ptr<bookmarks::Update::Params> params(
bookmarks::Update::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
index ea12948..a04fc0b 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
@@ -84,7 +84,7 @@
// Helper to actually dispatch an event to extension listeners.
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
content::BrowserContext* browser_context_;
bookmarks::BookmarkModel* model_;
@@ -120,7 +120,7 @@
static const bool kServiceIsNULLWhileTesting = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<BookmarkEventRouter> bookmark_event_router_;
+ std::unique_ptr<BookmarkEventRouter> bookmark_event_router_;
};
class BookmarksFunction : public ChromeAsyncExtensionFunction,
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_controller.h b/chrome/browser/extensions/api/braille_display_private/braille_controller.h
index 88c9b41..73ec3e6 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_controller.h
+++ b/chrome/browser/extensions/api/braille_display_private/braille_controller.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER_H_
#define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER_H_
+#include <memory>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/common/extensions/api/braille_display_private.h"
@@ -23,7 +23,7 @@
public:
static BrailleController* GetInstance();
- virtual scoped_ptr<DisplayState> GetDisplayState() = 0;
+ virtual std::unique_ptr<DisplayState> GetDisplayState() = 0;
virtual void WriteDots(const std::vector<char>& cells) = 0;
virtual void AddObserver(BrailleObserver* observer) = 0;
virtual void RemoveObserver(BrailleObserver* observer) = 0;
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc b/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
index dd505a6..78e8450 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
+++ b/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
@@ -82,10 +82,10 @@
LOG(WARNING) << "Couldn't load libbrlapi: " << strerror(errno);
}
-scoped_ptr<DisplayState> BrailleControllerImpl::GetDisplayState() {
+std::unique_ptr<DisplayState> BrailleControllerImpl::GetDisplayState() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
StartConnecting();
- scoped_ptr<DisplayState> display_state(new DisplayState);
+ std::unique_ptr<DisplayState> display_state(new DisplayState);
if (connection_.get() && connection_->Connected()) {
size_t size;
if (!connection_->GetDisplaySize(&size)) {
@@ -261,10 +261,12 @@
if (!connection_ || !connection_->Connected())
return;
connection_->Disconnect();
- DispatchOnDisplayStateChanged(scoped_ptr<DisplayState>(new DisplayState()));
+ DispatchOnDisplayStateChanged(
+ std::unique_ptr<DisplayState>(new DisplayState()));
}
-scoped_ptr<BrlapiConnection> BrailleControllerImpl::CreateBrlapiConnection() {
+std::unique_ptr<BrlapiConnection>
+BrailleControllerImpl::CreateBrlapiConnection() {
DCHECK(libbrlapi_loader_.loaded());
return BrlapiConnection::Create(&libbrlapi_loader_);
}
@@ -285,13 +287,13 @@
} else if (result == 0) { // No more data.
return;
}
- scoped_ptr<KeyEvent> event = BrlapiKeyCodeToEvent(code);
+ std::unique_ptr<KeyEvent> event = BrlapiKeyCodeToEvent(code);
if (event)
DispatchKeyEvent(std::move(event));
}
}
-void BrailleControllerImpl::DispatchKeyEvent(scoped_ptr<KeyEvent> event) {
+void BrailleControllerImpl::DispatchKeyEvent(std::unique_ptr<KeyEvent> event) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(
@@ -305,7 +307,7 @@
}
void BrailleControllerImpl::DispatchOnDisplayStateChanged(
- scoped_ptr<DisplayState> new_state) {
+ std::unique_ptr<DisplayState> new_state) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
if (!BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.h b/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.h
index 63f87ac..aafa57d 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.h
+++ b/chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.h
@@ -5,10 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER_BRLAPI_H_
#define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER_BRLAPI_H_
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "chrome/browser/extensions/api/braille_display_private/braille_controller.h"
@@ -23,7 +24,7 @@
class BrailleControllerImpl : public BrailleController {
public:
static BrailleControllerImpl* GetInstance();
- scoped_ptr<DisplayState> GetDisplayState() override;
+ std::unique_ptr<DisplayState> GetDisplayState() override;
void WriteDots(const std::vector<char>& cells) override;
void AddObserver(BrailleObserver* observer) override;
void RemoveObserver(BrailleObserver* observer) override;
@@ -37,7 +38,7 @@
~BrailleControllerImpl() override;
void TryLoadLibBrlApi();
- typedef base::Callback<scoped_ptr<BrlapiConnection>()>
+ typedef base::Callback<std::unique_ptr<BrlapiConnection>()>
CreateBrlapiConnectionFunction;
// For dependency injection in tests. Sets the function used to create
@@ -59,16 +60,16 @@
void ResetRetryConnectHorizon();
void ScheduleTryToConnect();
void Disconnect();
- scoped_ptr<BrlapiConnection> CreateBrlapiConnection();
+ std::unique_ptr<BrlapiConnection> CreateBrlapiConnection();
void DispatchKeys();
- void DispatchKeyEvent(scoped_ptr<KeyEvent> event);
- void DispatchOnDisplayStateChanged(scoped_ptr<DisplayState> new_state);
+ void DispatchKeyEvent(std::unique_ptr<KeyEvent> event);
+ void DispatchOnDisplayStateChanged(std::unique_ptr<DisplayState> new_state);
CreateBrlapiConnectionFunction create_brlapi_connection_function_;
// Manipulated on the IO thread.
LibBrlapiLoader libbrlapi_loader_;
- scoped_ptr<BrlapiConnection> connection_;
+ std::unique_ptr<BrlapiConnection> connection_;
bool started_connecting_;
bool connect_scheduled_;
base::Time retry_connect_horizon_;
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_controller_stub.cc b/chrome/browser/extensions/api/braille_display_private/braille_controller_stub.cc
index e57108f..46a76182 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_controller_stub.cc
+++ b/chrome/browser/extensions/api/braille_display_private/braille_controller_stub.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/braille_display_private/braille_controller.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/memory/singleton.h"
#include "chrome/browser/extensions/api/braille_display_private/stub_braille_controller.h"
#include "chrome/common/extensions/api/braille_display_private.h"
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
index 74a0164..ad56f81 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
+++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
@@ -33,7 +33,7 @@
DefaultEventDelegate(EventRouter::Observer* observer, Profile* profile);
~DefaultEventDelegate() override;
- void BroadcastEvent(scoped_ptr<Event> event) override;
+ void BroadcastEvent(std::unique_ptr<Event> event) override;
bool HasListener() override;
private:
@@ -65,7 +65,7 @@
void BrailleDisplayPrivateAPI::OnBrailleDisplayStateChanged(
const DisplayState& display_state) {
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::BRAILLE_DISPLAY_PRIVATE_ON_DISPLAY_STATE_CHANGED,
OnDisplayStateChanged::kEventName,
OnDisplayStateChanged::Create(display_state)));
@@ -76,7 +76,7 @@
// Key events only go to extensions of the active profile.
if (!IsProfileActive())
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::BRAILLE_DISPLAY_PRIVATE_ON_KEY_EVENT,
OnKeyEvent::kEventName, OnKeyEvent::Create(key_event)));
event_delegate_->BroadcastEvent(std::move(event));
@@ -102,7 +102,7 @@
}
void BrailleDisplayPrivateAPI::SetEventDelegateForTest(
- scoped_ptr<EventDelegate> delegate) {
+ std::unique_ptr<EventDelegate> delegate) {
event_delegate_ = std::move(delegate);
}
@@ -135,7 +135,7 @@
}
void BrailleDisplayPrivateAPI::DefaultEventDelegate::BroadcastEvent(
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
EventRouter::Get(profile_)->BroadcastEvent(std::move(event));
}
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h
index c1b23e7..552e1f75 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h
+++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h
@@ -53,7 +53,7 @@
class EventDelegate {
public:
virtual ~EventDelegate() {}
- virtual void BroadcastEvent(scoped_ptr<Event> event) = 0;
+ virtual void BroadcastEvent(std::unique_ptr<Event> event) = 0;
virtual bool HasListener() = 0;
};
@@ -63,12 +63,12 @@
// the active profile.
bool IsProfileActive();
- void SetEventDelegateForTest(scoped_ptr<EventDelegate> delegate);
+ void SetEventDelegateForTest(std::unique_ptr<EventDelegate> delegate);
Profile* profile_;
ScopedObserver<api::braille_display_private::BrailleController,
BrailleObserver> scoped_observer_;
- scoped_ptr<EventDelegate> event_delegate_;
+ std::unique_ptr<EventDelegate> event_delegate_;
// BrowserContextKeyedAPI implementation.
static const char* service_name() {
@@ -103,7 +103,7 @@
bool Respond() override;
private:
- scoped_ptr<braille_display_private::WriteDots::Params> params_;
+ std::unique_ptr<braille_display_private::WriteDots::Params> params_;
};
} // namespace api
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc b/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc
index 9aad594c..c69dc92 100644
--- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc
+++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc
@@ -169,8 +169,8 @@
}
private:
- scoped_ptr<BrlapiConnection> CreateBrlapiConnection() {
- return scoped_ptr<BrlapiConnection>(
+ std::unique_ptr<BrlapiConnection> CreateBrlapiConnection() {
+ return std::unique_ptr<BrlapiConnection>(
new MockBrlapiConnection(&connection_data_));
}
@@ -277,7 +277,9 @@
int GetEventCount() { return event_count_; }
- void BroadcastEvent(scoped_ptr<Event> event) override { ++event_count_; }
+ void BroadcastEvent(std::unique_ptr<Event> event) override {
+ ++event_count_;
+ }
bool HasListener() override { return true; }
private:
@@ -287,7 +289,7 @@
MockEventDelegate* SetMockEventDelegate(BrailleDisplayPrivateAPI* api) {
MockEventDelegate* delegate = new MockEventDelegate();
api->SetEventDelegateForTest(
- scoped_ptr<BrailleDisplayPrivateAPI::EventDelegate>(delegate));
+ std::unique_ptr<BrailleDisplayPrivateAPI::EventDelegate>(delegate));
return delegate;
}
@@ -326,7 +328,7 @@
#endif
IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest,
MAYBE_KeyEventOnLockScreen) {
- scoped_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester());
+ std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester());
// Log in.
user_manager::UserManager::Get()->UserLoggedIn(
AccountId::FromUserEmail(kTestUserName), kTestUserName, true);
diff --git a/chrome/browser/extensions/api/braille_display_private/brlapi_connection.cc b/chrome/browser/extensions/api/braille_display_private/brlapi_connection.cc
index c2531cd..5739710 100644
--- a/chrome/browser/extensions/api/braille_display_private/brlapi_connection.cc
+++ b/chrome/browser/extensions/api/braille_display_private/brlapi_connection.cc
@@ -57,7 +57,7 @@
ConnectResult ConnectResultForError();
LibBrlapiLoader* libbrlapi_loader_;
- scoped_ptr<brlapi_handle_t, base::FreeDeleter> handle_;
+ std::unique_ptr<brlapi_handle_t, base::FreeDeleter> handle_;
MessageLoopForIO::FileDescriptorWatcher fd_controller_;
OnDataReadyCallback on_data_ready_;
@@ -70,10 +70,10 @@
BrlapiConnection::~BrlapiConnection() {
}
-scoped_ptr<BrlapiConnection> BrlapiConnection::Create(
+std::unique_ptr<BrlapiConnection> BrlapiConnection::Create(
LibBrlapiLoader* loader) {
DCHECK(loader->loaded());
- return scoped_ptr<BrlapiConnection>(new BrlapiConnectionImpl(loader));
+ return std::unique_ptr<BrlapiConnection>(new BrlapiConnectionImpl(loader));
}
BrlapiConnection::ConnectResult BrlapiConnectionImpl::Connect(
diff --git a/chrome/browser/extensions/api/braille_display_private/brlapi_connection.h b/chrome/browser/extensions/api/braille_display_private/brlapi_connection.h
index a8efef5..f1cba4340 100644
--- a/chrome/browser/extensions/api/braille_display_private/brlapi_connection.h
+++ b/chrome/browser/extensions/api/braille_display_private/brlapi_connection.h
@@ -7,9 +7,10 @@
#include <stddef.h>
+#include <memory>
+
#include "base/callback_forward.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "library_loaders/libbrlapi.h"
namespace extensions {
@@ -28,7 +29,7 @@
CONNECT_SUCCESS,
};
- static scoped_ptr<BrlapiConnection> Create(LibBrlapiLoader* loader);
+ static std::unique_ptr<BrlapiConnection> Create(LibBrlapiLoader* loader);
virtual ~BrlapiConnection();
diff --git a/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.cc b/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.cc
index e77426b..1e8a953 100644
--- a/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.cc
+++ b/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.cc
@@ -152,8 +152,8 @@
} // namespace
-scoped_ptr<KeyEvent> BrlapiKeyCodeToEvent(brlapi_keyCode_t code) {
- scoped_ptr<KeyEvent> result(new KeyEvent);
+std::unique_ptr<KeyEvent> BrlapiKeyCodeToEvent(brlapi_keyCode_t code) {
+ std::unique_ptr<KeyEvent> result(new KeyEvent);
result->command = KEY_COMMAND_NONE;
switch (code & BRLAPI_KEY_TYPE_MASK) {
case BRLAPI_KEY_TYPE_SYM:
diff --git a/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.h b/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.h
index 177e058b..a8f64227 100644
--- a/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.h
+++ b/chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_KEYCODE_MAP_H_
#define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_KEYCODE_MAP_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "chrome/common/extensions/api/braille_display_private.h"
#include "library_loaders/libbrlapi.h"
@@ -14,7 +15,7 @@
namespace braille_display_private {
// Maps a 64 bit BrlAPI keycode to a braille |KeyEvent| object.
-scoped_ptr<KeyEvent> BrlapiKeyCodeToEvent(brlapi_keyCode_t code);
+std::unique_ptr<KeyEvent> BrlapiKeyCodeToEvent(brlapi_keyCode_t code);
} // namespace braille_display_private
} // namespace api
diff --git a/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.cc b/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.cc
index 1b78c8c..0bfd5f9c 100644
--- a/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.cc
+++ b/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.cc
@@ -11,8 +11,8 @@
MockBrailleController::MockBrailleController()
: available_(false), observer_(NULL) {}
-scoped_ptr<DisplayState> MockBrailleController::GetDisplayState() {
- scoped_ptr<DisplayState> state(new DisplayState());
+std::unique_ptr<DisplayState> MockBrailleController::GetDisplayState() {
+ std::unique_ptr<DisplayState> state(new DisplayState());
state->available = available_;
if (available_)
state->text_cell_count.reset(new int(18));
diff --git a/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h b/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h
index 9ce52bc9..1979985 100644
--- a/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h
+++ b/chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h
@@ -16,7 +16,7 @@
public:
MockBrailleController();
- scoped_ptr<DisplayState> GetDisplayState() override;
+ std::unique_ptr<DisplayState> GetDisplayState() override;
void AddObserver(BrailleObserver* observer) override;
void RemoveObserver(BrailleObserver* observer) override;
diff --git a/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.cc b/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.cc
index d1011f4..ac30bdd 100644
--- a/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.cc
+++ b/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.cc
@@ -11,8 +11,8 @@
StubBrailleController::StubBrailleController() {
}
-scoped_ptr<DisplayState> StubBrailleController::GetDisplayState() {
- return scoped_ptr<DisplayState>(new DisplayState);
+std::unique_ptr<DisplayState> StubBrailleController::GetDisplayState() {
+ return std::unique_ptr<DisplayState>(new DisplayState);
}
void StubBrailleController::WriteDots(const std::vector<char>& cells) {
diff --git a/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.h b/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.h
index 19a6476d..4184d04 100644
--- a/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.h
+++ b/chrome/browser/extensions/api/braille_display_private/stub_braille_controller.h
@@ -16,7 +16,7 @@
class StubBrailleController : public BrailleController {
public:
StubBrailleController();
- scoped_ptr<DisplayState> GetDisplayState() override;
+ std::unique_ptr<DisplayState> GetDisplayState() override;
void WriteDots(const std::vector<char>& cells) override;
void AddObserver(BrailleObserver* observer) override;
void RemoveObserver(BrailleObserver* observer) override;
diff --git a/chrome/browser/extensions/api/browser/browser_api.cc b/chrome/browser/extensions/api/browser/browser_api.cc
index 7e1a64bd..78bd303 100644
--- a/chrome/browser/extensions/api/browser/browser_api.cc
+++ b/chrome/browser/extensions/api/browser/browser_api.cc
@@ -13,7 +13,7 @@
}
bool BrowserOpenTabFunction::RunSync() {
- scoped_ptr<browser::OpenTab::Params> params(
+ std::unique_ptr<browser::OpenTab::Params> params(
browser::OpenTab::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -22,7 +22,7 @@
options.url.reset(new std::string(params->options.url));
std::string error;
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
ExtensionTabUtil::OpenTab(this, options, &error));
if (!result) {
SetError(error);
diff --git a/chrome/browser/extensions/api/browser/browser_apitest.cc b/chrome/browser/extensions/api/browser/browser_apitest.cc
index eae51aa..d250398 100644
--- a/chrome/browser/extensions/api/browser/browser_apitest.cc
+++ b/chrome/browser/extensions/api/browser/browser_apitest.cc
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/browser/browser_api.h"
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
index 8a6a446a..30e7b61 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
@@ -130,7 +130,8 @@
// REMOVE_SITE_DATA in browsing_data_remover.h, the former for the unprotected
// web, the latter for protected web data. There is no UI control for
// extension data.
- scoped_ptr<base::DictionaryValue> origin_types(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> origin_types(
+ new base::DictionaryValue);
origin_types->SetBoolean(
extension_browsing_data_api_constants::kUnprotectedWebKey,
prefs->GetBoolean(prefs::kDeleteCookies));
@@ -150,14 +151,14 @@
since = time.ToJsTime();
}
- scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue);
options->Set(extension_browsing_data_api_constants::kOriginTypesKey,
origin_types.release());
options->SetDouble(extension_browsing_data_api_constants::kSinceKey, since);
// Fill dataToRemove and dataRemovalPermitted.
- scoped_ptr<base::DictionaryValue> selected(new base::DictionaryValue);
- scoped_ptr<base::DictionaryValue> permitted(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> selected(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> permitted(new base::DictionaryValue);
bool delete_site_data = prefs->GetBoolean(prefs::kDeleteCookies) ||
prefs->GetBoolean(prefs::kDeleteHostedAppsData);
@@ -210,7 +211,7 @@
extension_browsing_data_api_constants::kPasswordsKey,
prefs->GetBoolean(prefs::kDeletePasswords));
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->Set(extension_browsing_data_api_constants::kOptionsKey,
options.release());
result->Set(extension_browsing_data_api_constants::kDataToRemoveKey,
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
index 4340bfe..bd999e3 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -2,11 +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 <string>
#include "base/json/json_string_value_serializer.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -136,7 +136,7 @@
scoped_refptr<BrowsingDataSettingsFunction> function =
new BrowsingDataSettingsFunction();
SCOPED_TRACE("settings");
- scoped_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult(
function.get(), std::string("[]"), browser()));
base::DictionaryValue* result;
@@ -185,7 +185,7 @@
scoped_refptr<BrowsingDataSettingsFunction> function =
new BrowsingDataSettingsFunction();
SCOPED_TRACE("settings");
- scoped_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult(
function.get(), std::string("[]"), browser()));
base::DictionaryValue* result;
@@ -257,7 +257,8 @@
}
private:
- scoped_ptr<BrowsingDataRemover::NotificationDetails> called_with_details_;
+ std::unique_ptr<BrowsingDataRemover::NotificationDetails>
+ called_with_details_;
BrowsingDataRemover::CallbackSubscription callback_subscription_;
};
@@ -424,7 +425,7 @@
scoped_refptr<BrowsingDataSettingsFunction> settings_function =
new BrowsingDataSettingsFunction();
SCOPED_TRACE("settings_json");
- scoped_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult(
settings_function.get(), std::string("[]"), browser()));
base::DictionaryValue* result;
diff --git a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc
index ce17cbf..6789ef84 100644
--- a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc
+++ b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc
@@ -7,12 +7,12 @@
#include <algorithm>
#include <cmath>
+#include <memory>
#include <vector>
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -156,7 +156,7 @@
}
// Invoked by InProcessReceiver for each received audio frame.
- void OnAudioFrame(scoped_ptr<media::AudioBus> audio_frame,
+ void OnAudioFrame(std::unique_ptr<media::AudioBus> audio_frame,
const base::TimeTicks& playout_time,
bool is_continuous) override {
DCHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN));
@@ -296,7 +296,7 @@
if (region.IsEmpty())
return 0;
const size_t num_values = region.size().GetArea();
- scoped_ptr<uint8_t[]> values(new uint8_t[num_values]);
+ std::unique_ptr<uint8_t[]> values(new uint8_t[num_values]);
for (int y = 0; y < region.height(); ++y) {
memcpy(values.get() + y * region.width(),
data + (region.y() + y) * stride + region.x(),
@@ -344,7 +344,7 @@
#define MAYBE_EndToEnd DISABLED_EndToEnd
#endif
IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, MAYBE_EndToEnd) {
- scoped_ptr<net::UDPServerSocket> receive_socket(
+ std::unique_ptr<net::UDPServerSocket> receive_socket(
new net::UDPServerSocket(NULL, net::NetLog::Source()));
receive_socket->AllowAddressReuse();
ASSERT_EQ(net::OK, receive_socket->Listen(GetFreeLocalPort()));
diff --git a/chrome/browser/extensions/api/cast_streaming/performance_test.cc b/chrome/browser/extensions/api/cast_streaming/performance_test.cc
index c49275e..b70f296 100644
--- a/chrome/browser/extensions/api/cast_streaming/performance_test.cc
+++ b/chrome/browser/extensions/api/cast_streaming/performance_test.cc
@@ -236,7 +236,7 @@
private:
// Invoked by InProcessReceiver for each received audio frame.
- void OnAudioFrame(scoped_ptr<media::AudioBus> audio_frame,
+ void OnAudioFrame(std::unique_ptr<media::AudioBus> audio_frame,
const base::TimeTicks& playout_time,
bool is_continuous) override {
CHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN));
@@ -335,7 +335,7 @@
// Determine a unused UDP port for the in-process receiver to listen on.
// Method: Bind a UDP socket on port 0, and then check which port the
// operating system assigned to it.
- scoped_ptr<net::UDPServerSocket> receive_socket(
+ std::unique_ptr<net::UDPServerSocket> receive_socket(
new net::UDPServerSocket(NULL, net::NetLog::Source()));
receive_socket->AllowAddressReuse();
CHECK_EQ(net::OK, receive_socket->Listen(
@@ -585,7 +585,7 @@
new TestPatternReceiver(cast_environment, receiver_end_point);
receiver->Start();
- scoped_ptr<media::cast::test::UDPProxy> udp_proxy;
+ std::unique_ptr<media::cast::test::UDPProxy> udp_proxy;
if (HasFlag(kProxyWifi) || HasFlag(kProxyBad)) {
net::IPEndPoint proxy_end_point = GetFreeLocalPort();
if (HasFlag(kProxyWifi)) {
@@ -616,7 +616,7 @@
// Stop all threads, removes the need for synchronization when analyzing
// the data.
cast_environment->Shutdown();
- scoped_ptr<trace_analyzer::TraceAnalyzer> analyzer;
+ std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer;
analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events));
analyzer->AssociateAsyncBeginEndEvents();
diff --git a/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc b/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc
index a4f4c3e..cdf49c4 100644
--- a/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc
+++ b/chrome/browser/extensions/api/certificate_provider/certificate_provider_api.cc
@@ -7,10 +7,10 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include <vector>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service.h"
#include "chrome/browser/chromeos/certificate_provider/certificate_provider_service_factory.h"
#include "chrome/common/extensions/api/certificate_provider.h"
@@ -40,7 +40,7 @@
ExtensionFunction::ResponseAction
CertificateProviderInternalReportCertificatesFunction::Run() {
- scoped_ptr<api_cpi::ReportCertificates::Params> params(
+ std::unique_ptr<api_cpi::ReportCertificates::Params> params(
api_cpi::ReportCertificates::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -153,7 +153,7 @@
ExtensionFunction::ResponseAction
CertificateProviderInternalReportSignatureFunction::Run() {
- scoped_ptr<api_cpi::ReportSignature::Params> params(
+ std::unique_ptr<api_cpi::ReportSignature::Params> params(
api_cpi::ReportSignature::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
diff --git a/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc b/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
index 8d7913db..2c769371 100644
--- a/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
+++ b/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <stdlib.h>
+#include <memory>
#include <string>
#include <vector>
@@ -15,7 +16,6 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -140,7 +140,7 @@
const std::string autoselect_pattern =
"{\"pattern\": \"*\", \"filter\": {\"ISSUER\": {\"CN\": \"root\"}}}";
- scoped_ptr<base::ListValue> autoselect_policy(new base::ListValue);
+ std::unique_ptr<base::ListValue> autoselect_policy(new base::ListValue);
autoselect_policy->AppendString(autoselect_pattern);
policy::PolicyMap policy;
@@ -213,7 +213,7 @@
const uint8_t* const key_pk8_begin =
reinterpret_cast<const uint8_t*>(key_pk8.data());
- scoped_ptr<crypto::RSAPrivateKey> key(
+ std::unique_ptr<crypto::RSAPrivateKey> key(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(
std::vector<uint8_t>(key_pk8_begin, key_pk8_begin + key_pk8.size())));
ASSERT_TRUE(key);
diff --git a/chrome/browser/extensions/api/chrome_extensions_api_client.cc b/chrome/browser/extensions/api/chrome_extensions_api_client.cc
index b9b2b09..f2295a5c 100644
--- a/chrome/browser/extensions/api/chrome_extensions_api_client.cc
+++ b/chrome/browser/extensions/api/chrome_extensions_api_client.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
#include "chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h"
@@ -76,9 +77,8 @@
#endif // defined(ENABLE_PRINT_PREVIEW)
#endif // defined(ENABLE_PRINTING)
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
- web_contents,
- scoped_ptr<pdf::PDFWebContentsHelperClient>(
- new ChromePDFWebContentsHelperClient()));
+ web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>(
+ new ChromePDFWebContentsHelperClient()));
extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
web_contents);
@@ -95,16 +95,16 @@
return new ChromeExtensionOptionsGuestDelegate(guest);
}
-scoped_ptr<guest_view::GuestViewManagerDelegate>
+std::unique_ptr<guest_view::GuestViewManagerDelegate>
ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate(
content::BrowserContext* context) const {
- return make_scoped_ptr(new ChromeGuestViewManagerDelegate(context));
+ return base::WrapUnique(new ChromeGuestViewManagerDelegate(context));
}
-scoped_ptr<MimeHandlerViewGuestDelegate>
+std::unique_ptr<MimeHandlerViewGuestDelegate>
ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const {
- return make_scoped_ptr(new ChromeMimeHandlerViewGuestDelegate());
+ return base::WrapUnique(new ChromeMimeHandlerViewGuestDelegate());
}
WebViewGuestDelegate* ChromeExtensionsAPIClient::CreateWebViewGuestDelegate(
@@ -135,16 +135,16 @@
base::Unretained(browser_context))));
}
-scoped_ptr<DevicePermissionsPrompt>
+std::unique_ptr<DevicePermissionsPrompt>
ChromeExtensionsAPIClient::CreateDevicePermissionsPrompt(
content::WebContents* web_contents) const {
- return make_scoped_ptr(new ChromeDevicePermissionsPrompt(web_contents));
+ return base::WrapUnique(new ChromeDevicePermissionsPrompt(web_contents));
}
-scoped_ptr<VirtualKeyboardDelegate>
+std::unique_ptr<VirtualKeyboardDelegate>
ChromeExtensionsAPIClient::CreateVirtualKeyboardDelegate() const {
#if defined(OS_CHROMEOS)
- return make_scoped_ptr(new ChromeVirtualKeyboardDelegate());
+ return base::WrapUnique(new ChromeVirtualKeyboardDelegate());
#else
return nullptr;
#endif
diff --git a/chrome/browser/extensions/api/chrome_extensions_api_client.h b/chrome/browser/extensions/api/chrome_extensions_api_client.h
index 4333730..cfa11b39 100644
--- a/chrome/browser/extensions/api/chrome_extensions_api_client.h
+++ b/chrome/browser/extensions/api/chrome_extensions_api_client.h
@@ -30,10 +30,11 @@
AppViewGuestDelegate* CreateAppViewGuestDelegate() const override;
ExtensionOptionsGuestDelegate* CreateExtensionOptionsGuestDelegate(
ExtensionOptionsGuest* guest) const override;
- scoped_ptr<guest_view::GuestViewManagerDelegate>
- CreateGuestViewManagerDelegate(
- content::BrowserContext* context) const override;
- scoped_ptr<MimeHandlerViewGuestDelegate> CreateMimeHandlerViewGuestDelegate(
+ std::unique_ptr<guest_view::GuestViewManagerDelegate>
+ CreateGuestViewManagerDelegate(
+ content::BrowserContext* context) const override;
+ std::unique_ptr<MimeHandlerViewGuestDelegate>
+ CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const override;
WebViewGuestDelegate* CreateWebViewGuestDelegate(
WebViewGuest* web_view_guest) const override;
@@ -44,9 +45,9 @@
scoped_refptr<ContentRulesRegistry> CreateContentRulesRegistry(
content::BrowserContext* browser_context,
RulesCacheDelegate* cache_delegate) const override;
- scoped_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
+ std::unique_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
content::WebContents* web_contents) const override;
- scoped_ptr<VirtualKeyboardDelegate> CreateVirtualKeyboardDelegate()
+ std::unique_ptr<VirtualKeyboardDelegate> CreateVirtualKeyboardDelegate()
const override;
ManagementAPIDelegate* CreateManagementAPIDelegate() const override;
diff --git a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc
index 0de30f6f..2f590068 100644
--- a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc
+++ b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc
@@ -40,7 +40,7 @@
bool CloudPrintPrivateSetupConnectorFunction::RunAsync() {
#if defined(ENABLE_PRINT_PREVIEW)
using api::cloud_print_private::SetupConnector::Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
if (CloudPrintTestsDelegate::instance()) {
CloudPrintTestsDelegate::instance()->SetupConnector(
params->user_email,
@@ -52,7 +52,7 @@
CloudPrintProxyServiceFactory::GetForProfile(GetProfile());
if (!service)
return false;
- scoped_ptr<base::DictionaryValue> user_setings(
+ std::unique_ptr<base::DictionaryValue> user_setings(
params->user_settings.ToValue());
service->EnableForUserWithRobot(params->credentials,
params->robot_email,
diff --git a/chrome/browser/extensions/api/command_line_private/command_line_private_api.cc b/chrome/browser/extensions/api/command_line_private/command_line_private_api.cc
index 37bef4ef..fec43b8c 100644
--- a/chrome/browser/extensions/api/command_line_private/command_line_private_api.cc
+++ b/chrome/browser/extensions/api/command_line_private/command_line_private_api.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/extensions/api/command_line_private/command_line_private_api.h"
+#include <memory>
#include <string>
#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/common/extensions/api/command_line_private.h"
@@ -22,7 +22,7 @@
namespace command_line_private = api::command_line_private;
bool CommandLinePrivateHasSwitchFunction::RunSync() {
- scoped_ptr<command_line_private::HasSwitch::Params> params(
+ std::unique_ptr<command_line_private::HasSwitch::Params> params(
command_line_private::HasSwitch::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index b5f11767..95068749 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -104,12 +104,12 @@
void MergeSuggestedKeyPrefs(
const std::string& extension_id,
ExtensionPrefs* extension_prefs,
- scoped_ptr<base::DictionaryValue> suggested_key_prefs) {
+ std::unique_ptr<base::DictionaryValue> suggested_key_prefs) {
const base::DictionaryValue* current_prefs;
if (extension_prefs->ReadPrefAsDictionary(extension_id,
kCommands,
¤t_prefs)) {
- scoped_ptr<base::DictionaryValue> new_prefs(current_prefs->DeepCopy());
+ std::unique_ptr<base::DictionaryValue> new_prefs(current_prefs->DeepCopy());
new_prefs->MergeDictionary(suggested_key_prefs.get());
suggested_key_prefs.reset(new_prefs.release());
}
@@ -284,9 +284,10 @@
bindings->Set(key, keybinding);
// Set the was_assigned pref for the suggested key.
- scoped_ptr<base::DictionaryValue> command_keys(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> command_keys(
+ new base::DictionaryValue);
command_keys->SetBoolean(kSuggestedKeyWasAssigned, true);
- scoped_ptr<base::DictionaryValue> suggested_key_prefs(
+ std::unique_ptr<base::DictionaryValue> suggested_key_prefs(
new base::DictionaryValue);
suggested_key_prefs->Set(command_name, command_keys.release());
MergeSuggestedKeyPrefs(extension_id, ExtensionPrefs::Get(profile_),
@@ -632,7 +633,7 @@
void CommandService::UpdateExtensionSuggestedCommandPrefs(
const Extension* extension) {
- scoped_ptr<base::DictionaryValue> suggested_key_prefs(
+ std::unique_ptr<base::DictionaryValue> suggested_key_prefs(
new base::DictionaryValue);
const CommandMap* commands = CommandsInfo::GetNamedCommands(extension);
@@ -640,7 +641,8 @@
for (CommandMap::const_iterator iter = commands->begin();
iter != commands->end(); ++iter) {
const Command command = iter->second;
- scoped_ptr<base::DictionaryValue> command_keys(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> command_keys(
+ new base::DictionaryValue);
command_keys->SetString(
kSuggestedKey,
Command::AcceleratorToString(command.accelerator()));
@@ -655,7 +657,8 @@
// declared. See CommandsHandler::MaybeSetBrowserActionDefault.
if (browser_action_command &&
browser_action_command->accelerator().key_code() != ui::VKEY_UNKNOWN) {
- scoped_ptr<base::DictionaryValue> command_keys(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> command_keys(
+ new base::DictionaryValue);
command_keys->SetString(
kSuggestedKey,
Command::AcceleratorToString(browser_action_command->accelerator()));
@@ -666,7 +669,8 @@
const Command* page_action_command =
CommandsInfo::GetPageActionCommand(extension);
if (page_action_command) {
- scoped_ptr<base::DictionaryValue> command_keys(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> command_keys(
+ new base::DictionaryValue);
command_keys->SetString(
kSuggestedKey,
Command::AcceleratorToString(page_action_command->accelerator()));
@@ -688,7 +692,7 @@
¤t_prefs);
if (current_prefs) {
- scoped_ptr<base::DictionaryValue> suggested_key_prefs(
+ std::unique_ptr<base::DictionaryValue> suggested_key_prefs(
current_prefs->DeepCopy());
const CommandMap* named_commands =
CommandsInfo::GetNamedCommands(extension);
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api.cc b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
index 007767c..4884025 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_api.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
+#include <memory>
#include <set>
#include <vector>
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
@@ -70,7 +70,7 @@
ContentSettingsType content_type;
EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type));
- scoped_ptr<Clear::Params> params(Clear::Params::Create(*args_));
+ std::unique_ptr<Clear::Params> params(Clear::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
ExtensionPrefsScope scope = kExtensionPrefsScopeRegular;
@@ -104,7 +104,7 @@
ContentSettingsType content_type;
EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type));
- scoped_ptr<Get::Params> params(Get::Params::Create(*args_));
+ std::unique_ptr<Get::Params> params(Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL primary_url(params->details.primary_url);
@@ -180,7 +180,7 @@
ContentSettingsType content_type;
EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type));
- scoped_ptr<Set::Params> params(Set::Params::Create(*args_));
+ std::unique_ptr<Set::Params> params(Set::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string primary_error;
@@ -309,7 +309,8 @@
base::ListValue* list = new base::ListValue();
for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin();
it != plugins.end(); ++it) {
- scoped_ptr<PluginMetadata> plugin_metadata(finder->GetPluginMetadata(*it));
+ std::unique_ptr<PluginMetadata> plugin_metadata(
+ finder->GetPluginMetadata(*it));
const std::string& group_identifier = plugin_metadata->identifier();
if (group_identifiers.find(group_identifier) != group_identifiers.end())
continue;
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
index f275e0f5..8a42b77e 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/bind_helpers.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
@@ -54,7 +55,7 @@
// BrowserProcess::Shutdown() needs to be called in a message loop, so we
// post a task to release the keep alive, then run the message loop.
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&scoped_ptr<ScopedKeepAlive>::reset,
+ FROM_HERE, base::Bind(&std::unique_ptr<ScopedKeepAlive>::reset,
base::Unretained(&keep_alive_), nullptr));
content::RunAllPendingInMessageLoop();
@@ -232,7 +233,7 @@
private:
Profile* profile_;
- scoped_ptr<ScopedKeepAlive> keep_alive_;
+ std::unique_ptr<ScopedKeepAlive> keep_alive_;
};
// http://crbug.com/177163
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc
index 188227b9..013ef4f1 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
#include "components/content_settings/core/browser/content_settings_rule.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
@@ -22,7 +23,7 @@
CustomExtensionProvider::~CustomExtensionProvider() {
}
-scoped_ptr<RuleIterator> CustomExtensionProvider::GetRuleIterator(
+std::unique_ptr<RuleIterator> CustomExtensionProvider::GetRuleIterator(
ContentSettingsType content_type,
const ResourceIdentifier& resource_identifier,
bool incognito) const {
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h
index fca10f7..0f84a6a9 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h
+++ b/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h
@@ -25,7 +25,7 @@
~CustomExtensionProvider() override;
// ProviderInterface methods:
- scoped_ptr<RuleIterator> GetRuleIterator(
+ std::unique_ptr<RuleIterator> GetRuleIterator(
ContentSettingsType content_type,
const ResourceIdentifier& resource_identifier,
bool incognito) const override;
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
index 915f534..c463d6d 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
@@ -4,8 +4,9 @@
#include "chrome/browser/extensions/api/content_settings/content_settings_helpers.h"
+#include <memory>
+
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "components/content_settings/core/browser/website_settings_info.h"
#include "components/content_settings/core/browser/website_settings_registry.h"
#include "content/public/common/url_constants.h"
@@ -44,7 +45,7 @@
*error = URLPattern::GetParseResultString(result);
return ContentSettingsPattern();
} else {
- scoped_ptr<ContentSettingsPattern::BuilderInterface> builder(
+ std::unique_ptr<ContentSettingsPattern::BuilderInterface> builder(
ContentSettingsPattern::CreateBuilder(false));
builder->WithHost(url_pattern.host());
if (url_pattern.match_subdomains())
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.cc b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
index ee4a2ccd..765636db 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_store.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
+#include <memory>
#include <set>
#include <utility>
#include <vector>
#include "base/debug/alias.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/values.h"
@@ -55,18 +55,18 @@
STLDeleteValues(&entries_);
}
-scoped_ptr<RuleIterator> ContentSettingsStore::GetRuleIterator(
+std::unique_ptr<RuleIterator> ContentSettingsStore::GetRuleIterator(
ContentSettingsType type,
const content_settings::ResourceIdentifier& identifier,
bool incognito) const {
- std::vector<scoped_ptr<RuleIterator>> iterators;
+ std::vector<std::unique_ptr<RuleIterator>> iterators;
// Iterate the extensions based on install time (last installed extensions
// first).
ExtensionEntryMap::const_reverse_iterator entry;
// The individual |RuleIterators| shouldn't lock; pass |lock_| to the
// |ConcatenationIterator| in a locked state.
- scoped_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_));
+ std::unique_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_));
for (entry = entries_.rbegin(); entry != entries_.rend(); ++entry) {
if (!entry->second->enabled)
@@ -88,7 +88,7 @@
entry->second->settings.GetRuleIterator(type, identifier, NULL));
}
}
- return scoped_ptr<RuleIterator>(
+ return std::unique_ptr<RuleIterator>(
new ConcatenationIterator(std::move(iterators), auto_lock.release()));
}
@@ -255,10 +255,9 @@
base::ListValue* settings = new base::ListValue();
OriginIdentifierValueMap::EntryMap::const_iterator it;
for (it = map->begin(); it != map->end(); ++it) {
- scoped_ptr<RuleIterator> rule_iterator(
- map->GetRuleIterator(it->first.content_type,
- it->first.resource_identifier,
- NULL)); // We already hold the lock.
+ std::unique_ptr<RuleIterator> rule_iterator(map->GetRuleIterator(
+ it->first.content_type, it->first.resource_identifier,
+ NULL)); // We already hold the lock.
while (rule_iterator->HasNext()) {
const Rule& rule = rule_iterator->Next();
base::DictionaryValue* setting_dict = new base::DictionaryValue();
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.h b/chrome/browser/extensions/api/content_settings/content_settings_store.h
index 0baf96c..f0f9e39 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_store.h
+++ b/chrome/browser/extensions/api/content_settings/content_settings_store.h
@@ -52,7 +52,7 @@
// //////////////////////////////////////////////////////////////////////////
- scoped_ptr<content_settings::RuleIterator> GetRuleIterator(
+ std::unique_ptr<content_settings::RuleIterator> GetRuleIterator(
ContentSettingsType type,
const content_settings::ResourceIdentifier& identifier,
bool incognito) const;
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc
index b586c4e5..f138a76 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc
@@ -6,7 +6,8 @@
#include <stdint.h>
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "components/content_settings/core/browser/content_settings_rule.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
@@ -55,9 +56,9 @@
ContentSettingsType content_type,
const std::string& resource_identifier,
bool incognito) {
- scoped_ptr<content_settings::RuleIterator> rule_iterator(
+ std::unique_ptr<content_settings::RuleIterator> rule_iterator(
store->GetRuleIterator(content_type, resource_identifier, incognito));
- scoped_ptr<base::Value> setting(
+ std::unique_ptr<base::Value> setting(
content_settings::TestUtils::GetContentSettingValueAndPatterns(
rule_iterator.get(), primary_url, secondary_url, NULL, NULL));
return content_settings::ValueToContentSetting(setting.get());
@@ -70,7 +71,7 @@
bool incognito,
std::vector<content_settings::Rule>* rules) {
rules->clear();
- scoped_ptr<content_settings::RuleIterator> rule_iterator(
+ std::unique_ptr<content_settings::RuleIterator> rule_iterator(
store->GetRuleIterator(content_type, resource_identifier, incognito));
while (rule_iterator->HasNext())
rules->push_back(rule_iterator->Next());
diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api.cc b/chrome/browser/extensions/api/context_menus/context_menus_api.cc
index 49abc96..90b8849 100644
--- a/chrome/browser/extensions/api/context_menus/context_menus_api.cc
+++ b/chrome/browser/extensions/api/context_menus/context_menus_api.cc
@@ -35,7 +35,7 @@
bool ContextMenusCreateFunction::RunSync() {
MenuItem::Id id(GetProfile()->IsOffTheRecord(),
MenuItem::ExtensionKey(extension_id()));
- scoped_ptr<Create::Params> params(Create::Params::Create(*args_));
+ std::unique_ptr<Create::Params> params(Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->create_properties.id.get()) {
@@ -60,7 +60,7 @@
bool ContextMenusUpdateFunction::RunSync() {
MenuItem::Id item_id(GetProfile()->IsOffTheRecord(),
MenuItem::ExtensionKey(extension_id()));
- scoped_ptr<Update::Params> params(Update::Params::Create(*args_));
+ std::unique_ptr<Update::Params> params(Update::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->id.as_string)
@@ -75,7 +75,7 @@
}
bool ContextMenusRemoveFunction::RunSync() {
- scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_));
+ std::unique_ptr<Remove::Params> params(Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
MenuManager* manager = MenuManager::Get(GetProfile());
diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h
index 3d7bcb8d..29f2f17 100644
--- a/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h
+++ b/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h
@@ -19,14 +19,14 @@
namespace {
template <typename PropertyWithEnumT>
-scoped_ptr<extensions::MenuItem::Id> GetParentId(
+std::unique_ptr<extensions::MenuItem::Id> GetParentId(
const PropertyWithEnumT& property,
bool is_off_the_record,
const MenuItem::ExtensionKey& key) {
if (!property.parent_id)
- return scoped_ptr<extensions::MenuItem::Id>();
+ return std::unique_ptr<extensions::MenuItem::Id>();
- scoped_ptr<extensions::MenuItem::Id> parent_id(
+ std::unique_ptr<extensions::MenuItem::Id> parent_id(
new extensions::MenuItem::Id(is_off_the_record, key));
if (property.parent_id->as_integer)
parent_id->uid = *property.parent_id->as_integer;
@@ -128,7 +128,7 @@
if (create_properties.enabled.get())
enabled = *create_properties.enabled;
- scoped_ptr<MenuItem> item(
+ std::unique_ptr<MenuItem> item(
new MenuItem(item_id, title, checked, enabled, type, contexts));
// URL Patterns.
@@ -141,7 +141,7 @@
// Parent id.
bool success = true;
- scoped_ptr<MenuItem::Id> parent_id(GetParentId(
+ std::unique_ptr<MenuItem::Id> parent_id(GetParentId(
create_properties, profile->IsOffTheRecord(), item_id.extension_key));
if (parent_id.get()) {
MenuItem* parent = GetParent(*parent_id, menu_manager, error);
@@ -237,7 +237,7 @@
// Parent id.
MenuItem* parent = NULL;
- scoped_ptr<MenuItem::Id> parent_id(GetParentId(
+ std::unique_ptr<MenuItem::Id> parent_id(GetParentId(
update_properties, profile->IsOffTheRecord(), item_id.extension_key));
if (parent_id.get()) {
MenuItem* parent = GetParent(*parent_id, menu_manager, error);
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index 3485bb8..a7df881 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/extensions/api/cookies/cookies_api.h"
+#include <memory>
#include <utility>
#include <vector>
@@ -13,7 +14,6 @@
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -139,7 +139,7 @@
void CookiesEventRouter::CookieChanged(
Profile* profile,
ChromeCookieDetails* details) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetBoolean(keys::kRemovedKey, details->removed);
@@ -183,15 +183,16 @@
cookies::OnChanged::kEventName, std::move(args), cookie_domain);
}
-void CookiesEventRouter::DispatchEvent(content::BrowserContext* context,
- events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
- GURL& cookie_domain) {
+void CookiesEventRouter::DispatchEvent(
+ content::BrowserContext* context,
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args,
+ GURL& cookie_domain) {
EventRouter* router = context ? EventRouter::Get(context) : NULL;
if (!router)
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(event_args)));
event->restrict_to_browser_context = context;
event->event_url = cookie_domain;
@@ -535,9 +536,9 @@
bool CookiesGetAllCookieStoresFunction::RunSync() {
Profile* original_profile = GetProfile();
DCHECK(original_profile);
- scoped_ptr<base::ListValue> original_tab_ids(new base::ListValue());
+ std::unique_ptr<base::ListValue> original_tab_ids(new base::ListValue());
Profile* incognito_profile = NULL;
- scoped_ptr<base::ListValue> incognito_tab_ids;
+ std::unique_ptr<base::ListValue> incognito_tab_ids;
if (include_incognito() && GetProfile()->HasOffTheRecordProfile()) {
incognito_profile = GetProfile()->GetOffTheRecordProfile();
if (incognito_profile)
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.h b/chrome/browser/extensions/api/cookies/cookies_api.h
index 1fe93da..c7764d54 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.h
+++ b/chrome/browser/extensions/api/cookies/cookies_api.h
@@ -8,12 +8,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_API_H_
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
#include "chrome/common/extensions/api/cookies.h"
@@ -51,7 +51,7 @@
void DispatchEvent(content::BrowserContext* context,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
GURL& cookie_domain);
// Used for tracking registrations to CookieMonster notifications.
@@ -82,7 +82,7 @@
GURL url_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<api::cookies::Get::Params> parsed_args_;
+ std::unique_ptr<api::cookies::Get::Params> parsed_args_;
};
// Implements the cookies.getAll() extension function.
@@ -105,7 +105,7 @@
GURL url_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<api::cookies::GetAll::Params> parsed_args_;
+ std::unique_ptr<api::cookies::GetAll::Params> parsed_args_;
};
// Implements the cookies.set() extension function.
@@ -128,7 +128,7 @@
GURL url_;
bool success_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<api::cookies::Set::Params> parsed_args_;
+ std::unique_ptr<api::cookies::Set::Params> parsed_args_;
};
// Implements the cookies.remove() extension function.
@@ -151,7 +151,7 @@
GURL url_;
scoped_refptr<net::URLRequestContextGetter> store_browser_context_;
- scoped_ptr<api::cookies::Remove::Params> parsed_args_;
+ std::unique_ptr<api::cookies::Remove::Params> parsed_args_;
};
// Implements the cookies.getAllCookieStores() extension function.
@@ -193,7 +193,7 @@
static const bool kServiceIsNULLWhileTesting = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<CookiesEventRouter> cookies_event_router_;
+ std::unique_ptr<CookiesEventRouter> cookies_event_router_;
DISALLOW_COPY_AND_ASSIGN(CookiesAPI);
};
diff --git a/chrome/browser/extensions/api/cookies/cookies_unittest.cc b/chrome/browser/extensions/api/cookies/cookies_unittest.cc
index 6952519..9ab84c2 100644
--- a/chrome/browser/extensions/api/cookies/cookies_unittest.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_unittest.cc
@@ -46,7 +46,7 @@
TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) {
TestingProfile::Builder profile_builder;
- scoped_ptr<TestingProfile> profile = profile_builder.Build();
+ std::unique_ptr<TestingProfile> profile = profile_builder.Build();
// Trigger early creation of off-the-record profile.
EXPECT_TRUE(profile->GetOffTheRecordProfile());
@@ -167,7 +167,7 @@
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetString(keys::kDomainKey, std::string(tests[i].filter));
args.Set(0, dict);
- scoped_ptr<GetAll::Params> params(GetAll::Params::Create(args));
+ std::unique_ptr<GetAll::Params> params(GetAll::Params::Create(args));
cookies_helpers::MatchFilter filter(¶ms->details);
net::CanonicalCookie cookie(
diff --git a/chrome/browser/extensions/api/copresence/copresence_api.cc b/chrome/browser/extensions/api/copresence/copresence_api.cc
index 44bfca7..fad9db79 100644
--- a/chrome/browser/extensions/api/copresence/copresence_api.cc
+++ b/chrome/browser/extensions/api/copresence/copresence_api.cc
@@ -92,7 +92,7 @@
}
void CopresenceService::set_manager_for_testing(
- scoped_ptr<copresence::CopresenceManager> manager) {
+ std::unique_ptr<copresence::CopresenceManager> manager) {
manager_ = std::move(manager);
}
@@ -148,7 +148,7 @@
}
// Send the messages to the client app.
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::COPRESENCE_ON_MESSAGES_RECEIVED, OnMessagesReceived::kEventName,
OnMessagesReceived::Create(subscription_id, api_messages),
browser_context_));
@@ -161,7 +161,7 @@
void CopresenceService::HandleStatusUpdate(
copresence::CopresenceStatus status) {
DCHECK_EQ(copresence::AUDIO_FAIL, status);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::COPRESENCE_ON_STATUS_UPDATED, OnStatusUpdated::kEventName,
OnStatusUpdated::Create(api::copresence::STATUS_AUDIOFAILED),
browser_context_));
@@ -240,7 +240,7 @@
// CopresenceExecuteFunction implementation.
ExtensionFunction::ResponseAction CopresenceExecuteFunction::Run() {
- scoped_ptr<Execute::Params> params(Execute::Params::Create(*args_));
+ std::unique_ptr<Execute::Params> params(Execute::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
CopresenceService* service =
@@ -278,7 +278,7 @@
// CopresenceSetApiKeyFunction implementation.
ExtensionFunction::ResponseAction CopresenceSetApiKeyFunction::Run() {
- scoped_ptr<SetApiKey::Params> params(SetApiKey::Params::Create(*args_));
+ std::unique_ptr<SetApiKey::Params> params(SetApiKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
LOG(WARNING) << "copresence.setApiKey() is deprecated. "
@@ -292,7 +292,8 @@
// CopresenceSetAuthTokenFunction implementation
ExtensionFunction::ResponseAction CopresenceSetAuthTokenFunction::Run() {
- scoped_ptr<SetAuthToken::Params> params(SetAuthToken::Params::Create(*args_));
+ std::unique_ptr<SetAuthToken::Params> params(
+ SetAuthToken::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// The token may be set to empty, to clear it.
diff --git a/chrome/browser/extensions/api/copresence/copresence_api.h b/chrome/browser/extensions/api/copresence/copresence_api.h
index b383af4..c6cbdcd 100644
--- a/chrome/browser/extensions/api/copresence/copresence_api.h
+++ b/chrome/browser/extensions/api/copresence/copresence_api.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/copresence/copresence_translations.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/copresence.h"
@@ -69,7 +69,7 @@
// Manager override for testing.
void set_manager_for_testing(
- scoped_ptr<copresence::CopresenceManager> manager);
+ std::unique_ptr<copresence::CopresenceManager> manager);
// Registers the preference for saving our device IDs.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
@@ -106,8 +106,8 @@
std::map<std::string, std::string> api_keys_by_app_;
std::map<std::string, std::string> auth_tokens_by_app_;
- scoped_ptr<audio_modem::WhispernetClient> whispernet_client_;
- scoped_ptr<copresence::CopresenceManager> manager_;
+ std::unique_ptr<audio_modem::WhispernetClient> whispernet_client_;
+ std::unique_ptr<copresence::CopresenceManager> manager_;
DISALLOW_COPY_AND_ASSIGN(CopresenceService);
};
diff --git a/chrome/browser/extensions/api/copresence/copresence_api_unittest.cc b/chrome/browser/extensions/api/copresence/copresence_api_unittest.cc
index ff79a4c..2980472 100644
--- a/chrome/browser/extensions/api/copresence/copresence_api_unittest.cc
+++ b/chrome/browser/extensions/api/copresence/copresence_api_unittest.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
@@ -110,12 +111,12 @@
CopresenceService::GetFactoryInstance()->Get(profile());
copresence_manager_ = new FakeCopresenceManager(service);
service->set_manager_for_testing(
- make_scoped_ptr<CopresenceManager>(copresence_manager_));
+ base::WrapUnique<CopresenceManager>(copresence_manager_));
}
// Takes ownership of the operation_list.
bool ExecuteOperations(ListValue* operation_list) {
- scoped_ptr<ListValue> args_list(new ListValue);
+ std::unique_ptr<ListValue> args_list(new ListValue);
args_list->Append(operation_list);
scoped_refptr<UIThreadExtensionFunction> function =
@@ -128,7 +129,7 @@
return function->GetResultList();
}
- bool ExecuteOperation(scoped_ptr<Operation> operation) {
+ bool ExecuteOperation(std::unique_ptr<Operation> operation) {
ListValue* operation_list = new ListValue;
operation_list->Append(operation->ToValue().release());
return ExecuteOperations(operation_list);
@@ -155,11 +156,11 @@
};
TEST_F(CopresenceApiUnittest, Publish) {
- scoped_ptr<PublishOperation> publish(CreatePublish("pub"));
+ std::unique_ptr<PublishOperation> publish(CreatePublish("pub"));
publish->strategies.reset(new Strategy);
publish->strategies->only_broadcast.reset(new bool(true)); // Default
- scoped_ptr<Operation> operation(new Operation);
+ std::unique_ptr<Operation> operation(new Operation);
operation->publish = std::move(publish);
clear_app_id();
@@ -181,12 +182,12 @@
}
TEST_F(CopresenceApiUnittest, Subscribe) {
- scoped_ptr<SubscribeOperation> subscribe(CreateSubscribe("sub"));
+ std::unique_ptr<SubscribeOperation> subscribe(CreateSubscribe("sub"));
subscribe->strategies.reset(new Strategy);
subscribe->strategies->only_broadcast.reset(new bool(true)); // Not default
subscribe->strategies->audible.reset(new bool(true)); // Not default
- scoped_ptr<Operation> operation(new Operation);
+ std::unique_ptr<Operation> operation(new Operation);
operation->subscribe = std::move(subscribe);
clear_app_id();
@@ -208,10 +209,10 @@
}
TEST_F(CopresenceApiUnittest, DefaultStrategies) {
- scoped_ptr<Operation> publish_operation(new Operation);
+ std::unique_ptr<Operation> publish_operation(new Operation);
publish_operation->publish.reset(CreatePublish("pub"));
- scoped_ptr<Operation> subscribe_operation(new Operation);
+ std::unique_ptr<Operation> subscribe_operation(new Operation);
subscribe_operation->subscribe.reset(CreateSubscribe("sub"));
ListValue* operation_list = new ListValue;
@@ -228,7 +229,7 @@
}
TEST_F(CopresenceApiUnittest, LowPowerStrategy) {
- scoped_ptr<Operation> subscribe_operation(new Operation);
+ std::unique_ptr<Operation> subscribe_operation(new Operation);
subscribe_operation->subscribe.reset(CreateSubscribe("sub"));
subscribe_operation->subscribe->strategies.reset(new Strategy);
subscribe_operation->subscribe->strategies->low_power.reset(new bool(true));
@@ -244,8 +245,8 @@
TEST_F(CopresenceApiUnittest, UnPubSub) {
// First we need to create a publish and a subscribe to cancel.
- scoped_ptr<Operation> publish_operation(new Operation);
- scoped_ptr<Operation> subscribe_operation(new Operation);
+ std::unique_ptr<Operation> publish_operation(new Operation);
+ std::unique_ptr<Operation> subscribe_operation(new Operation);
publish_operation->publish.reset(CreatePublish("pub"));
subscribe_operation->subscribe.reset(CreateSubscribe("sub"));
ListValue* operation_list = new ListValue;
@@ -253,11 +254,11 @@
operation_list->Append(subscribe_operation->ToValue().release());
EXPECT_TRUE(ExecuteOperations(operation_list));
- scoped_ptr<Operation> unpublish_operation(new Operation);
+ std::unique_ptr<Operation> unpublish_operation(new Operation);
unpublish_operation->unpublish.reset(new UnpublishOperation);
unpublish_operation->unpublish->unpublish_id = "pub";
- scoped_ptr<Operation> unsubscribe_operation(new Operation);
+ std::unique_ptr<Operation> unsubscribe_operation(new Operation);
unsubscribe_operation->unsubscribe.reset(new UnsubscribeOperation);
unsubscribe_operation->unsubscribe->unsubscribe_id = "sub";
@@ -280,7 +281,7 @@
}
TEST_F(CopresenceApiUnittest, BadId) {
- scoped_ptr<Operation> unsubscribe_operation(new Operation);
+ std::unique_ptr<Operation> unsubscribe_operation(new Operation);
unsubscribe_operation->unsubscribe.reset(new UnsubscribeOperation);
unsubscribe_operation->unsubscribe->unsubscribe_id = "invalid id";
@@ -288,7 +289,7 @@
}
TEST_F(CopresenceApiUnittest, MultipleOperations) {
- scoped_ptr<Operation> multi_operation(new Operation);
+ std::unique_ptr<Operation> multi_operation(new Operation);
multi_operation->publish.reset(CreatePublish("pub"));
multi_operation->subscribe.reset(CreateSubscribe("sub"));
diff --git a/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc b/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
index 71d33ec..4bdaf0f 100644
--- a/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
+++ b/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
@@ -92,7 +92,7 @@
// CopresenceSendFoundFunction implementation:
ExtensionFunction::ResponseAction CopresencePrivateSendFoundFunction::Run() {
- scoped_ptr<SendFound::Params> params(SendFound::Params::Create(*args_));
+ std::unique_ptr<SendFound::Params> params(SendFound::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WhispernetClient* whispernet_client =
@@ -112,7 +112,8 @@
// CopresenceSendEncodedFunction implementation:
ExtensionFunction::ResponseAction CopresencePrivateSendSamplesFunction::Run() {
- scoped_ptr<SendSamples::Params> params(SendSamples::Params::Create(*args_));
+ std::unique_ptr<SendSamples::Params> params(
+ SendSamples::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WhispernetClient* whispernet_client =
@@ -136,7 +137,7 @@
// CopresenceSendInitializedFunction implementation:
ExtensionFunction::ResponseAction
CopresencePrivateSendInitializedFunction::Run() {
- scoped_ptr<SendInitialized::Params> params(
+ std::unique_ptr<SendInitialized::Params> params(
SendInitialized::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
index d3a4ea2e4..98d7977 100644
--- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
+++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
@@ -25,7 +25,7 @@
ExtensionFunction::ResponseAction
CryptotokenPrivateCanOriginAssertAppIdFunction::Run() {
- scoped_ptr<cryptotoken_private::CanOriginAssertAppId::Params> params =
+ std::unique_ptr<cryptotoken_private::CanOriginAssertAppId::Params> params =
cryptotoken_private::CanOriginAssertAppId::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h
index e7b4b2f..41c8825 100644
--- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h
+++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_CRYPTOTOKEN_PRIVATE_CRYPTOTOKEN_PRIVATE_API_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/common/extensions/api/cryptotoken_private.h"
#include "extensions/browser/extension_function.h"
diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc
index 772eaa2..937d4010 100644
--- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc
@@ -52,7 +52,7 @@
new api::CryptotokenPrivateCanOriginAssertAppIdFunction());
function->set_has_callback(true);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->AppendString(origin);
args->AppendString(appId);
diff --git a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
index 64a93692..a3303cd 100644
--- a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
+++ b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
@@ -133,7 +133,7 @@
Release();
return;
}
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::DELEGATED_PERMISSIONS_PROMPT));
prompt->set_delegated_username(details().delegated_user);
@@ -188,7 +188,7 @@
CreateResults(api::dashboard_private::RESULT_EMPTY_STRING));
}
-scoped_ptr<base::ListValue>
+std::unique_ptr<base::ListValue>
DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::CreateResults(
api::dashboard_private::Result result) const {
return ShowPermissionPromptForDelegatedInstall::Results::Create(result);
diff --git a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h
index 11e2da8..25b2c7fb 100644
--- a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h
+++ b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_DASHBOARD_PRIVATE_DASHBOARD_PRIVATE_API_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
#include "chrome/browser/extensions/bundle_installer.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
@@ -60,18 +60,18 @@
ExtensionFunction::ResponseValue BuildResponse(
api::dashboard_private::Result result,
const std::string& error);
- scoped_ptr<base::ListValue> CreateResults(
+ std::unique_ptr<base::ListValue> CreateResults(
api::dashboard_private::Result result) const;
const Params::Details& details() const { return params_->details; }
- scoped_ptr<Params> params_;
+ std::unique_ptr<Params> params_;
// A dummy Extension object we create for the purposes of using
// ExtensionInstallPrompt to prompt for confirmation of the install.
scoped_refptr<Extension> dummy_extension_;
- scoped_ptr<ExtensionInstallPrompt> install_prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> install_prompt_;
DISALLOW_COPY_AND_ASSIGN(
DashboardPrivateShowPermissionPromptForDelegatedInstallFunction);
@@ -106,10 +106,10 @@
ChromeExtensionFunctionDetails chrome_details_;
- scoped_ptr<Params> params_;
+ std::unique_ptr<Params> params_;
- scoped_ptr<extensions::BundleInstaller> bundle_;
- scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
+ std::unique_ptr<extensions::BundleInstaller> bundle_;
+ std::unique_ptr<chrome::BitmapFetcher> icon_fetcher_;
};
} // namespace extensions
diff --git a/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.cc b/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.cc
index 96e3682..5f829619 100644
--- a/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.cc
+++ b/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.cc
@@ -40,16 +40,19 @@
}
void DataReductionProxyGetDataUsageFunction::ReplyWithDataUsage(
- scoped_ptr<std::vector<data_reduction_proxy::DataUsageBucket>> data_usage) {
+ std::unique_ptr<std::vector<data_reduction_proxy::DataUsageBucket>>
+ data_usage) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<base::ListValue> data_usage_buckets(new base::ListValue());
+ std::unique_ptr<base::ListValue> data_usage_buckets(new base::ListValue());
for (const auto& data_usage_bucket : *data_usage) {
- scoped_ptr<base::ListValue> connection_usage_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> connection_usage_list(
+ new base::ListValue());
for (auto connection_usage : data_usage_bucket.connection_usage()) {
- scoped_ptr<base::ListValue> site_usage_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> site_usage_list(new base::ListValue());
for (auto site_usage : connection_usage.site_usage()) {
- scoped_ptr<base::DictionaryValue> usage(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> usage(
+ new base::DictionaryValue());
usage->SetString("hostname", site_usage.hostname());
usage->SetDouble("data_used", site_usage.data_used());
usage->SetDouble("original_size", site_usage.original_size());
diff --git a/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.h b/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.h
index 3ad0c925..9edd2c2 100644
--- a/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.h
+++ b/chrome/browser/extensions/api/data_reduction_proxy/data_reduction_proxy_api.h
@@ -35,7 +35,7 @@
ResponseAction Run() override;
void ReplyWithDataUsage(
- scoped_ptr<std::vector<data_reduction_proxy::DataUsageBucket>>
+ std::unique_ptr<std::vector<data_reduction_proxy::DataUsageBucket>>
data_usage);
};
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index 7e238b2..8b59dc2 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -7,7 +7,9 @@
#include "chrome/browser/extensions/api/debugger/debugger_api.h"
#include <stddef.h>
+
#include <map>
+#include <memory>
#include <set>
#include <utility>
@@ -17,7 +19,6 @@
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/scoped_observer.h"
#include "base/stl_util.h"
@@ -212,7 +213,7 @@
g_extension_info_bars.Get()[extension_id] = this;
// This class closes the |infobar_|, so it's safe to pass Unretained(this).
- scoped_ptr<ExtensionDevToolsInfoBarDelegate> delegate(
+ std::unique_ptr<ExtensionDevToolsInfoBarDelegate> delegate(
new ExtensionDevToolsInfoBarDelegate(
base::Bind(&ExtensionDevToolsInfoBar::InfoBarDismissed,
base::Unretained(this)),
@@ -399,10 +400,10 @@
if (!EventRouter::Get(profile_))
return;
- scoped_ptr<base::ListValue> args(OnDetach::Create(debuggee_,
- detach_reason_));
- scoped_ptr<Event> event(new Event(events::DEBUGGER_ON_DETACH,
- OnDetach::kEventName, std::move(args)));
+ std::unique_ptr<base::ListValue> args(
+ OnDetach::Create(debuggee_, detach_reason_));
+ std::unique_ptr<Event> event(new Event(
+ events::DEBUGGER_ON_DETACH, OnDetach::kEventName, std::move(args)));
event->restrict_to_browser_context = profile_;
EventRouter::Get(profile_)
->DispatchEventToExtension(extension_id_, std::move(event));
@@ -430,7 +431,7 @@
if (!EventRouter::Get(profile_))
return;
- scoped_ptr<base::Value> result = base::JSONReader::Read(message);
+ std::unique_ptr<base::Value> result = base::JSONReader::Read(message);
if (!result->IsType(base::Value::TYPE_DICTIONARY))
return;
base::DictionaryValue* dictionary =
@@ -447,10 +448,10 @@
if (dictionary->GetDictionary("params", ¶ms_value))
params.additional_properties.Swap(params_value);
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
OnEvent::Create(debuggee_, method_name, params));
- scoped_ptr<Event> event(new Event(events::DEBUGGER_ON_EVENT,
- OnEvent::kEventName, std::move(args)));
+ std::unique_ptr<Event> event(new Event(
+ events::DEBUGGER_ON_EVENT, OnEvent::kEventName, std::move(args)));
event->restrict_to_browser_context = profile_;
EventRouter::Get(profile_)
->DispatchEventToExtension(extension_id_, std::move(event));
@@ -571,7 +572,7 @@
}
bool DebuggerAttachFunction::RunAsync() {
- scoped_ptr<Attach::Params> params(Attach::Params::Create(*args_));
+ std::unique_ptr<Attach::Params> params(Attach::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
CopyDebuggee(&debuggee_, params->target);
@@ -608,7 +609,7 @@
}
bool DebuggerDetachFunction::RunAsync() {
- scoped_ptr<Detach::Params> params(Detach::Params::Create(*args_));
+ std::unique_ptr<Detach::Params> params(Detach::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
CopyDebuggee(&debuggee_, params->target);
@@ -630,7 +631,8 @@
}
bool DebuggerSendCommandFunction::RunAsync() {
- scoped_ptr<SendCommand::Params> params(SendCommand::Params::Create(*args_));
+ std::unique_ptr<SendCommand::Params> params(
+ SendCommand::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
CopyDebuggee(&debuggee_, params->target);
@@ -723,7 +725,7 @@
void DebuggerGetTargetsFunction::SendTargetList(
const std::vector<DevToolsTargetImpl*>& target_list) {
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
for (size_t i = 0; i < target_list.size(); ++i)
result->Append(SerializeTarget(*target_list[i]));
STLDeleteContainerPointers(target_list.begin(), target_list.end());
diff --git a/chrome/browser/extensions/api/debugger/debugger_apitest.cc b/chrome/browser/extensions/api/debugger/debugger_apitest.cc
index 91885ec7..acf5b62 100644
--- a/chrome/browser/extensions/api/debugger/debugger_apitest.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_apitest.cc
@@ -96,7 +96,7 @@
// Attach by targetId.
scoped_refptr<DebuggerGetTargetsFunction> get_targets_function =
new DebuggerGetTargetsFunction();
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
extension_function_test_utils::RunFunctionAndReturnSingleResult(
get_targets_function.get(), "[]", browser()));
base::ListValue* targets = nullptr;
diff --git a/chrome/browser/extensions/api/declarative/declarative_apitest.cc b/chrome/browser/extensions/api/declarative/declarative_apitest.cc
index c64f21b..810b4df 100644
--- a/chrome/browser/extensions/api/declarative/declarative_apitest.cc
+++ b/chrome/browser/extensions/api/declarative/declarative_apitest.cc
@@ -4,10 +4,11 @@
#include <stddef.h>
+#include <memory>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/thread_test_helper.h"
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service_unittest.cc b/chrome/browser/extensions/api/declarative/rules_registry_service_unittest.cc
index 41ee988..b0c4b93f 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service_unittest.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service_unittest.cc
@@ -102,11 +102,12 @@
message_loop_.RunUntilIdle();
// Test extension uninstalling.
- scoped_ptr<base::DictionaryValue> manifest = DictionaryBuilder()
- .Set("name", "Extension")
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Build();
+ std::unique_ptr<base::DictionaryValue> manifest =
+ DictionaryBuilder()
+ .Set("name", "Extension")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Build();
scoped_refptr<Extension> extension = ExtensionBuilder()
.SetManifest(std::move(manifest))
.SetID(kExtensionId)
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
index 63d6326e..404e3225 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
@@ -231,7 +231,8 @@
const std::string rules_stored_key(
RulesCacheDelegate::GetRulesStoredKey(
event_name, profile()->IsOffTheRecord()));
- scoped_ptr<RulesCacheDelegate> cache_delegate(new RulesCacheDelegate(false));
+ std::unique_ptr<RulesCacheDelegate> cache_delegate(
+ new RulesCacheDelegate(false));
scoped_refptr<RulesRegistry> registry(
new TestRulesRegistry(profile(), event_name, content::BrowserThread::UI,
cache_delegate.get(), kRulesRegistryID));
@@ -255,7 +256,7 @@
// No write yet so no store should have been created.
ASSERT_FALSE(store);
- scoped_ptr<base::ListValue> value(new base::ListValue);
+ std::unique_ptr<base::ListValue> value(new base::ListValue);
value->AppendBoolean(true);
cache_delegate->WriteToStorage(extension1_->id(), std::move(value));
EXPECT_TRUE(cache_delegate->GetDeclarativeRulesStored(extension1_->id()));
@@ -306,12 +307,14 @@
const std::string rules_stored_key2(
RulesCacheDelegate::GetRulesStoredKey(
event_name2, profile()->IsOffTheRecord()));
- scoped_ptr<RulesCacheDelegate> cache_delegate1(new RulesCacheDelegate(false));
+ std::unique_ptr<RulesCacheDelegate> cache_delegate1(
+ new RulesCacheDelegate(false));
scoped_refptr<RulesRegistry> registry1(
new TestRulesRegistry(profile(), event_name1, content::BrowserThread::UI,
cache_delegate1.get(), kRulesRegistryID));
- scoped_ptr<RulesCacheDelegate> cache_delegate2(new RulesCacheDelegate(false));
+ std::unique_ptr<RulesCacheDelegate> cache_delegate2(
+ new RulesCacheDelegate(false));
scoped_refptr<RulesRegistry> registry2(
new TestRulesRegistry(profile(), event_name2, content::BrowserThread::UI,
cache_delegate2.get(), kRulesRegistryID));
@@ -356,7 +359,8 @@
env_.GetExtensionSystem()->SetReady();
// 2. First run, adding a rule for the extension.
- scoped_ptr<RulesCacheDelegate> cache_delegate(new RulesCacheDelegate(false));
+ std::unique_ptr<RulesCacheDelegate> cache_delegate(
+ new RulesCacheDelegate(false));
scoped_refptr<TestRulesRegistry> registry(
new TestRulesRegistry(profile(), "testEvent", content::BrowserThread::UI,
cache_delegate.get(), kRulesRegistryID));
diff --git a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc
index 4b99dc0..d8654a1 100644
--- a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/declarative_content/content_constants.h"
#include "chrome/browser/extensions/extension_util.h"
@@ -130,7 +131,8 @@
active_rules_[contents] = std::set<const ContentRule*>();
EvaluationScope evaluation_scope(this);
- for (const scoped_ptr<ContentPredicateEvaluator>& evaluator : evaluators_)
+ for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
+ evaluators_)
evaluator->TrackForWebContents(contents);
}
@@ -140,15 +142,16 @@
const content::FrameNavigateParams& params) {
if (ContainsKey(active_rules_, contents)) {
EvaluationScope evaluation_scope(this);
- for (const scoped_ptr<ContentPredicateEvaluator>& evaluator : evaluators_)
+ for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
+ evaluators_)
evaluator->OnWebContentsNavigation(contents, details, params);
}
}
ChromeContentRulesRegistry::ContentRule::ContentRule(
const Extension* extension,
- std::vector<scoped_ptr<const ContentCondition>> conditions,
- std::vector<scoped_ptr<const ContentAction>> actions,
+ std::vector<std::unique_ptr<const ContentCondition>> conditions,
+ std::vector<std::unique_ptr<const ContentAction>> actions,
int priority)
: extension(extension),
conditions(std::move(conditions)),
@@ -157,33 +160,33 @@
ChromeContentRulesRegistry::ContentRule::~ContentRule() {}
-scoped_ptr<const ChromeContentRulesRegistry::ContentRule>
+std::unique_ptr<const ChromeContentRulesRegistry::ContentRule>
ChromeContentRulesRegistry::CreateRule(
const Extension* extension,
const std::map<std::string, ContentPredicateFactory*>& predicate_factories,
const api::events::Rule& api_rule,
std::string* error) {
- std::vector<scoped_ptr<const ContentCondition>> conditions;
- for (const scoped_ptr<base::Value>& value : api_rule.conditions) {
+ std::vector<std::unique_ptr<const ContentCondition>> conditions;
+ for (const std::unique_ptr<base::Value>& value : api_rule.conditions) {
conditions.push_back(
CreateContentCondition(extension, predicate_factories, *value, error));
if (!error->empty())
- return scoped_ptr<ContentRule>();
+ return std::unique_ptr<ContentRule>();
}
- std::vector<scoped_ptr<const ContentAction>> actions;
- for (const scoped_ptr<base::Value>& value : api_rule.actions) {
+ std::vector<std::unique_ptr<const ContentAction>> actions;
+ for (const std::unique_ptr<base::Value>& value : api_rule.actions) {
actions.push_back(ContentAction::Create(browser_context(), extension,
*value, error));
if (!error->empty())
- return scoped_ptr<ContentRule>();
+ return std::unique_ptr<ContentRule>();
}
// Note: |api_rule| may contain tags, but these are ignored.
- return make_scoped_ptr(new ContentRule(extension, std::move(conditions),
- std::move(actions),
- *api_rule.priority));
+ return base::WrapUnique(new ContentRule(extension, std::move(conditions),
+ std::move(actions),
+ *api_rule.priority));
}
bool ChromeContentRulesRegistry::ManagingRulesForBrowserContext(
@@ -197,7 +200,7 @@
bool ChromeContentRulesRegistry::EvaluateConditionForTab(
const ContentCondition* condition,
content::WebContents* tab) {
- for (const scoped_ptr<const ContentPredicate>& predicate :
+ for (const std::unique_ptr<const ContentPredicate>& predicate :
condition->predicates) {
if (predicate && !predicate->IsIgnored() &&
!predicate->GetEvaluator()->EvaluatePredicate(predicate.get(), tab)) {
@@ -218,7 +221,7 @@
!ShouldEvaluateExtensionRulesForIncognitoRenderer(rule->extension))
continue;
- for (const scoped_ptr<const ContentCondition>& condition :
+ for (const std::unique_ptr<const ContentCondition>& condition :
rule->conditions) {
if (EvaluateConditionForTab(condition.get(), tab))
matching_rules.insert(rule);
@@ -242,7 +245,8 @@
new_predicates;
std::map<std::string, ContentPredicateFactory*> predicate_factories;
- for (const scoped_ptr<ContentPredicateEvaluator>& evaluator : evaluators_) {
+ for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
+ evaluators_) {
predicate_factories[evaluator->GetPredicateApiAttributeName()] =
evaluator.get();
}
@@ -251,12 +255,12 @@
ExtensionIdRuleIdPair rule_id(extension_id, *api_rule->id);
DCHECK(content_rules_.find(rule_id) == content_rules_.end());
- scoped_ptr<const ContentRule> rule(
+ std::unique_ptr<const ContentRule> rule(
CreateRule(extension, predicate_factories, *api_rule, &error));
if (!error.empty()) {
// Notify evaluators that none of the created predicates will be tracked
// after all.
- for (const scoped_ptr<ContentPredicateEvaluator>& evaluator :
+ for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
evaluators_) {
if (!new_predicates[evaluator.get()].empty()) {
evaluator->TrackPredicates(
@@ -270,9 +274,9 @@
// Group predicates by evaluator and rule, so we can later notify the
// evaluators that they have new predicates to manage.
- for (const scoped_ptr<const ContentCondition>& condition :
+ for (const std::unique_ptr<const ContentCondition>& condition :
rule->conditions) {
- for (const scoped_ptr<const ContentPredicate>& predicate :
+ for (const std::unique_ptr<const ContentPredicate>& predicate :
condition->predicates) {
if (predicate.get()) {
new_predicates[predicate->GetEvaluator()][rule.get()].push_back(
@@ -285,7 +289,8 @@
}
// Notify the evaluators about their new predicates.
- for (const scoped_ptr<ContentPredicateEvaluator>& evaluator : evaluators_)
+ for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
+ evaluators_)
evaluator->TrackPredicates(new_predicates[evaluator.get()]);
// Wohoo, everything worked fine.
@@ -335,7 +340,8 @@
}
// Notify the evaluators to stop tracking the predicates that will be removed.
- for (const scoped_ptr<ContentPredicateEvaluator>& evaluator : evaluators_)
+ for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
+ evaluators_)
evaluator->StopTrackingPredicates(predicate_groups_to_stop_tracking);
// Remove the rules.
@@ -369,10 +375,10 @@
ContentAction::ApplyInfo apply_info =
{rule->extension, browser_context(), tab, rule->priority};
if (!ContainsKey(prev_matching_rules, rule)) {
- for (const scoped_ptr<const ContentAction>& action : rule->actions)
+ for (const std::unique_ptr<const ContentAction>& action : rule->actions)
action->Apply(apply_info);
} else {
- for (const scoped_ptr<const ContentAction>& action : rule->actions)
+ for (const std::unique_ptr<const ContentAction>& action : rule->actions)
action->Reapply(apply_info);
}
}
@@ -380,7 +386,7 @@
if (!ContainsKey(matching_rules, rule)) {
ContentAction::ApplyInfo apply_info =
{rule->extension, browser_context(), tab, rule->priority};
- for (const scoped_ptr<const ContentAction>& action : rule->actions)
+ for (const std::unique_ptr<const ContentAction>& action : rule->actions)
action->Revert(apply_info);
}
}
diff --git a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h
index f1c6714..b4e674a 100644
--- a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h
+++ b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -16,7 +17,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/declarative_content/content_action.h"
#include "chrome/browser/extensions/api/declarative_content/content_condition.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
@@ -56,7 +56,7 @@
public ContentPredicateEvaluator::Delegate {
public:
using PredicateEvaluatorsFactory =
- base::Callback<std::vector<scoped_ptr<ContentPredicateEvaluator>>(
+ base::Callback<std::vector<std::unique_ptr<ContentPredicateEvaluator>>(
ContentPredicateEvaluator::Delegate*)>;
// For testing, |cache_delegate| can be NULL. In that case it constructs the
@@ -105,14 +105,14 @@
struct ContentRule {
public:
ContentRule(const Extension* extension,
- std::vector<scoped_ptr<const ContentCondition>> conditions,
- std::vector<scoped_ptr<const ContentAction>> actions,
+ std::vector<std::unique_ptr<const ContentCondition>> conditions,
+ std::vector<std::unique_ptr<const ContentAction>> actions,
int priority);
~ContentRule();
const Extension* extension;
- std::vector<scoped_ptr<const ContentCondition>> conditions;
- std::vector<scoped_ptr<const ContentAction>> actions;
+ std::vector<std::unique_ptr<const ContentCondition>> conditions;
+ std::vector<std::unique_ptr<const ContentAction>> actions;
int priority;
private:
@@ -135,7 +135,7 @@
// and ContentAction. |extension| may be NULL in tests. If |error| is empty,
// the translation was successful and the returned rule is internally
// consistent.
- scoped_ptr<const ContentRule> CreateRule(
+ std::unique_ptr<const ContentRule> CreateRule(
const Extension* extension,
const std::map<std::string, ContentPredicateFactory*>&
predicate_factories,
@@ -175,7 +175,7 @@
// The evaluators responsible for creating predicates and tracking
// predicate-related state.
- std::vector<scoped_ptr<ContentPredicateEvaluator>> evaluators_;
+ std::vector<std::unique_ptr<ContentPredicateEvaluator>> evaluators_;
// Specifies what to do with evaluation requests.
EvaluationDisposition evaluation_disposition_;
diff --git a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc
index 4e119ea..47e503e5 100644
--- a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/test/values_test_util.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
@@ -51,12 +52,12 @@
return "test_predicate";
}
- scoped_ptr<const ContentPredicate> CreatePredicate(
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) override {
RequestEvaluationIfSpecified();
- return make_scoped_ptr(new TestPredicate(this));
+ return base::WrapUnique(new TestPredicate(this));
}
void TrackPredicates(
@@ -115,12 +116,12 @@
};
// Create the test evaluator and set |evaluator| to its pointer.
-std::vector<scoped_ptr<ContentPredicateEvaluator>> CreateTestEvaluator(
+std::vector<std::unique_ptr<ContentPredicateEvaluator>> CreateTestEvaluator(
TestPredicateEvaluator** evaluator,
ContentPredicateEvaluator::Delegate* delegate) {
- std::vector<scoped_ptr<ContentPredicateEvaluator>> evaluators;
+ std::vector<std::unique_ptr<ContentPredicateEvaluator>> evaluators;
*evaluator = new TestPredicateEvaluator(delegate);
- evaluators.push_back(scoped_ptr<ContentPredicateEvaluator>(*evaluator));
+ evaluators.push_back(std::unique_ptr<ContentPredicateEvaluator>(*evaluator));
return evaluators;
}
@@ -148,7 +149,7 @@
EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting());
- scoped_ptr<content::WebContents> tab = env()->MakeTab();
+ std::unique_ptr<content::WebContents> tab = env()->MakeTab();
registry->MonitorWebContentsForRuleEvaluation(tab.get());
registry->DidNavigateMainFrame(tab.get(), content::LoadCommittedDetails(),
content::FrameNavigateParams());
diff --git a/chrome/browser/extensions/api/declarative_content/content_action.cc b/chrome/browser/extensions/api/declarative_content/content_action.cc
index 42f91b6..d8e1497 100644
--- a/chrome/browser/extensions/api/declarative_content/content_action.cc
+++ b/chrome/browser/extensions/api/declarative_content/content_action.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/declarative_content/content_constants.h"
@@ -54,7 +55,7 @@
ShowPageAction() {}
~ShowPageAction() override {}
- static scoped_ptr<ContentAction> Create(
+ static std::unique_ptr<ContentAction> Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::DictionaryValue* dict,
@@ -62,9 +63,9 @@
// We can't show a page action if the extension doesn't have one.
if (ActionInfo::GetPageActionInfo(extension) == NULL) {
*error = kNoPageAction;
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
}
- return make_scoped_ptr(new ShowPageAction);
+ return base::WrapUnique(new ShowPageAction);
}
// Implementation of ContentAction:
@@ -104,7 +105,7 @@
: icon_(icon), action_type_(action_type) {}
~SetIcon() override {}
- static scoped_ptr<ContentAction> Create(
+ static std::unique_ptr<ContentAction> Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::DictionaryValue* dict,
@@ -182,7 +183,7 @@
// Factory methods for ContentAction instances. |extension| is the extension
// for which the action is being created. |dict| contains the json dictionary
// that describes the action. |error| is used to return error messages.
- using FactoryMethod = scoped_ptr<ContentAction>(*)(
+ using FactoryMethod = std::unique_ptr<ContentAction> (*)(
content::BrowserContext* /* browser_context */,
const Extension* /* extension */,
const base::DictionaryValue* /* dict */,
@@ -226,21 +227,21 @@
RequestContentScript::ScriptData::~ScriptData() {}
// static
-scoped_ptr<ContentAction> RequestContentScript::Create(
+std::unique_ptr<ContentAction> RequestContentScript::Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::DictionaryValue* dict,
std::string* error) {
ScriptData script_data;
if (!InitScriptData(dict, error, &script_data))
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
- return make_scoped_ptr(new RequestContentScript(browser_context, extension,
- script_data));
+ return base::WrapUnique(
+ new RequestContentScript(browser_context, extension, script_data));
}
// static
-scoped_ptr<ContentAction> RequestContentScript::CreateForTest(
+std::unique_ptr<ContentAction> RequestContentScript::CreateForTest(
DeclarativeUserScriptMaster* master,
const Extension* extension,
const base::Value& json_action,
@@ -253,17 +254,17 @@
if (!(json_action.GetAsDictionary(&action_dict) &&
action_dict->GetString(keys::kInstanceType, &instance_type) &&
instance_type == std::string(keys::kRequestContentScript)))
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
// Normal RequestContentScript data initialization.
ScriptData script_data;
if (!InitScriptData(action_dict, error, &script_data))
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
// Inject provided DeclarativeUserScriptMaster, rather than looking it up
// using a BrowserContext.
- return make_scoped_ptr(new RequestContentScript(master, extension,
- script_data));
+ return base::WrapUnique(
+ new RequestContentScript(master, extension, script_data));
}
// static
@@ -381,7 +382,7 @@
}
// static
-scoped_ptr<ContentAction> SetIcon::Create(
+std::unique_ptr<ContentAction> SetIcon::Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::DictionaryValue* dict,
@@ -394,7 +395,7 @@
type = ActionInfo::TYPE_BROWSER;
} else {
*error = kNoPageOrBrowserAction;
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
}
gfx::ImageSkia icon;
@@ -402,9 +403,9 @@
if (dict->GetDictionary("imageData", &canvas_set) &&
!ExtensionAction::ParseIconFromCanvasDictionary(*canvas_set, &icon)) {
*error = kInvalidIconDictionary;
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
}
- return make_scoped_ptr(new SetIcon(gfx::Image(icon), type));
+ return base::WrapUnique(new SetIcon(gfx::Image(icon), type));
}
//
@@ -414,7 +415,7 @@
ContentAction::~ContentAction() {}
// static
-scoped_ptr<ContentAction> ContentAction::Create(
+std::unique_ptr<ContentAction> ContentAction::Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::Value& json_action,
@@ -424,7 +425,7 @@
std::string instance_type;
if (!(json_action.GetAsDictionary(&action_dict) &&
action_dict->GetString(keys::kInstanceType, &instance_type)))
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
ContentActionFactory& factory = g_content_action_factory.Get();
std::map<std::string, ContentActionFactory::FactoryMethod>::iterator
@@ -434,7 +435,7 @@
browser_context, extension, action_dict, error);
*error = base::StringPrintf(kInvalidInstanceTypeError, instance_type.c_str());
- return scoped_ptr<ContentAction>();
+ return std::unique_ptr<ContentAction>();
}
ContentAction::ContentAction() {}
diff --git a/chrome/browser/extensions/api/declarative_content/content_action.h b/chrome/browser/extensions/api/declarative_content/content_action.h
index d26cd301..cfd6925e 100644
--- a/chrome/browser/extensions/api/declarative_content/content_action.h
+++ b/chrome/browser/extensions/api/declarative_content/content_action.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_ACTION_H_
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_ACTION_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/declarative_user_script_master.h"
#include "extensions/common/user_script.h"
@@ -54,7 +54,7 @@
// according to |json_action|, the representation of the ContentAction as
// received from the extension API. Sets |error| and returns NULL in case of
// an error.
- static scoped_ptr<ContentAction> Create(
+ static std::unique_ptr<ContentAction> Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::Value& json_action,
@@ -78,13 +78,13 @@
~RequestContentScript() override;
- static scoped_ptr<ContentAction> Create(
+ static std::unique_ptr<ContentAction> Create(
content::BrowserContext* browser_context,
const Extension* extension,
const base::DictionaryValue* dict,
std::string* error);
- static scoped_ptr<ContentAction> CreateForTest(
+ static std::unique_ptr<ContentAction> CreateForTest(
DeclarativeUserScriptMaster* master,
const Extension* extension,
const base::Value& json_action,
diff --git a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc
index 491e294..37f605b 100644
--- a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc
@@ -36,8 +36,7 @@
using base::test::ParseJson;
using testing::HasSubstr;
-
-scoped_ptr<base::DictionaryValue> SimpleManifest() {
+std::unique_ptr<base::DictionaryValue> SimpleManifest() {
return DictionaryBuilder()
.Set("name", "extension")
.Set("manifest_version", 2)
@@ -71,7 +70,7 @@
TEST(DeclarativeContentActionTest, InvalidCreation) {
TestExtensionEnvironment env;
std::string error;
- scoped_ptr<const ContentAction> result;
+ std::unique_ptr<const ContentAction> result;
// Test wrong data type passed.
error.clear();
@@ -106,13 +105,11 @@
const Extension* extension = env.MakeExtension(base::DictionaryValue());
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- NULL,
- extension,
- *ParseJson(
- "{\n"
- " \"instanceType\": \"declarativeContent.ShowPageAction\",\n"
- "}"),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ NULL, extension,
+ *ParseJson("{\n"
+ " \"instanceType\": \"declarativeContent.ShowPageAction\",\n"
+ "}"),
&error);
EXPECT_THAT(error, testing::HasSubstr("without a page action"));
ASSERT_FALSE(result.get());
@@ -124,20 +121,18 @@
const Extension* extension = env.MakeExtension(
*ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }"));
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- NULL,
- extension,
- *ParseJson(
- "{\n"
- " \"instanceType\": \"declarativeContent.ShowPageAction\",\n"
- "}"),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ NULL, extension,
+ *ParseJson("{\n"
+ " \"instanceType\": \"declarativeContent.ShowPageAction\",\n"
+ "}"),
&error);
EXPECT_EQ("", error);
ASSERT_TRUE(result.get());
ExtensionAction* page_action =
ExtensionActionManager::Get(env.profile())->GetPageAction(*extension);
- scoped_ptr<content::WebContents> contents = env.MakeTab();
+ std::unique_ptr<content::WebContents> contents = env.MakeTab();
const int tab_id = ExtensionTabUtil::GetTabId(contents.get());
EXPECT_FALSE(page_action->GetIsVisible(tab_id));
ContentAction::ApplyInfo apply_info = {
@@ -170,7 +165,7 @@
std::string data64;
base::Base64Encode(binary_data, &data64);
- scoped_ptr<base::DictionaryValue> dict =
+ std::unique_ptr<base::DictionaryValue> dict =
DictionaryBuilder()
.Set("instanceType", "declarativeContent.SetIcon")
.Set("imageData", DictionaryBuilder().Set("19", data64).Build())
@@ -179,17 +174,14 @@
const Extension* extension = env.MakeExtension(
*ParseJson("{\"page_action\": { \"default_title\": \"Extension\" } }"));
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- NULL,
- extension,
- *dict,
- &error);
+ std::unique_ptr<const ContentAction> result =
+ ContentAction::Create(NULL, extension, *dict, &error);
EXPECT_EQ("", error);
ASSERT_TRUE(result.get());
ExtensionAction* page_action =
ExtensionActionManager::Get(env.profile())->GetPageAction(*extension);
- scoped_ptr<content::WebContents> contents = env.MakeTab();
+ std::unique_ptr<content::WebContents> contents = env.MakeTab();
const int tab_id = ExtensionTabUtil::GetTabId(contents.get());
EXPECT_FALSE(page_action->GetIsVisible(tab_id));
ContentAction::ApplyInfo apply_info = {
@@ -207,9 +199,8 @@
TEST_F(RequestContentScriptTest, MissingScripts) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -224,9 +215,8 @@
TEST_F(RequestContentScriptTest, CSS) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -240,9 +230,8 @@
TEST_F(RequestContentScriptTest, JS) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -256,9 +245,8 @@
TEST_F(RequestContentScriptTest, CSSBadType) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -271,9 +259,8 @@
TEST_F(RequestContentScriptTest, JSBadType) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -286,9 +273,8 @@
TEST_F(RequestContentScriptTest, AllFrames) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -303,9 +289,8 @@
TEST_F(RequestContentScriptTest, MatchAboutBlank) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -320,9 +305,8 @@
TEST_F(RequestContentScriptTest, AllFramesBadType) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
@@ -336,9 +320,8 @@
TEST_F(RequestContentScriptTest, MatchAboutBlankBadType) {
Init();
std::string error;
- scoped_ptr<const ContentAction> result = ContentAction::Create(
- profile(),
- extension(),
+ std::unique_ptr<const ContentAction> result = ContentAction::Create(
+ profile(), extension(),
*ParseJson(
"{\n"
" \"instanceType\": \"declarativeContent.RequestContentScript\",\n"
diff --git a/chrome/browser/extensions/api/declarative_content/content_condition.cc b/chrome/browser/extensions/api/declarative_content/content_condition.cc
index 6cce824..6123045 100644
--- a/chrome/browser/extensions/api/declarative_content/content_condition.cc
+++ b/chrome/browser/extensions/api/declarative_content/content_condition.cc
@@ -27,12 +27,12 @@
} // namespace
ContentCondition::ContentCondition(
- std::vector<scoped_ptr<const ContentPredicate>> predicates)
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates)
: predicates(std::move(predicates)) {}
ContentCondition::~ContentCondition() {}
-scoped_ptr<ContentCondition> CreateContentCondition(
+std::unique_ptr<ContentCondition> CreateContentCondition(
const Extension* extension,
const std::map<std::string, ContentPredicateFactory*>& predicate_factories,
const base::Value& api_condition,
@@ -40,7 +40,7 @@
const base::DictionaryValue* api_condition_dict = nullptr;
if (!api_condition.GetAsDictionary(&api_condition_dict)) {
*error = kExpectedDictionary;
- return scoped_ptr<ContentCondition>();
+ return std::unique_ptr<ContentCondition>();
}
// Verify that we are dealing with a Condition whose type we understand.
@@ -48,14 +48,14 @@
if (!api_condition_dict->GetString(
declarative_content_constants::kInstanceType, &instance_type)) {
*error = kConditionWithoutInstanceType;
- return scoped_ptr<ContentCondition>();
+ return std::unique_ptr<ContentCondition>();
}
if (instance_type != declarative_content_constants::kPageStateMatcherType) {
*error = kExpectedOtherConditionType;
- return scoped_ptr<ContentCondition>();
+ return std::unique_ptr<ContentCondition>();
}
- std::vector<scoped_ptr<const ContentPredicate>> predicates;
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates;
for (base::DictionaryValue::Iterator iter(*api_condition_dict);
!iter.IsAtEnd(); iter.Advance()) {
const std::string& predicate_name = iter.key();
@@ -73,10 +73,10 @@
predicate_name.c_str());
if (!error->empty())
- return scoped_ptr<ContentCondition>();
+ return std::unique_ptr<ContentCondition>();
}
- return scoped_ptr<ContentCondition>(
+ return std::unique_ptr<ContentCondition>(
new ContentCondition(std::move(predicates)));
}
diff --git a/chrome/browser/extensions/api/declarative_content/content_condition.h b/chrome/browser/extensions/api/declarative_content/content_condition.h
index 9d19507..c9bf571 100644
--- a/chrome/browser/extensions/api/declarative_content/content_condition.h
+++ b/chrome/browser/extensions/api/declarative_content/content_condition.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
namespace base {
@@ -31,10 +31,10 @@
struct ContentCondition {
public:
explicit ContentCondition(
- std::vector<scoped_ptr<const ContentPredicate>> predicates);
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates);
~ContentCondition();
- std::vector<scoped_ptr<const ContentPredicate>> predicates;
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates;
private:
DISALLOW_COPY_AND_ASSIGN(ContentCondition);
@@ -45,7 +45,7 @@
// declarativeContent.PageStateMatcher from the Declarative Content
// API. |predicate_factories| maps attribute names in the API to factories that
// create the corresponding predicate.
-scoped_ptr<ContentCondition> CreateContentCondition(
+std::unique_ptr<ContentCondition> CreateContentCondition(
const Extension* extension,
const std::map<std::string, ContentPredicateFactory*>& predicate_factories,
const base::Value& condition,
diff --git a/chrome/browser/extensions/api/declarative_content/content_condition_unittest.cc b/chrome/browser/extensions/api/declarative_content/content_condition_unittest.cc
index defc3af..758dc9f 100644
--- a/chrome/browser/extensions/api/declarative_content/content_condition_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/content_condition_unittest.cc
@@ -35,12 +35,12 @@
: error_(error) {
}
- scoped_ptr<const ContentPredicate> CreatePredicate(
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) override {
*error = error_;
- return scoped_ptr<const ContentPredicate>();
+ return std::unique_ptr<const ContentPredicate>();
}
private:
@@ -53,11 +53,11 @@
public:
TestPredicateFactoryGeneratingPredicate() {}
- scoped_ptr<const ContentPredicate> CreatePredicate(
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) override {
- scoped_ptr<const ContentPredicate> predicate(new TestPredicate);
+ std::unique_ptr<const ContentPredicate> predicate(new TestPredicate);
created_predicates_.push_back(predicate.get());
return predicate;
}
@@ -79,14 +79,13 @@
TEST(DeclarativeContentConditionTest, UnknownPredicateName) {
std::string error;
- scoped_ptr<ContentCondition> condition = CreateContentCondition(
- nullptr,
- std::map<std::string, ContentPredicateFactory*>(),
+ std::unique_ptr<ContentCondition> condition = CreateContentCondition(
+ nullptr, std::map<std::string, ContentPredicateFactory*>(),
*base::test::ParseJson(
- "{\n"
- " \"invalid\": \"foobar\",\n"
- " \"instanceType\": \"declarativeContent.PageStateMatcher\",\n"
- "}"),
+ "{\n"
+ " \"invalid\": \"foobar\",\n"
+ " \"instanceType\": \"declarativeContent.PageStateMatcher\",\n"
+ "}"),
&error);
EXPECT_THAT(error, HasSubstr("Unknown condition attribute"));
EXPECT_FALSE(condition);
@@ -98,14 +97,13 @@
std::map<std::string, ContentPredicateFactory*> predicate_factories;
predicate_factories["test_predicate"] = &factory;
std::string error;
- scoped_ptr<ContentCondition> condition = CreateContentCondition(
- nullptr,
- predicate_factories,
+ std::unique_ptr<ContentCondition> condition = CreateContentCondition(
+ nullptr, predicate_factories,
*base::test::ParseJson(
- "{\n"
- " \"test_predicate\": \"\",\n"
- " \"instanceType\": \"declarativeContent.PageStateMatcher\",\n"
- "}"),
+ "{\n"
+ " \"test_predicate\": \"\",\n"
+ " \"instanceType\": \"declarativeContent.PageStateMatcher\",\n"
+ "}"),
&error);
EXPECT_EQ("error message", error);
EXPECT_FALSE(condition);
@@ -117,15 +115,14 @@
predicate_factories["test_predicate1"] = &factory1;
predicate_factories["test_predicate2"] = &factory2;
std::string error;
- scoped_ptr<ContentCondition> condition = CreateContentCondition(
- nullptr,
- predicate_factories,
+ std::unique_ptr<ContentCondition> condition = CreateContentCondition(
+ nullptr, predicate_factories,
*base::test::ParseJson(
- "{\n"
- " \"test_predicate1\": {},\n"
- " \"test_predicate2\": [],\n"
- " \"instanceType\": \"declarativeContent.PageStateMatcher\",\n"
- "}"),
+ "{\n"
+ " \"test_predicate1\": {},\n"
+ " \"test_predicate2\": [],\n"
+ " \"instanceType\": \"declarativeContent.PageStateMatcher\",\n"
+ "}"),
&error);
ASSERT_TRUE(condition);
ASSERT_EQ(1u, factory1.created_predicates().size());
diff --git a/chrome/browser/extensions/api/declarative_content/content_predicate.h b/chrome/browser/extensions/api/declarative_content/content_predicate.h
index 0f1c817..1237ddf 100644
--- a/chrome/browser/extensions/api/declarative_content/content_predicate.h
+++ b/chrome/browser/extensions/api/declarative_content/content_predicate.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_PREDICATE_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
namespace base {
class Value;
@@ -59,7 +59,7 @@
// Creates a new predicate from |value|, as specified in the declarative
// API. Sets *|error| and returns null if creation failed for any reason.
- virtual scoped_ptr<const ContentPredicate> CreatePredicate(
+ virtual std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) = 0;
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
index 17f89b1..00cfcc2 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
@@ -704,7 +704,7 @@
}
bool enable_redesign_;
- scoped_ptr<FeatureSwitch::ScopedOverride> override_toolbar_redesign_;
+ std::unique_ptr<FeatureSwitch::ScopedOverride> override_toolbar_redesign_;
DISALLOW_COPY_AND_ASSIGN(ShowPageActionWithoutPageActionTest);
};
@@ -837,7 +837,7 @@
browser()->tab_strip_model()->GetWebContentsAt(0);
AddTabAtIndex(1, GURL("http://test2/"), ui::PAGE_TRANSITION_LINK);
- scoped_ptr<content::WebContents> tab2(
+ std::unique_ptr<content::WebContents> tab2(
browser()->tab_strip_model()->GetWebContentsAt(1));
// Add a rule matching the second tab.
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.cc
index 811af35..4494dce 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.cc
@@ -26,9 +26,9 @@
base::RunLoop().RunUntilIdle();
}
-scoped_ptr<content::WebContents>
+std::unique_ptr<content::WebContents>
DeclarativeContentConditionTrackerTest::MakeTab() {
- scoped_ptr<content::WebContents> tab(
+ std::unique_ptr<content::WebContents> tab(
content::WebContentsTester::CreateTestWebContents(profile_.get(),
nullptr));
content::RenderFrameHostTester::For(tab->GetMainFrame())
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h b/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h
index 7656f3a..3cad393 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CONDITION_TRACKER_TEST_H_
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CONDITION_TRACKER_TEST_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_view_host.h"
@@ -33,7 +34,7 @@
protected:
// Creates a new WebContents and retains ownership.
- scoped_ptr<content::WebContents> MakeTab();
+ std::unique_ptr<content::WebContents> MakeTab();
// Gets the MockRenderProcessHost associated with a WebContents.
content::MockRenderProcessHost* GetMockRenderProcessHost(
@@ -49,7 +50,7 @@
// Enables MockRenderProcessHosts.
content::RenderViewHostTestEnabler render_view_host_test_enabler_;
- const scoped_ptr<TestingProfile> profile_;
+ const std::unique_ptr<TestingProfile> profile_;
uintptr_t next_predicate_group_id_;
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
index 489d02a..7df1685 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -37,11 +38,10 @@
}
// static
-scoped_ptr<DeclarativeContentCssPredicate>
-DeclarativeContentCssPredicate::Create(
- ContentPredicateEvaluator* evaluator,
- const base::Value& value,
- std::string* error) {
+std::unique_ptr<DeclarativeContentCssPredicate>
+DeclarativeContentCssPredicate::Create(ContentPredicateEvaluator* evaluator,
+ const base::Value& value,
+ std::string* error) {
std::vector<std::string> css_rules;
const base::ListValue* css_rules_value = nullptr;
if (value.GetAsList(&css_rules_value)) {
@@ -50,20 +50,20 @@
if (!css_rules_value->GetString(i, &css_rule)) {
*error = base::StringPrintf(kInvalidTypeOfParameter,
declarative_content_constants::kCss);
- return scoped_ptr<DeclarativeContentCssPredicate>();
+ return std::unique_ptr<DeclarativeContentCssPredicate>();
}
css_rules.push_back(css_rule);
}
} else {
*error = base::StringPrintf(kInvalidTypeOfParameter,
declarative_content_constants::kCss);
- return scoped_ptr<DeclarativeContentCssPredicate>();
+ return std::unique_ptr<DeclarativeContentCssPredicate>();
}
- return !css_rules.empty() ?
- make_scoped_ptr(
- new DeclarativeContentCssPredicate(evaluator, css_rules)) :
- scoped_ptr<DeclarativeContentCssPredicate>();
+ return !css_rules.empty()
+ ? base::WrapUnique(
+ new DeclarativeContentCssPredicate(evaluator, css_rules))
+ : std::unique_ptr<DeclarativeContentCssPredicate>();
}
ContentPredicateEvaluator*
@@ -162,10 +162,11 @@
return declarative_content_constants::kCss;
}
-scoped_ptr<const ContentPredicate> DeclarativeContentCssConditionTracker::
-CreatePredicate(const Extension* extension,
- const base::Value& value,
- std::string* error) {
+std::unique_ptr<const ContentPredicate>
+DeclarativeContentCssConditionTracker::CreatePredicate(
+ const Extension* extension,
+ const base::Value& value,
+ std::string* error) {
return DeclarativeContentCssPredicate::Create(this, value, error);
}
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
index 76317ff4..bf0fc7b 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_CSS_CONDITION_TRACKER_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -44,7 +44,7 @@
return css_selectors_;
}
- static scoped_ptr<DeclarativeContentCssPredicate> Create(
+ static std::unique_ptr<DeclarativeContentCssPredicate> Create(
ContentPredicateEvaluator* evaluator,
const base::Value& value,
std::string* error);
@@ -74,7 +74,7 @@
// ContentPredicateEvaluator:
std::string GetPredicateApiAttributeName() const override;
- scoped_ptr<const ContentPredicate> CreatePredicate(
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) override;
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
index 528df68..5b66eb0 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h"
+#include <memory>
#include <tuple>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/test/values_test_util.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
#include "chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h"
@@ -53,8 +53,9 @@
};
// Creates a predicate with appropriate expectations of success.
- scoped_ptr<const ContentPredicate> CreatePredicate(const std::string& value) {
- scoped_ptr<const ContentPredicate> predicate;
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
+ const std::string& value) {
+ std::unique_ptr<const ContentPredicate> predicate;
CreatePredicateImpl(value, &predicate);
return predicate;
}
@@ -102,9 +103,8 @@
private:
// This function exists to work around the gtest limitation that functions
// with fatal assertions must return void.
- void CreatePredicateImpl(
- const std::string& value,
- scoped_ptr<const ContentPredicate>* predicate) {
+ void CreatePredicateImpl(const std::string& value,
+ std::unique_ptr<const ContentPredicate>* predicate) {
std::string error;
*predicate = tracker_.CreatePredicate(
nullptr,
@@ -119,22 +119,18 @@
TEST(DeclarativeContentCssPredicateTest, WrongCssDatatype) {
std::string error;
- scoped_ptr<DeclarativeContentCssPredicate> predicate =
+ std::unique_ptr<DeclarativeContentCssPredicate> predicate =
DeclarativeContentCssPredicate::Create(
- nullptr,
- *base::test::ParseJson("\"selector\""),
- &error);
+ nullptr, *base::test::ParseJson("\"selector\""), &error);
EXPECT_THAT(error, HasSubstr("invalid type"));
EXPECT_FALSE(predicate);
}
TEST(DeclarativeContentCssPredicateTest, CssPredicate) {
std::string error;
- scoped_ptr<DeclarativeContentCssPredicate> predicate =
+ std::unique_ptr<DeclarativeContentCssPredicate> predicate =
DeclarativeContentCssPredicate::Create(
- nullptr,
- *base::test::ParseJson("[\"input\", \"a\"]"),
- &error);
+ nullptr, *base::test::ParseJson("[\"input\", \"a\"]"), &error);
EXPECT_EQ("", error);
ASSERT_TRUE(predicate);
@@ -144,13 +140,13 @@
// Tests that adding and removing predicates causes a WatchPages message to be
// sent.
TEST_F(DeclarativeContentCssConditionTrackerTest, AddAndRemovePredicates) {
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
tracker_.TrackForWebContents(tab.get());
EXPECT_EQ(0, delegate_.evaluation_requests());
// Check that adding predicates sends a WatchPages message with the
// corresponding selectors to the tab's RenderProcessHost.
- std::vector<scoped_ptr<const ContentPredicate>> predicates;
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates;
predicates.push_back(CreatePredicate("[\"a\", \"div\"]"));
predicates.push_back(CreatePredicate("[\"b\"]"));
predicates.push_back(CreatePredicate("[\"input\"]"));
@@ -195,13 +191,14 @@
// as an existing predicate does not cause a WatchPages message to be sent.
TEST_F(DeclarativeContentCssConditionTrackerTest,
AddAndRemovePredicatesWithSameSelectors) {
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
tracker_.TrackForWebContents(tab.get());
EXPECT_EQ(0, delegate_.evaluation_requests());
// Add the first predicate and expect a WatchPages message.
std::string error;
- scoped_ptr<const ContentPredicate> predicate1 = CreatePredicate("[\"a\"]");
+ std::unique_ptr<const ContentPredicate> predicate1 =
+ CreatePredicate("[\"a\"]");
std::map<const void*, std::vector<const ContentPredicate*>> predicate_groups1;
const void* const group1 = GeneratePredicateGroupID();
@@ -217,7 +214,8 @@
// Add the second predicate specifying the same selector and expect no
// WatchPages message.
- scoped_ptr<const ContentPredicate> predicate2 = CreatePredicate("[\"a\"]");
+ std::unique_ptr<const ContentPredicate> predicate2 =
+ CreatePredicate("[\"a\"]");
std::map<const void*, std::vector<const ContentPredicate*>> predicate_groups2;
const void* const group2 = GeneratePredicateGroupID();
@@ -247,13 +245,14 @@
TEST_F(DeclarativeContentCssConditionTrackerTest, WatchedPageChange) {
int expected_evaluation_requests = 0;
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
tracker_.TrackForWebContents(tab.get());
EXPECT_EQ(expected_evaluation_requests, delegate_.evaluation_requests());
- scoped_ptr<const ContentPredicate> div_predicate =
+ std::unique_ptr<const ContentPredicate> div_predicate =
CreatePredicate("[\"div\"]");
- scoped_ptr<const ContentPredicate> a_predicate = CreatePredicate("[\"a\"]");
+ std::unique_ptr<const ContentPredicate> a_predicate =
+ CreatePredicate("[\"a\"]");
std::map<const void*, std::vector<const ContentPredicate*>> predicate_groups;
const void* const group = GeneratePredicateGroupID();
@@ -283,11 +282,12 @@
int expected_evaluation_requests = 0;
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
tracker_.TrackForWebContents(tab.get());
EXPECT_EQ(expected_evaluation_requests, delegate_.evaluation_requests());
- scoped_ptr<const ContentPredicate> predicate = CreatePredicate("[\"div\"]");
+ std::unique_ptr<const ContentPredicate> predicate =
+ CreatePredicate("[\"div\"]");
std::map<const void*, std::vector<const ContentPredicate*>> predicate_groups;
const void* const group = GeneratePredicateGroupID();
predicate_groups[group].push_back(predicate.get());
@@ -323,7 +323,7 @@
// https://crbug.com/497586
TEST_F(DeclarativeContentCssConditionTrackerTest, WebContentsOutlivesTracker) {
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
{
DeclarativeContentCssConditionTracker tracker(&delegate_);
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
index c4c24c7c..ac22f8d7 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h"
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -43,7 +44,7 @@
}
// static
-scoped_ptr<DeclarativeContentIsBookmarkedPredicate>
+std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>
DeclarativeContentIsBookmarkedPredicate::Create(
ContentPredicateEvaluator* evaluator,
const Extension* extension,
@@ -53,16 +54,15 @@
if (value.GetAsBoolean(&is_bookmarked)) {
if (!HasBookmarkAPIPermission(extension)) {
*error = kIsBookmarkedRequiresBookmarkPermission;
- return scoped_ptr<DeclarativeContentIsBookmarkedPredicate>();
+ return std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>();
} else {
- return make_scoped_ptr(
- new DeclarativeContentIsBookmarkedPredicate(evaluator, extension,
- is_bookmarked));
+ return base::WrapUnique(new DeclarativeContentIsBookmarkedPredicate(
+ evaluator, extension, is_bookmarked));
}
} else {
*error = base::StringPrintf(kInvalidTypeOfParameter,
declarative_content_constants::kIsBookmarked);
- return scoped_ptr<DeclarativeContentIsBookmarkedPredicate>();
+ return std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>();
}
}
@@ -168,7 +168,7 @@
return declarative_content_constants::kIsBookmarked;
}
-scoped_ptr<const ContentPredicate>
+std::unique_ptr<const ContentPredicate>
DeclarativeContentIsBookmarkedConditionTracker::CreatePredicate(
const Extension* extension,
const base::Value& value,
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
index e020d664..88cc0806 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_IS_BOOKMARKED_CONDITION_TRACKER_H_
#include <map>
+#include <memory>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
@@ -40,7 +40,7 @@
bool is_bookmarked() const { return is_bookmarked_; }
- static scoped_ptr<DeclarativeContentIsBookmarkedPredicate> Create(
+ static std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> Create(
ContentPredicateEvaluator* evaluator,
const Extension* extension,
const base::Value& value,
@@ -77,7 +77,7 @@
// ContentPredicateEvaluator:
std::string GetPredicateApiAttributeName() const override;
- scoped_ptr<const ContentPredicate> CreatePredicate(
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) override;
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
index e519242..69eabb1 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h"
+#include <memory>
#include <set>
#include <utility>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/values_test_util.h"
@@ -48,17 +48,15 @@
.Build();
}
-scoped_ptr<DeclarativeContentIsBookmarkedPredicate> CreatePredicate(
+std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> CreatePredicate(
ContentPredicateEvaluator* evaluator,
const Extension* extension,
bool is_bookmarked) {
std::string error;
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
DeclarativeContentIsBookmarkedPredicate::Create(
- evaluator,
- extension,
- *base::test::ParseJson(is_bookmarked ? "true" : "false"),
- &error);
+ evaluator, extension,
+ *base::test::ParseJson(is_bookmarked ? "true" : "false"), &error);
EXPECT_EQ("", error);
EXPECT_TRUE(predicate);
EXPECT_EQ(is_bookmarked, predicate->is_bookmarked());
@@ -151,10 +149,11 @@
Delegate delegate_;
bookmarks::BookmarkModel* bookmark_model_;
- scoped_ptr<DeclarativeContentIsBookmarkedConditionTracker> tracker_;
+ std::unique_ptr<DeclarativeContentIsBookmarkedConditionTracker> tracker_;
scoped_refptr<Extension> extension_;
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate> is_bookmarked_predicate_;
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate>
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>
+ is_bookmarked_predicate_;
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>
is_not_bookmarked_predicate_;
private:
@@ -168,12 +167,9 @@
scoped_refptr<Extension> extension =
CreateExtensionWithBookmarksPermission(false);
std::string error;
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
DeclarativeContentIsBookmarkedPredicate::Create(
- nullptr,
- extension.get(),
- *base::test::ParseJson("true"),
- &error);
+ nullptr, extension.get(), *base::test::ParseJson("true"), &error);
EXPECT_THAT(error, HasSubstr("requires 'bookmarks' permission"));
EXPECT_FALSE(predicate);
}
@@ -184,12 +180,9 @@
scoped_refptr<Extension> extension =
CreateExtensionWithBookmarksPermission(true);
std::string error;
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
DeclarativeContentIsBookmarkedPredicate::Create(
- nullptr,
- extension.get(),
- *base::test::ParseJson("[]"),
- &error);
+ nullptr, extension.get(), *base::test::ParseJson("[]"), &error);
EXPECT_THAT(error, HasSubstr("invalid type"));
EXPECT_FALSE(predicate);
}
@@ -198,7 +191,7 @@
TEST(DeclarativeContentIsBookmarkedPredicateTest, IsBookmarkedPredicateTrue) {
scoped_refptr<Extension> extension =
CreateExtensionWithBookmarksPermission(true);
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
CreatePredicate(nullptr, extension.get(), true);
}
@@ -206,7 +199,7 @@
TEST(DeclarativeContentIsBookmarkedPredicateTest, IsBookmarkedPredicateFalse) {
scoped_refptr<Extension> extension =
CreateExtensionWithBookmarksPermission(true);
- scoped_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
+ std::unique_ptr<DeclarativeContentIsBookmarkedPredicate> predicate =
CreatePredicate(nullptr, extension.get(), false);
}
@@ -214,7 +207,7 @@
// results in the proper IsUrlBookmarked state.
TEST_F(DeclarativeContentIsBookmarkedConditionTrackerTest,
BookmarkedAtStartOfTracking) {
- scoped_ptr<content::WebContents> tab = MakeTab();
+ std::unique_ptr<content::WebContents> tab = MakeTab();
LoadURL(tab.get(), GURL("http://bookmarked/"));
EXPECT_TRUE(delegate_.evaluation_requests().empty());
@@ -232,7 +225,7 @@
TEST_F(DeclarativeContentIsBookmarkedConditionTrackerTest,
AddAndRemoveBookmark) {
// Create two tabs.
- std::vector<scoped_ptr<content::WebContents>> tabs;
+ std::vector<std::unique_ptr<content::WebContents>> tabs;
for (int i = 0; i < 2; ++i) {
tabs.push_back(MakeTab());
delegate_.evaluation_requests().clear();
@@ -277,7 +270,7 @@
// matching WebContents.
TEST_F(DeclarativeContentIsBookmarkedConditionTrackerTest, ExtensiveChanges) {
// Create two tabs.
- std::vector<scoped_ptr<content::WebContents>> tabs;
+ std::vector<std::unique_ptr<content::WebContents>> tabs;
for (int i = 0; i < 2; ++i) {
tabs.push_back(MakeTab());
delegate_.evaluation_requests().clear();
@@ -380,7 +373,7 @@
GURL("http://bookmarked2/"));
// Create two tabs.
- std::vector<scoped_ptr<content::WebContents>> tabs;
+ std::vector<std::unique_ptr<content::WebContents>> tabs;
for (int i = 0; i < 2; ++i) {
tabs.push_back(MakeTab());
delegate_.evaluation_requests().clear();
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc
index d7f8774a..5866146 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h"
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -30,7 +31,7 @@
}
// static
-scoped_ptr<DeclarativeContentPageUrlPredicate>
+std::unique_ptr<DeclarativeContentPageUrlPredicate>
DeclarativeContentPageUrlPredicate::Create(
ContentPredicateEvaluator* evaluator,
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
@@ -41,16 +42,15 @@
if (!value.GetAsDictionary(&dict)) {
*error = base::StringPrintf(kInvalidTypeOfParameter,
declarative_content_constants::kPageUrl);
- return scoped_ptr<DeclarativeContentPageUrlPredicate>();
+ return std::unique_ptr<DeclarativeContentPageUrlPredicate>();
} else {
url_matcher_condition_set =
url_matcher::URLMatcherFactory::CreateFromURLFilterDictionary(
url_matcher_condition_factory, dict, ++g_next_id, error);
if (!url_matcher_condition_set)
- return scoped_ptr<DeclarativeContentPageUrlPredicate>();
- return make_scoped_ptr(
- new DeclarativeContentPageUrlPredicate(evaluator,
- url_matcher_condition_set));
+ return std::unique_ptr<DeclarativeContentPageUrlPredicate>();
+ return base::WrapUnique(new DeclarativeContentPageUrlPredicate(
+ evaluator, url_matcher_condition_set));
}
}
@@ -120,10 +120,11 @@
return declarative_content_constants::kPageUrl;
}
-scoped_ptr<const ContentPredicate> DeclarativeContentPageUrlConditionTracker::
-CreatePredicate(const Extension* extension,
- const base::Value& value,
- std::string* error) {
+std::unique_ptr<const ContentPredicate>
+DeclarativeContentPageUrlConditionTracker::CreatePredicate(
+ const Extension* extension,
+ const base::Value& value,
+ std::string* error) {
return DeclarativeContentPageUrlPredicate::Create(this,
url_matcher_.condition_factory(), value, error);
}
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h
index 10d2060..e8226bd 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_PAGE_URL_CONDITION_TRACKER_H_
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DECLARATIVE_CONTENT_PAGE_URL_CONDITION_TRACKER_H_
+#include <memory>
#include <set>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
#include "components/url_matcher/url_matcher.h"
#include "content/public/browser/web_contents_observer.h"
@@ -40,7 +40,7 @@
return url_matcher_condition_set_.get();
}
- static scoped_ptr<DeclarativeContentPageUrlPredicate> Create(
+ static std::unique_ptr<DeclarativeContentPageUrlPredicate> Create(
ContentPredicateEvaluator* evaluator,
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& value,
@@ -73,7 +73,7 @@
// ContentPredicateEvaluator:
std::string GetPredicateApiAttributeName() const override;
- scoped_ptr<const ContentPredicate> CreatePredicate(
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) override;
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
index ef84150..ef8dad9 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
@@ -59,8 +59,9 @@
}
// Creates a predicate with appropriate expectations of success.
- scoped_ptr<const ContentPredicate> CreatePredicate(const std::string& value) {
- scoped_ptr<const ContentPredicate> predicate;
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
+ const std::string& value) {
+ std::unique_ptr<const ContentPredicate> predicate;
CreatePredicateImpl(value, &predicate);
return predicate;
}
@@ -77,7 +78,7 @@
// This function exists to work around the gtest limitation that functions
// with fatal assertions must return void.
void CreatePredicateImpl(const std::string& value,
- scoped_ptr<const ContentPredicate>* predicate) {
+ std::unique_ptr<const ContentPredicate>* predicate) {
std::string error;
*predicate = tracker_.CreatePredicate(
nullptr,
@@ -93,11 +94,10 @@
TEST(DeclarativeContentPageUrlPredicateTest, WrongPageUrlDatatype) {
url_matcher::URLMatcher matcher;
std::string error;
- scoped_ptr<DeclarativeContentPageUrlPredicate> predicate =
- DeclarativeContentPageUrlPredicate::Create(nullptr,
- matcher.condition_factory(),
- *base::test::ParseJson("[]"),
- &error);
+ std::unique_ptr<DeclarativeContentPageUrlPredicate> predicate =
+ DeclarativeContentPageUrlPredicate::Create(
+ nullptr, matcher.condition_factory(), *base::test::ParseJson("[]"),
+ &error);
EXPECT_THAT(error, HasSubstr("invalid type"));
EXPECT_FALSE(predicate);
@@ -107,12 +107,10 @@
TEST(DeclarativeContentPageUrlPredicateTest, PageUrlPredicate) {
url_matcher::URLMatcher matcher;
std::string error;
- scoped_ptr<DeclarativeContentPageUrlPredicate> predicate =
+ std::unique_ptr<DeclarativeContentPageUrlPredicate> predicate =
DeclarativeContentPageUrlPredicate::Create(
- nullptr,
- matcher.condition_factory(),
- *base::test::ParseJson("{\"hostSuffix\": \"example.com\"}"),
- &error);
+ nullptr, matcher.condition_factory(),
+ *base::test::ParseJson("{\"hostSuffix\": \"example.com\"}"), &error);
EXPECT_EQ("", error);
ASSERT_TRUE(predicate);
@@ -134,7 +132,7 @@
// the matching WebContents.
TEST_F(DeclarativeContentPageUrlConditionTrackerTest, AddAndRemovePredicates) {
// Create four tabs.
- std::vector<scoped_ptr<content::WebContents>> tabs;
+ std::vector<std::unique_ptr<content::WebContents>> tabs;
for (int i = 0; i < 4; ++i) {
tabs.push_back(MakeTab());
delegate_.evaluation_requests().clear();
@@ -149,7 +147,7 @@
LoadURL(tabs[1].get(), GURL("http://test2/"));
LoadURL(tabs[2].get(), GURL("http://test3/"));
- std::vector<scoped_ptr<const ContentPredicate>> predicates;
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates;
std::string error;
predicates.push_back(CreatePredicate("{\"hostPrefix\": \"test1\"}"));
predicates.push_back(CreatePredicate("{\"hostPrefix\": \"test2\"}"));
@@ -201,7 +199,7 @@
// rules.
TEST_F(DeclarativeContentPageUrlConditionTrackerTest, TrackWebContents) {
std::string error;
- scoped_ptr<const ContentPredicate> predicate =
+ std::unique_ptr<const ContentPredicate> predicate =
CreatePredicate("{\"hostPrefix\": \"test1\"}");
delegate_.evaluation_requests().clear();
@@ -211,7 +209,7 @@
tracker_.TrackPredicates(predicates);
EXPECT_TRUE(delegate_.evaluation_requests().empty());
- const scoped_ptr<content::WebContents> matching_tab = MakeTab();
+ const std::unique_ptr<content::WebContents> matching_tab = MakeTab();
LoadURL(matching_tab.get(), GURL("http://test1/"));
tracker_.TrackForWebContents(matching_tab.get());
@@ -219,7 +217,7 @@
UnorderedElementsAre(matching_tab.get()));
delegate_.evaluation_requests().clear();
- const scoped_ptr<content::WebContents> non_matching_tab = MakeTab();
+ const std::unique_ptr<content::WebContents> non_matching_tab = MakeTab();
tracker_.TrackForWebContents(non_matching_tab.get());
EXPECT_THAT(delegate_.evaluation_requests(),
UnorderedElementsAre(non_matching_tab.get()));
@@ -235,7 +233,7 @@
TEST_F(DeclarativeContentPageUrlConditionTrackerTest,
NotifyWebContentsNavigation) {
std::string error;
- scoped_ptr<const ContentPredicate> predicate =
+ std::unique_ptr<const ContentPredicate> predicate =
CreatePredicate("{\"hostPrefix\": \"test1\"}");
delegate_.evaluation_requests().clear();
@@ -245,7 +243,7 @@
tracker_.TrackPredicates(predicates);
EXPECT_TRUE(delegate_.evaluation_requests().empty());
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
tracker_.TrackForWebContents(tab.get());
EXPECT_THAT(delegate_.evaluation_requests(),
UnorderedElementsAre(tab.get()));
diff --git a/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.cc b/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.cc
index cce04f6..2565059 100644
--- a/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.cc
+++ b/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.cc
@@ -10,16 +10,16 @@
namespace extensions {
-std::vector<scoped_ptr<ContentPredicateEvaluator>>
+std::vector<std::unique_ptr<ContentPredicateEvaluator>>
CreateDefaultContentPredicateEvaluators(
content::BrowserContext* browser_context,
ContentPredicateEvaluator::Delegate* delegate) {
- std::vector<scoped_ptr<ContentPredicateEvaluator>> evaluators;
- evaluators.push_back(scoped_ptr<ContentPredicateEvaluator>(
+ std::vector<std::unique_ptr<ContentPredicateEvaluator>> evaluators;
+ evaluators.push_back(std::unique_ptr<ContentPredicateEvaluator>(
new DeclarativeContentPageUrlConditionTracker(delegate)));
- evaluators.push_back(scoped_ptr<ContentPredicateEvaluator>(
+ evaluators.push_back(std::unique_ptr<ContentPredicateEvaluator>(
new DeclarativeContentCssConditionTracker(delegate)));
- evaluators.push_back(scoped_ptr<ContentPredicateEvaluator>(
+ evaluators.push_back(std::unique_ptr<ContentPredicateEvaluator>(
new DeclarativeContentIsBookmarkedConditionTracker(browser_context,
delegate)));
return evaluators;
diff --git a/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.h b/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.h
index b7f1a90..d4a10fe 100644
--- a/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.h
+++ b/chrome/browser/extensions/api/declarative_content/default_content_predicate_evaluators.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DEFAULT_CONTENT_PREDICATE_EVALUATORS_H_
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_DEFAULT_CONTENT_PREDICATE_EVALUATORS_H_
+#include <memory>
#include <vector>
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
namespace content {
@@ -16,7 +16,7 @@
namespace extensions {
-std::vector<scoped_ptr<ContentPredicateEvaluator>>
+std::vector<std::unique_ptr<ContentPredicateEvaluator>>
CreateDefaultContentPredicateEvaluators(
content::BrowserContext* browser_context,
ContentPredicateEvaluator::Delegate* delegate);
diff --git a/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc b/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc
index e16014d..efd41cb7 100644
--- a/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc
+++ b/chrome/browser/extensions/api/declarative_content/request_content_script_apitest.cc
@@ -107,7 +107,7 @@
PermissionOrMatcherType manifest_permission,
PermissionOrMatcherType script_matcher);
- scoped_ptr<TestExtensionDir> test_extension_dir_;
+ std::unique_ptr<TestExtensionDir> test_extension_dir_;
const Extension* extension_;
};
@@ -171,7 +171,7 @@
kBackgroundScriptSource,
kScriptMatchers[script_matcher]);
- scoped_ptr<TestExtensionDir> dir(new TestExtensionDir);
+ std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir);
dir->WriteManifest(manifest);
dir->WriteFile(FILE_PATH_LITERAL("background.js"), background_src);
dir->WriteFile(FILE_PATH_LITERAL("script.js"),
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
index 6545895..5a79994 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
@@ -6,11 +6,12 @@
#include <stddef.h>
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/test/values_test_util.h"
#include "base/time/time.h"
@@ -43,8 +44,8 @@
const char kUnknownActionType[] = "unknownType";
-scoped_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) {
- scoped_ptr<base::Value> parsed_value(base::test::ParseJson(json));
+std::unique_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) {
+ std::unique_ptr<base::Value> parsed_value(base::test::ParseJson(json));
const base::ListValue* parsed_list;
CHECK(parsed_value->GetAsList(&parsed_list));
@@ -60,7 +61,7 @@
std::string error;
bool bad_message = false;
- scoped_ptr<WebRequestActionSet> action_set(
+ std::unique_ptr<WebRequestActionSet> action_set(
WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message));
EXPECT_EQ("", error);
EXPECT_FALSE(bad_message);
@@ -144,8 +145,8 @@
const std::string& extension_id,
const WebRequestActionSet* action_set,
RequestStage stage) {
- scoped_ptr<net::URLRequest> regular_request(context_.CreateRequest(
- GURL(url_string), net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> regular_request(
+ context_.CreateRequest(GURL(url_string), net::DEFAULT_PRIORITY, NULL));
std::list<LinkedPtrEventResponseDelta> deltas;
scoped_refptr<net::HttpResponseHeaders> headers(
new net::HttpResponseHeaders(""));
@@ -162,7 +163,7 @@
void WebRequestActionWithThreadsTest::CheckActionNeedsAllUrls(
const char* action,
RequestStage stage) {
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(action));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(action));
// Although |extension_| has matching *.com host permission, |action|
// is intentionally forbidden -- in Declarative WR, host permission
@@ -222,7 +223,7 @@
TEST(WebRequestActionTest, CreateActionSet) {
std::string error;
bool bad_message = false;
- scoped_ptr<WebRequestActionSet> result;
+ std::unique_ptr<WebRequestActionSet> result;
WebRequestActionSet::Values input;
@@ -341,7 +342,7 @@
" \"instanceType\": \"declarativeWebRequest.SendMessageToExtension\","
" \"message\": \"testtext\""
"}]";
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
// For sending messages, specific host permissions actually matter.
EXPECT_TRUE(ActionWorksOnRequest("http://test.com",
@@ -426,7 +427,7 @@
"[{"
" \"instanceType\": \"declarativeWebRequest.CancelRequest\""
"}]";
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
// Cancelling requests works without full host permissions.
EXPECT_TRUE(ActionWorksOnRequest("http://test.org",
@@ -441,7 +442,7 @@
"[{"
" \"instanceType\": \"declarativeWebRequest.RedirectToTransparentImage\""
"}]";
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
// Redirecting to transparent images works without full host permissions.
EXPECT_TRUE(ActionWorksOnRequest("http://test.org",
@@ -459,7 +460,7 @@
"[{"
" \"instanceType\": \"declarativeWebRequest.RedirectToEmptyDocument\""
"}]";
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
// Redirecting to the empty document works without full host permissions.
EXPECT_TRUE(ActionWorksOnRequest("http://test.org",
@@ -479,7 +480,7 @@
" \"lowerPriorityThan\": 123,"
" \"hasTag\": \"some_tag\""
"}]";
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kAction));
// Ignoring rules works without full host permissions.
EXPECT_TRUE(ActionWorksOnRequest("http://test.org",
@@ -580,7 +581,7 @@
"declarativeWebRequest.RedirectToEmptyDocument",
"declarativeWebRequest.IgnoreRules",
};
- scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kActions));
+ std::unique_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kActions));
ASSERT_EQ(arraysize(kExpectedNames), action_set->actions().size());
size_t index = 0;
for (WebRequestActionSet::Actions::const_iterator it =
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
index 3bab5479..5f6b722 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
@@ -6,13 +6,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
#include "base/test/values_test_util.h"
@@ -188,7 +188,7 @@
// Create a condition with the attributes specified. An example value of
// |attributes| is: "\"resourceType\": [\"stylesheet\"], \n".
- scoped_ptr<base::Value> CreateCondition(const std::string& attributes) {
+ std::unique_ptr<base::Value> CreateCondition(const std::string& attributes) {
std::string json_description =
"{ \n"
" \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n";
@@ -278,8 +278,8 @@
GURL http_url("http://www.example.com");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> http_request(context.CreateRequest(
- http_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> http_request(
+ context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data(http_request.get(), ON_BEFORE_REQUEST);
matches = registry->GetMatches(request_data);
EXPECT_EQ(2u, matches.size());
@@ -292,8 +292,8 @@
EXPECT_TRUE(ContainsKey(matches_ids, std::make_pair(kExtensionId, kRuleId2)));
GURL foobar_url("http://www.foobar.com");
- scoped_ptr<net::URLRequest> foobar_request(context.CreateRequest(
- foobar_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> foobar_request(
+ context.CreateRequest(foobar_url, net::DEFAULT_PRIORITY, NULL));
request_data.request = foobar_request.get();
matches = registry->GetMatches(request_data);
EXPECT_EQ(1u, matches.size());
@@ -419,8 +419,8 @@
GURL url("http://www.google.com");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
- url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data(request.get(), ON_BEFORE_REQUEST);
std::list<LinkedPtrEventResponseDelta> deltas =
registry->CreateDeltas(NULL, request_data, false);
@@ -468,8 +468,8 @@
GURL url("http://www.google.com/index.html");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
- url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data(request.get(), ON_BEFORE_REQUEST);
std::list<LinkedPtrEventResponseDelta> deltas =
registry->CreateDeltas(NULL, request_data, false);
@@ -523,9 +523,9 @@
" \"priority\": 300 \n"
"} ";
- scoped_ptr<base::Value> value1 = base::JSONReader::Read(kRule1);
+ std::unique_ptr<base::Value> value1 = base::JSONReader::Read(kRule1);
ASSERT_TRUE(value1.get());
- scoped_ptr<base::Value> value2 = base::JSONReader::Read(kRule2);
+ std::unique_ptr<base::Value> value2 = base::JSONReader::Read(kRule2);
ASSERT_TRUE(value2.get());
std::vector<linked_ptr<api::events::Rule>> rules;
@@ -542,8 +542,8 @@
GURL url("http://www.foo.com/test");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
- url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data(request.get(), ON_BEFORE_REQUEST);
std::list<LinkedPtrEventResponseDelta> deltas =
registry->CreateDeltas(NULL, request_data, false);
@@ -592,8 +592,8 @@
GURL http_url("http://www.example.com");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> http_request(context.CreateRequest(
- http_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> http_request(
+ context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data(http_request.get(), ON_BEFORE_REQUEST);
matches = registry->GetMatches(request_data);
EXPECT_EQ(1u, matches.size());
@@ -651,8 +651,8 @@
for (size_t i = 0; i < arraysize(matchingRuleIds); ++i) {
// Construct the inputs.
- scoped_ptr<net::URLRequest> http_request(context.CreateRequest(
- urls[i], net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> http_request(
+ context.CreateRequest(urls[i], net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data(http_request.get(), ON_BEFORE_REQUEST);
http_request->set_first_party_for_cookies(firstPartyUrls[i]);
// Now run both rules on the input.
@@ -692,7 +692,7 @@
" \"priority\": 200 \n"
"} ";
- scoped_ptr<base::Value> value = base::JSONReader::Read(kRule);
+ std::unique_ptr<base::Value> value = base::JSONReader::Read(kRule);
ASSERT_TRUE(value);
api::events::Rule rule;
@@ -700,16 +700,15 @@
std::string error;
URLMatcher matcher;
- scoped_ptr<WebRequestConditionSet> conditions =
- WebRequestConditionSet::Create(
- NULL, matcher.condition_factory(), rule.conditions, &error);
+ std::unique_ptr<WebRequestConditionSet> conditions =
+ WebRequestConditionSet::Create(NULL, matcher.condition_factory(),
+ rule.conditions, &error);
ASSERT_TRUE(error.empty()) << error;
ASSERT_TRUE(conditions);
bool bad_message = false;
- scoped_ptr<WebRequestActionSet> actions =
- WebRequestActionSet::Create(
- NULL, NULL, rule.actions, &error, &bad_message);
+ std::unique_ptr<WebRequestActionSet> actions = WebRequestActionSet::Create(
+ NULL, NULL, rule.actions, &error, &bad_message);
ASSERT_TRUE(error.empty()) << error;
ASSERT_FALSE(bad_message);
ASSERT_TRUE(actions);
@@ -726,7 +725,7 @@
" \"instanceType\": \"declarativeWebRequest.RedirectRequest\",\n"
" \"redirectUrl\": \"http://bar.com\" \n"
"} ";
- scoped_ptr<base::Value> action_value = base::JSONReader::Read(kAction);
+ std::unique_ptr<base::Value> action_value = base::JSONReader::Read(kAction);
ASSERT_TRUE(action_value);
WebRequestActionSet::Values actions;
@@ -735,7 +734,7 @@
std::string error;
bool bad_message = false;
- scoped_ptr<WebRequestActionSet> action_set(
+ std::unique_ptr<WebRequestActionSet> action_set(
WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message));
ASSERT_TRUE(error.empty()) << error;
ASSERT_FALSE(bad_message);
@@ -782,7 +781,7 @@
" \"priority\": 200 \n"
"} ";
- scoped_ptr<base::Value> value = base::JSONReader::Read(kRule);
+ std::unique_ptr<base::Value> value = base::JSONReader::Read(kRule);
ASSERT_TRUE(value.get());
std::vector<linked_ptr<api::events::Rule>> rules;
@@ -801,16 +800,16 @@
// No match because match is in the query parameter.
GURL url1("http://bar.com/index.html?foo.com");
- scoped_ptr<net::URLRequest> request1(context.CreateRequest(
- url1, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request1(
+ context.CreateRequest(url1, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data1(request1.get(), ON_BEFORE_REQUEST);
deltas = registry->CreateDeltas(NULL, request_data1, false);
EXPECT_EQ(0u, deltas.size());
// This is a correct match.
GURL url2("http://foo.com/index.html");
- scoped_ptr<net::URLRequest> request2(context.CreateRequest(
- url2, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request2(
+ context.CreateRequest(url2, net::DEFAULT_PRIORITY, NULL));
WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST);
deltas = registry->CreateDeltas(NULL, request_data2, false);
EXPECT_EQ(1u, deltas.size());
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
index 8088353..3326d475 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
@@ -44,7 +44,7 @@
args_->Remove(0, NULL);
- scoped_ptr<api::desktop_capture::ChooseDesktopMedia::Params> params =
+ std::unique_ptr<api::desktop_capture::ChooseDesktopMedia::Params> params =
api::desktop_capture::ChooseDesktopMedia::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
index 39b63128..d2d78e2 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc
@@ -56,7 +56,7 @@
gfx::NativeWindow parent,
const base::string16& app_name,
const base::string16& target_name,
- scoped_ptr<DesktopMediaList> model,
+ std::unique_ptr<DesktopMediaList> model,
bool request_audio,
const DoneCallback& done_callback) override {
if (!expectation_->cancelled) {
@@ -98,26 +98,26 @@
}
// DesktopCaptureChooseDesktopMediaFunction::PickerFactory interface.
- scoped_ptr<DesktopMediaList> CreateModel(bool show_screens,
- bool show_windows,
- bool show_tabs,
- bool show_audio) override {
+ std::unique_ptr<DesktopMediaList> CreateModel(bool show_screens,
+ bool show_windows,
+ bool show_tabs,
+ bool show_audio) override {
EXPECT_LE(current_test_, tests_count_);
if (current_test_ >= tests_count_)
- return scoped_ptr<DesktopMediaList>();
+ return std::unique_ptr<DesktopMediaList>();
EXPECT_EQ(test_flags_[current_test_].expect_screens, show_screens);
EXPECT_EQ(test_flags_[current_test_].expect_windows, show_windows);
EXPECT_EQ(test_flags_[current_test_].expect_tabs, show_tabs);
EXPECT_EQ(test_flags_[current_test_].expect_audio, show_audio);
- return scoped_ptr<DesktopMediaList>(new FakeDesktopMediaList());
+ return std::unique_ptr<DesktopMediaList>(new FakeDesktopMediaList());
}
- scoped_ptr<DesktopMediaPicker> CreatePicker() override {
+ std::unique_ptr<DesktopMediaPicker> CreatePicker() override {
EXPECT_LE(current_test_, tests_count_);
if (current_test_ >= tests_count_)
- return scoped_ptr<DesktopMediaPicker>();
+ return std::unique_ptr<DesktopMediaPicker>();
++current_test_;
- return scoped_ptr<DesktopMediaPicker>(
+ return std::unique_ptr<DesktopMediaPicker>(
new FakeDesktopMediaPicker(test_flags_ + current_test_ - 1));
}
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
index 617e6f0d..1ff843a 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
@@ -8,6 +8,7 @@
#include <utility>
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_tab_util.h"
@@ -126,18 +127,18 @@
const gfx::NativeWindow parent_window =
web_contents->GetTopLevelNativeWindow();
- scoped_ptr<DesktopMediaList> media_list;
+ std::unique_ptr<DesktopMediaList> media_list;
if (g_picker_factory) {
media_list = g_picker_factory->CreateModel(show_screens, show_windows,
show_tabs, request_audio);
picker_ = g_picker_factory->CreatePicker();
} else {
- std::vector<scoped_ptr<DesktopMediaList>> media_lists;
+ std::vector<std::unique_ptr<DesktopMediaList>> media_lists;
// Create a screens/windows list and push it into media_lists.
if (show_screens || show_windows) {
#if defined(USE_ASH)
if (chrome::IsNativeWindowInAsh(parent_window)) {
- media_lists.push_back(make_scoped_ptr(new DesktopMediaListAsh(
+ media_lists.push_back(base::WrapUnique(new DesktopMediaListAsh(
(show_screens ? DesktopMediaListAsh::SCREENS : 0) |
(show_windows ? DesktopMediaListAsh::WINDOWS : 0))));
}
@@ -146,18 +147,18 @@
webrtc::DesktopCaptureOptions options =
webrtc::DesktopCaptureOptions::CreateDefault();
options.set_disable_effects(false);
- scoped_ptr<webrtc::ScreenCapturer> screen_capturer(
+ std::unique_ptr<webrtc::ScreenCapturer> screen_capturer(
show_screens ? webrtc::ScreenCapturer::Create(options) : NULL);
- scoped_ptr<webrtc::WindowCapturer> window_capturer(
+ std::unique_ptr<webrtc::WindowCapturer> window_capturer(
show_windows ? webrtc::WindowCapturer::Create(options) : NULL);
- media_lists.push_back(make_scoped_ptr(new NativeDesktopMediaList(
+ media_lists.push_back(base::WrapUnique(new NativeDesktopMediaList(
std::move(screen_capturer), std::move(window_capturer))));
}
}
if (show_tabs)
- media_lists.push_back(make_scoped_ptr(new TabDesktopMediaList()));
+ media_lists.push_back(base::WrapUnique(new TabDesktopMediaList()));
DCHECK(!media_lists.empty());
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h b/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h
index 3295faf..57286fa 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h
@@ -26,11 +26,12 @@
// Used for tests to supply fake picker.
class PickerFactory {
public:
- virtual scoped_ptr<DesktopMediaList> CreateModel(bool show_screens,
- bool show_windows,
- bool show_tabs,
- bool show_audio) = 0;
- virtual scoped_ptr<DesktopMediaPicker> CreatePicker() = 0;
+ virtual std::unique_ptr<DesktopMediaList> CreateModel(bool show_screens,
+ bool show_windows,
+ bool show_tabs,
+ bool show_audio) = 0;
+ virtual std::unique_ptr<DesktopMediaPicker> CreatePicker() = 0;
+
protected:
virtual ~PickerFactory() {}
};
@@ -69,7 +70,7 @@
// URL of page that desktop capture was requested for.
GURL origin_;
- scoped_ptr<DesktopMediaPicker> picker_;
+ std::unique_ptr<DesktopMediaPicker> picker_;
};
class DesktopCaptureCancelChooseDesktopMediaFunctionBase
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 52b4ff9..64b3fbe 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -137,10 +137,9 @@
// Runs the install verifier for all extensions that are enabled, disabled, or
// terminated.
void PerformVerificationCheck(content::BrowserContext* context) {
- scoped_ptr<ExtensionSet> extensions =
+ std::unique_ptr<ExtensionSet> extensions =
ExtensionRegistry::Get(context)->GenerateInstalledExtensionsSet(
- ExtensionRegistry::ENABLED |
- ExtensionRegistry::DISABLED |
+ ExtensionRegistry::ENABLED | ExtensionRegistry::DISABLED |
ExtensionRegistry::TERMINATED);
ExtensionPrefs* prefs = ExtensionPrefs::Get(context);
bool should_do_verification_check = false;
@@ -159,8 +158,8 @@
InstallVerifier::Get(context)->VerifyAllExtensions();
}
-scoped_ptr<developer::ProfileInfo> CreateProfileInfo(Profile* profile) {
- scoped_ptr<developer::ProfileInfo> info(new developer::ProfileInfo());
+std::unique_ptr<developer::ProfileInfo> CreateProfileInfo(Profile* profile) {
+ std::unique_ptr<developer::ProfileInfo> info(new developer::ProfileInfo());
info->is_supervised = profile->IsSupervised();
PrefService* prefs = profile->GetPrefs();
info->is_incognito_available =
@@ -348,9 +347,9 @@
}
void DeveloperPrivateEventRouter::OnExtensionManagementSettingsChanged() {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(CreateProfileInfo(profile_)->ToValue());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::DEVELOPER_PRIVATE_ON_PROFILE_STATE_CHANGED,
developer::OnProfileStateChanged::kEventName, std::move(args)));
event_router_->BroadcastEvent(std::move(event));
@@ -363,9 +362,9 @@
}
void DeveloperPrivateEventRouter::OnProfilePrefChanged() {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(CreateProfileInfo(profile_)->ToValue());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::DEVELOPER_PRIVATE_ON_PROFILE_STATE_CHANGED,
developer::OnProfileStateChanged::kEventName, std::move(args)));
event_router_->BroadcastEvent(std::move(event));
@@ -374,7 +373,7 @@
void DeveloperPrivateEventRouter::BroadcastItemStateChanged(
developer::EventType event_type,
const std::string& extension_id) {
- scoped_ptr<ExtensionInfoGenerator> info_generator(
+ std::unique_ptr<ExtensionInfoGenerator> info_generator(
new ExtensionInfoGenerator(profile_));
ExtensionInfoGenerator* info_generator_weak = info_generator.get();
info_generator_weak->CreateExtensionInfo(
@@ -387,7 +386,7 @@
void DeveloperPrivateEventRouter::BroadcastItemStateChangedHelper(
developer::EventType event_type,
const std::string& extension_id,
- scoped_ptr<ExtensionInfoGenerator> info_generator,
+ std::unique_ptr<ExtensionInfoGenerator> info_generator,
ExtensionInfoGenerator::ExtensionInfoList infos) {
DCHECK_LE(infos.size(), 1u);
@@ -399,9 +398,9 @@
new developer::ExtensionInfo(std::move(infos[0])));
}
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(event_data.ToValue());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::DEVELOPER_PRIVATE_ON_ITEM_STATE_CHANGED,
developer::OnItemStateChanged::kEventName, std::move(args)));
event_router_->BroadcastEvent(std::move(event));
@@ -480,7 +479,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateGetExtensionsInfoFunction::Run() {
- scoped_ptr<developer::GetExtensionsInfo::Params> params(
+ std::unique_ptr<developer::GetExtensionsInfo::Params> params(
developer::GetExtensionsInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -518,7 +517,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateGetExtensionInfoFunction::Run() {
- scoped_ptr<developer::GetExtensionInfo::Params> params(
+ std::unique_ptr<developer::GetExtensionInfo::Params> params(
developer::GetExtensionInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -542,7 +541,7 @@
DeveloperPrivateGetItemsInfoFunction::~DeveloperPrivateGetItemsInfoFunction() {}
ExtensionFunction::ResponseAction DeveloperPrivateGetItemsInfoFunction::Run() {
- scoped_ptr<developer::GetItemsInfo::Params> params(
+ std::unique_ptr<developer::GetItemsInfo::Params> params(
developer::GetItemsInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -571,7 +570,8 @@
ExtensionFunction::ResponseAction
DeveloperPrivateGetProfileConfigurationFunction::Run() {
- scoped_ptr<developer::ProfileInfo> info = CreateProfileInfo(GetProfile());
+ std::unique_ptr<developer::ProfileInfo> info =
+ CreateProfileInfo(GetProfile());
// If this is called from the chrome://extensions page, we use this as a
// heuristic that it's a good time to verify installs. We do this on startup,
@@ -589,7 +589,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateUpdateProfileConfigurationFunction::Run() {
- scoped_ptr<developer::UpdateProfileConfiguration::Params> params(
+ std::unique_ptr<developer::UpdateProfileConfiguration::Params> params(
developer::UpdateProfileConfiguration::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -610,7 +610,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateUpdateExtensionConfigurationFunction::Run() {
- scoped_ptr<developer::UpdateExtensionConfiguration::Params> params(
+ std::unique_ptr<developer::UpdateExtensionConfiguration::Params> params(
developer::UpdateExtensionConfiguration::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -656,7 +656,7 @@
DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {}
ExtensionFunction::ResponseAction DeveloperPrivateReloadFunction::Run() {
- scoped_ptr<Reload::Params> params(Reload::Params::Create(*args_));
+ std::unique_ptr<Reload::Params> params(Reload::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const Extension* extension = GetExtensionById(params->extension_id);
@@ -686,7 +686,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateShowPermissionsDialogFunction::Run() {
- scoped_ptr<developer::ShowPermissionsDialog::Params> params(
+ std::unique_ptr<developer::ShowPermissionsDialog::Params> params(
developer::ShowPermissionsDialog::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -716,7 +716,7 @@
}
ExtensionFunction::ResponseAction DeveloperPrivateLoadUnpackedFunction::Run() {
- scoped_ptr<developer::LoadUnpacked::Params> params(
+ std::unique_ptr<developer::LoadUnpacked::Params> params(
developer::LoadUnpacked::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -819,7 +819,7 @@
}
ExtensionFunction::ResponseAction DeveloperPrivatePackDirectoryFunction::Run() {
- scoped_ptr<PackDirectory::Params> params(
+ std::unique_ptr<PackDirectory::Params> params(
PackDirectory::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1099,7 +1099,7 @@
{}
ExtensionFunction::ResponseAction DeveloperPrivateChoosePathFunction::Run() {
- scoped_ptr<developer::ChoosePath::Params> params(
+ std::unique_ptr<developer::ChoosePath::Params> params(
developer::ChoosePath::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1218,7 +1218,7 @@
path.BaseName().AsUTF8Unsafe().c_str());
response.message = properties.message;
- scoped_ptr<FileHighlighter> highlighter;
+ std::unique_ptr<FileHighlighter> highlighter;
if (properties.path_suffix == kManifestFile) {
highlighter.reset(new ManifestHighlighter(
file_contents,
@@ -1243,7 +1243,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateOpenDevToolsFunction::Run() {
- scoped_ptr<developer::OpenDevTools::Params> params(
+ std::unique_ptr<developer::OpenDevTools::Params> params(
developer::OpenDevTools::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const developer::OpenDevToolsProperties& properties = params->properties;
@@ -1312,7 +1312,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateDeleteExtensionErrorsFunction::Run() {
- scoped_ptr<developer::DeleteExtensionErrors::Params> params(
+ std::unique_ptr<developer::DeleteExtensionErrors::Params> params(
developer::DeleteExtensionErrors::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const developer::DeleteExtensionErrorsProperties& properties =
@@ -1340,7 +1340,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateRepairExtensionFunction::Run() {
- scoped_ptr<developer::RepairExtension::Params> params(
+ std::unique_ptr<developer::RepairExtension::Params> params(
developer::RepairExtension::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const Extension* extension = GetExtensionById(params->extension_id);
@@ -1371,7 +1371,7 @@
DeveloperPrivateShowOptionsFunction::~DeveloperPrivateShowOptionsFunction() {}
ExtensionFunction::ResponseAction DeveloperPrivateShowOptionsFunction::Run() {
- scoped_ptr<developer::ShowOptions::Params> params(
+ std::unique_ptr<developer::ShowOptions::Params> params(
developer::ShowOptions::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const Extension* extension = GetEnabledExtensionById(params->extension_id);
@@ -1394,7 +1394,7 @@
DeveloperPrivateShowPathFunction::~DeveloperPrivateShowPathFunction() {}
ExtensionFunction::ResponseAction DeveloperPrivateShowPathFunction::Run() {
- scoped_ptr<developer::ShowPath::Params> params(
+ std::unique_ptr<developer::ShowPath::Params> params(
developer::ShowPath::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const Extension* extension = GetExtensionById(params->extension_id);
@@ -1413,7 +1413,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateSetShortcutHandlingSuspendedFunction::Run() {
- scoped_ptr<developer::SetShortcutHandlingSuspended::Params> params(
+ std::unique_ptr<developer::SetShortcutHandlingSuspended::Params> params(
developer::SetShortcutHandlingSuspended::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
ExtensionCommandsGlobalRegistry::Get(GetProfile())->
@@ -1426,7 +1426,7 @@
ExtensionFunction::ResponseAction
DeveloperPrivateUpdateExtensionCommandFunction::Run() {
- scoped_ptr<developer::UpdateExtensionCommand::Params> params(
+ std::unique_ptr<developer::UpdateExtensionCommand::Params> params(
developer::UpdateExtensionCommand::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const developer::ExtensionCommandUpdate& update = params->update;
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
index ffbf718..25d2a5d 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -131,7 +131,7 @@
void BroadcastItemStateChangedHelper(
api::developer_private::EventType event_type,
const std::string& extension_id,
- scoped_ptr<ExtensionInfoGenerator> info_generator,
+ std::unique_ptr<ExtensionInfoGenerator> info_generator,
std::vector<api::developer_private::ExtensionInfo> infos);
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
@@ -218,7 +218,7 @@
base::FilePath last_unpacked_directory_;
// Created lazily upon OnListenerAdded.
- scoped_ptr<DeveloperPrivateEventRouter> developer_private_event_router_;
+ std::unique_ptr<DeveloperPrivateEventRouter> developer_private_event_router_;
DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateAPI);
};
@@ -262,7 +262,7 @@
void OnInfosGenerated(
std::vector<api::developer_private::ExtensionInfo> infos);
- scoped_ptr<ExtensionInfoGenerator> info_generator_;
+ std::unique_ptr<ExtensionInfoGenerator> info_generator_;
DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateGetItemsInfoFunction);
};
@@ -281,7 +281,7 @@
void OnInfosGenerated(
std::vector<api::developer_private::ExtensionInfo> infos);
- scoped_ptr<ExtensionInfoGenerator> info_generator_;
+ std::unique_ptr<ExtensionInfoGenerator> info_generator_;
DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateGetExtensionsInfoFunction);
};
@@ -300,7 +300,7 @@
void OnInfosGenerated(
std::vector<api::developer_private::ExtensionInfo> infos);
- scoped_ptr<ExtensionInfoGenerator> info_generator_;
+ std::unique_ptr<ExtensionInfoGenerator> info_generator_;
DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateGetExtensionInfoFunction);
};
@@ -527,7 +527,7 @@
private:
void Finish(const std::string& file_contents);
- scoped_ptr<api::developer_private::RequestFileSource::Params> params_;
+ std::unique_ptr<api::developer_private::RequestFileSource::Params> params_;
};
class DeveloperPrivateOpenDevToolsFunction
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
index b11f6453..6636b605 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/developer_private/developer_private_api.h"
+
+#include <memory>
#include <utility>
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/extensions/api/developer_private/developer_private_api.h"
#include "chrome/browser/extensions/error_console/error_console.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -41,12 +43,13 @@
namespace {
-scoped_ptr<KeyedService> BuildAPI(content::BrowserContext* context) {
- return make_scoped_ptr(new DeveloperPrivateAPI(context));
+std::unique_ptr<KeyedService> BuildAPI(content::BrowserContext* context) {
+ return base::WrapUnique(new DeveloperPrivateAPI(context));
}
-scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* profile) {
- return make_scoped_ptr(
+std::unique_ptr<KeyedService> BuildEventRouter(
+ content::BrowserContext* profile) {
+ return base::WrapUnique(
new EventRouter(profile, ExtensionPrefs::Get(profile)));
}
@@ -89,8 +92,8 @@
void TearDown() override;
// The browser (and accompanying window).
- scoped_ptr<TestBrowserWindow> browser_window_;
- scoped_ptr<Browser> browser_;
+ std::unique_ptr<TestBrowserWindow> browser_window_;
+ std::unique_ptr<Browser> browser_;
ScopedVector<TestExtensionDir> test_extension_dirs_;
@@ -101,9 +104,7 @@
const scoped_refptr<UIThreadExtensionFunction>& function,
const base::ListValue& args) {
return extension_function_test_utils::RunFunction(
- function.get(),
- make_scoped_ptr(args.DeepCopy()),
- browser(),
+ function.get(), base::WrapUnique(args.DeepCopy()), browser(),
extension_function_test_utils::NONE);
}
@@ -202,7 +203,7 @@
// part of the general extension api system.
const base::Value* response_value = nullptr;
CHECK(function->GetResultList()->Get(0u, &response_value));
- scoped_ptr<api::developer_private::PackDirectoryResponse> response =
+ std::unique_ptr<api::developer_private::PackDirectoryResponse> response =
api::developer_private::PackDirectoryResponse::FromValue(*response_value);
CHECK(response);
@@ -404,7 +405,7 @@
function = new api::DeveloperPrivateLoadUnpackedFunction();
function->SetRenderFrameHost(web_contents->GetMainFrame());
base::ListValue unpacked_args;
- scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue());
options->SetBoolean("failQuietly", true);
unpacked_args.Append(options.release());
current_ids = registry()->enabled_extensions().GetIDs();
@@ -440,7 +441,7 @@
const base::Value* response_value = nullptr;
ASSERT_TRUE(function->GetResultList()->Get(0u, &response_value));
- scoped_ptr<api::developer_private::RequestFileSourceResponse> response =
+ std::unique_ptr<api::developer_private::RequestFileSourceResponse> response =
api::developer_private::RequestFileSourceResponse::FromValue(
*response_value);
EXPECT_FALSE(response->before_highlight.empty());
@@ -471,7 +472,7 @@
ASSERT_EQ(1u, list->GetSize());
const base::Value* value = nullptr;
ASSERT_TRUE(list->Get(0u, &value));
- scoped_ptr<api::developer_private::ExtensionInfo> info =
+ std::unique_ptr<api::developer_private::ExtensionInfo> info =
api::developer_private::ExtensionInfo::FromValue(*value);
ASSERT_TRUE(info);
@@ -487,7 +488,7 @@
ASSERT_TRUE(results->GetList(0u, &list));
ASSERT_EQ(1u, list->GetSize());
ASSERT_TRUE(list->Get(0u, &value));
- scoped_ptr<api::developer_private::ItemInfo> item_info =
+ std::unique_ptr<api::developer_private::ItemInfo> item_info =
api::developer_private::ItemInfo::FromValue(*value);
ASSERT_TRUE(item_info);
}
@@ -513,7 +514,7 @@
// Start by removing all errors for the extension of a given type (manifest).
std::string type_string = api::developer_private::ToString(
api::developer_private::ERROR_TYPE_MANIFEST);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
ListBuilder()
.Append(DictionaryBuilder()
.Set("extensionId", extension->id())
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc b/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc
index 40bb0eba..a8a5fa6 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc
@@ -45,12 +45,12 @@
// Get the info about the app, including the inspectable views.
scoped_refptr<UIThreadExtensionFunction> function(
new api::DeveloperPrivateGetExtensionInfoFunction());
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
extension_function_test_utils::RunFunctionAndReturnSingleResult(
function.get(), base::StringPrintf("[\"%s\"]", app->id().c_str()),
browser()));
ASSERT_TRUE(result);
- scoped_ptr<api::developer_private::ExtensionInfo> info =
+ std::unique_ptr<api::developer_private::ExtensionInfo> info =
api::developer_private::ExtensionInfo::FromValue(*result);
ASSERT_TRUE(info);
@@ -99,12 +99,12 @@
// Get the info about the extension, including the inspectable views.
scoped_refptr<UIThreadExtensionFunction> function(
new api::DeveloperPrivateGetExtensionInfoFunction());
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
extension_function_test_utils::RunFunctionAndReturnSingleResult(
function.get(),
base::StringPrintf("[\"%s\"]", extension->id().c_str()), browser()));
ASSERT_TRUE(result);
- scoped_ptr<api::developer_private::ExtensionInfo> info =
+ std::unique_ptr<api::developer_private::ExtensionInfo> info =
api::developer_private::ExtensionInfo::FromValue(*result);
ASSERT_TRUE(info);
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_mangle.cc b/chrome/browser/extensions/api/developer_private/developer_private_mangle.cc
index 75d64f0a..a24a327 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_mangle.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_mangle.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/developer_private/developer_private_mangle.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/values.h"
#include "chrome/common/extensions/api/developer_private.h"
#include "extensions/browser/extension_error.h"
@@ -80,14 +81,14 @@
}
for (const api::developer_private::ManifestError& error :
info.manifest_errors) {
- scoped_ptr<base::DictionaryValue> value = error.ToValue();
+ std::unique_ptr<base::DictionaryValue> value = error.ToValue();
value->SetInteger("type", static_cast<int>(ExtensionError::MANIFEST_ERROR));
value->SetInteger("level", static_cast<int>(logging::LOG_WARNING));
result.manifest_errors.push_back(std::move(value));
}
for (const api::developer_private::RuntimeError& error :
info.runtime_errors) {
- scoped_ptr<base::DictionaryValue> value = error.ToValue();
+ std::unique_ptr<base::DictionaryValue> value = error.ToValue();
value->SetInteger("type", static_cast<int>(ExtensionError::RUNTIME_ERROR));
logging::LogSeverity severity = logging::LOG_INFO;
if (error.severity == api::developer_private::ERROR_LEVEL_WARN)
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
index d871f09..bfa6946 100644
--- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
+++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
@@ -303,7 +303,8 @@
void ExtensionInfoGenerator::CreateExtensionInfoHelper(
const Extension& extension,
developer::ExtensionState state) {
- scoped_ptr<developer::ExtensionInfo> info(new developer::ExtensionInfo());
+ std::unique_ptr<developer::ExtensionInfo> info(
+ new developer::ExtensionInfo());
// Don't consider the button hidden with the redesign, because "hidden"
// buttons are now just hidden in the wrench menu.
@@ -361,9 +362,10 @@
// Dependent extensions.
if (extension.is_shared_module()) {
- scoped_ptr<ExtensionSet> dependent_extensions =
- extension_system_->extension_service()->
- shared_module_service()->GetDependentExtensions(&extension);
+ std::unique_ptr<ExtensionSet> dependent_extensions =
+ extension_system_->extension_service()
+ ->shared_module_service()
+ ->GetDependentExtensions(&extension);
for (const scoped_refptr<const Extension>& dependent :
*dependent_extensions)
info->dependent_extensions.push_back(dependent->id());
@@ -597,7 +599,7 @@
}
void ExtensionInfoGenerator::OnImageLoaded(
- scoped_ptr<developer::ExtensionInfo> info,
+ std::unique_ptr<developer::ExtensionInfo> info,
const gfx::Image& icon) {
if (!icon.IsEmpty()) {
info->icon_url = GetIconUrlFromImage(
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.h b/chrome/browser/extensions/api/developer_private/extension_info_generator.h
index 5a47e84..54f770b 100644
--- a/chrome/browser/extensions/api/developer_private/extension_info_generator.h
+++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.h
@@ -61,8 +61,9 @@
api::developer_private::ExtensionState state);
// Callback for the asynchronous image loading.
- void OnImageLoaded(scoped_ptr<api::developer_private::ExtensionInfo> info,
- const gfx::Image& image);
+ void OnImageLoaded(
+ std::unique_ptr<api::developer_private::ExtensionInfo> info,
+ const gfx::Image& image);
// Returns the icon url for the default icon to use.
const std::string& GetDefaultIconUrl(bool is_app, bool is_disabled);
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
index 90b6c11..1578a91fd 100644
--- a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
+++ b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
@@ -2,16 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/developer_private/extension_info_generator.h"
+
#include <utility>
#include "base/callback_helpers.h"
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_writer.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
-#include "chrome/browser/extensions/api/developer_private/extension_info_generator.h"
#include "chrome/browser/extensions/api/developer_private/inspectable_views_finder.h"
#include "chrome/browser/extensions/error_console/error_console.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -38,9 +40,9 @@
const char kAllHostsPermission[] = "*://*/*";
-scoped_ptr<base::DictionaryValue> DeserializeJSONTestData(
+std::unique_ptr<base::DictionaryValue> DeserializeJSONTestData(
const base::FilePath& path,
- std::string *error) {
+ std::string* error) {
JSONFileValueDeserializer deserializer(path);
return base::DictionaryValue::From(deserializer.Deserialize(nullptr, error));
}
@@ -58,7 +60,7 @@
InitializeEmptyExtensionService();
}
- void OnInfosGenerated(scoped_ptr<developer::ExtensionInfo>* info_out,
+ void OnInfosGenerated(std::unique_ptr<developer::ExtensionInfo>* info_out,
ExtensionInfoGenerator::ExtensionInfoList list) {
EXPECT_EQ(1u, list.size());
if (!list.empty())
@@ -66,12 +68,12 @@
base::ResetAndReturn(&quit_closure_).Run();
}
- scoped_ptr<developer::ExtensionInfo> GenerateExtensionInfo(
+ std::unique_ptr<developer::ExtensionInfo> GenerateExtensionInfo(
const std::string& extension_id) {
- scoped_ptr<developer::ExtensionInfo> info;
+ std::unique_ptr<developer::ExtensionInfo> info;
base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
- scoped_ptr<ExtensionInfoGenerator> generator(
+ std::unique_ptr<ExtensionInfoGenerator> generator(
new ExtensionInfoGenerator(browser_context()));
generator->CreateExtensionInfo(
extension_id,
@@ -84,7 +86,7 @@
const scoped_refptr<const Extension> CreateExtension(
const std::string& name,
- scoped_ptr<base::ListValue> permissions) {
+ std::unique_ptr<base::ListValue> permissions) {
const std::string kId = crx_file::id_util::GenerateId(name);
scoped_refptr<const Extension> extension =
ExtensionBuilder()
@@ -104,13 +106,13 @@
return extension;
}
- scoped_ptr<developer::ExtensionInfo> CreateExtensionInfoFromPath(
+ std::unique_ptr<developer::ExtensionInfo> CreateExtensionInfoFromPath(
const base::FilePath& extension_path,
Manifest::Location location) {
std::string error;
base::FilePath manifest_path = extension_path.Append(kManifestFilename);
- scoped_ptr<base::DictionaryValue> extension_data =
+ std::unique_ptr<base::DictionaryValue> extension_data =
DeserializeJSONTestData(manifest_path, &error);
EXPECT_EQ(std::string(), error);
@@ -129,15 +131,15 @@
InspectableViewsFinder::ViewList views,
const base::FilePath& expected_output_path) {
std::string error;
- scoped_ptr<base::DictionaryValue> expected_output_data(
+ std::unique_ptr<base::DictionaryValue> expected_output_data(
DeserializeJSONTestData(expected_output_path, &error));
EXPECT_EQ(std::string(), error);
// Produce test output.
- scoped_ptr<developer::ExtensionInfo> info =
+ std::unique_ptr<developer::ExtensionInfo> info =
CreateExtensionInfoFromPath(extension_path, Manifest::INVALID_LOCATION);
info->views = std::move(views);
- scoped_ptr<base::DictionaryValue> actual_output_data = info->ToValue();
+ std::unique_ptr<base::DictionaryValue> actual_output_data = info->ToValue();
ASSERT_TRUE(actual_output_data);
// Compare the outputs.
@@ -181,7 +183,7 @@
const char kName[] = "extension name";
const char kVersion[] = "1.0.0.1";
std::string id = crx_file::id_util::GenerateId("alpha");
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
DictionaryBuilder()
.Set("name", kName)
.Set("version", kVersion)
@@ -189,7 +191,7 @@
.Set("description", "an extension")
.Set("permissions", ListBuilder().Append("file://*/*").Build())
.Build();
- scoped_ptr<base::DictionaryValue> manifest_copy(manifest->DeepCopy());
+ std::unique_ptr<base::DictionaryValue> manifest_copy(manifest->DeepCopy());
scoped_refptr<const Extension> extension =
ExtensionBuilder()
.SetManifest(std::move(manifest))
@@ -199,44 +201,26 @@
.Build();
service()->AddExtension(extension.get());
ErrorConsole* error_console = ErrorConsole::Get(profile());
- error_console->ReportError(
- make_scoped_ptr(new RuntimeError(
- extension->id(),
- false,
- base::UTF8ToUTF16("source"),
- base::UTF8ToUTF16("message"),
- StackTrace(1, StackFrame(1,
- 1,
- base::UTF8ToUTF16("source"),
- base::UTF8ToUTF16("function"))),
- GURL("url"),
- logging::LOG_ERROR,
- 1,
- 1)));
- error_console->ReportError(
- make_scoped_ptr(new ManifestError(extension->id(),
- base::UTF8ToUTF16("message"),
- base::UTF8ToUTF16("key"),
- base::string16())));
- error_console->ReportError(
- make_scoped_ptr(new RuntimeError(
- extension->id(),
- false,
- base::UTF8ToUTF16("source"),
- base::UTF8ToUTF16("message"),
- StackTrace(1, StackFrame(1,
- 1,
- base::UTF8ToUTF16("source"),
- base::UTF8ToUTF16("function"))),
- GURL("url"),
- logging::LOG_VERBOSE,
- 1,
- 1)));
+ error_console->ReportError(base::WrapUnique(new RuntimeError(
+ extension->id(), false, base::UTF8ToUTF16("source"),
+ base::UTF8ToUTF16("message"),
+ StackTrace(1, StackFrame(1, 1, base::UTF8ToUTF16("source"),
+ base::UTF8ToUTF16("function"))),
+ GURL("url"), logging::LOG_ERROR, 1, 1)));
+ error_console->ReportError(base::WrapUnique(
+ new ManifestError(extension->id(), base::UTF8ToUTF16("message"),
+ base::UTF8ToUTF16("key"), base::string16())));
+ error_console->ReportError(base::WrapUnique(new RuntimeError(
+ extension->id(), false, base::UTF8ToUTF16("source"),
+ base::UTF8ToUTF16("message"),
+ StackTrace(1, StackFrame(1, 1, base::UTF8ToUTF16("source"),
+ base::UTF8ToUTF16("function"))),
+ GURL("url"), logging::LOG_VERBOSE, 1, 1)));
// It's not feasible to validate every field here, because that would be
// a duplication of the logic in the method itself. Instead, test a handful
// of fields for sanity.
- scoped_ptr<api::developer_private::ExtensionInfo> info =
+ std::unique_ptr<api::developer_private::ExtensionInfo> info =
GenerateExtensionInfo(extension->id());
ASSERT_TRUE(info.get());
EXPECT_EQ(kName, info->name);
@@ -351,16 +335,16 @@
// urls, and only when the switch is on.
TEST_F(ExtensionInfoGeneratorUnitTest, ExtensionInfoRunOnAllUrls) {
// Start with the switch enabled.
- scoped_ptr<FeatureSwitch::ScopedOverride> enable_scripts_switch(
- new FeatureSwitch::ScopedOverride(
- FeatureSwitch::scripts_require_action(), true));
+ std::unique_ptr<FeatureSwitch::ScopedOverride> enable_scripts_switch(
+ new FeatureSwitch::ScopedOverride(FeatureSwitch::scripts_require_action(),
+ true));
// Two extensions - one with all urls, one without.
scoped_refptr<const Extension> all_urls_extension = CreateExtension(
"all_urls", ListBuilder().Append(kAllHostsPermission).Build());
scoped_refptr<const Extension> no_urls_extension =
CreateExtension("no urls", ListBuilder().Build());
- scoped_ptr<developer::ExtensionInfo> info =
+ std::unique_ptr<developer::ExtensionInfo> info =
GenerateExtensionInfo(all_urls_extension->id());
// The extension should want all urls, but not currently have it.
diff --git a/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc b/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
index 8019d38c..5fd7528 100644
--- a/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
+++ b/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
@@ -78,7 +78,7 @@
DevicePermissionsManager::Get(profile_)
->GetPermissionMessageStrings(extension_id_);
}
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT));
prompt->set_retained_files(retained_file_paths);
diff --git a/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.h b/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.h
index aafd468..140348f 100644
--- a/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.h
+++ b/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.h
@@ -5,9 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_HELPER_H_
#define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_SHOW_PERMISSIONS_DIALOG_HELPER_H_
+#include <memory>
+
#include "base/bind.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
class Profile;
@@ -42,7 +43,7 @@
void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
- scoped_ptr<ExtensionInstallPrompt> prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> prompt_;
Profile* profile_;
diff --git a/chrome/browser/extensions/api/device_permissions_manager_unittest.cc b/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
index 92e10f68..eacf06e 100644
--- a/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
+++ b/chrome/browser/extensions/api/device_permissions_manager_unittest.cc
@@ -82,7 +82,7 @@
void TearDown() override { env_.reset(nullptr); }
- scoped_ptr<extensions::TestExtensionEnvironment> env_;
+ std::unique_ptr<extensions::TestExtensionEnvironment> env_;
const extensions::Extension* extension_;
device::MockDeviceClient device_client_;
scoped_refptr<MockUsbDevice> device0_;
@@ -282,7 +282,7 @@
}
TEST_F(DevicePermissionsManagerTest, LoadPrefs) {
- scoped_ptr<base::Value> prefs_value = base::test::ParseJson(
+ std::unique_ptr<base::Value> prefs_value = base::test::ParseJson(
"["
" {"
" \"manufacturer_string\": \"Test Manufacturer\","
diff --git a/chrome/browser/extensions/api/dial/dial_api.cc b/chrome/browser/extensions/api/dial/dial_api.cc
index 7e48a955..ed8ad5d 100644
--- a/chrome/browser/extensions/api/dial/dial_api.cc
+++ b/chrome/browser/extensions/api/dial/dial_api.cc
@@ -104,10 +104,11 @@
device.FillDialDevice(&api_device);
args.push_back(std::move(api_device));
}
- scoped_ptr<base::ListValue> results = api::dial::OnDeviceList::Create(args);
- scoped_ptr<Event> event(new Event(events::DIAL_ON_DEVICE_LIST,
- dial::OnDeviceList::kEventName,
- std::move(results)));
+ std::unique_ptr<base::ListValue> results =
+ api::dial::OnDeviceList::Create(args);
+ std::unique_ptr<Event> event(new Event(events::DIAL_ON_DEVICE_LIST,
+ dial::OnDeviceList::kEventName,
+ std::move(results)));
EventRouter::Get(profile_)->BroadcastEvent(std::move(event));
}
@@ -136,8 +137,9 @@
break;
}
- scoped_ptr<base::ListValue> results = api::dial::OnError::Create(dial_error);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<base::ListValue> results =
+ api::dial::OnError::Create(dial_error);
+ std::unique_ptr<Event> event(new Event(
events::DIAL_ON_ERROR, dial::OnError::kEventName, std::move(results)));
EventRouter::Get(profile_)->BroadcastEvent(std::move(event));
}
diff --git a/chrome/browser/extensions/api/dial/dial_api.h b/chrome/browser/extensions/api/dial/dial_api.h
index 66351f6..c9ba27a 100644
--- a/chrome/browser/extensions/api/dial/dial_api.h
+++ b/chrome/browser/extensions/api/dial/dial_api.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/dial/dial_device_data.h"
#include "chrome/browser/extensions/api/dial/dial_registry.h"
#include "components/keyed_service/core/refcounted_keyed_service.h"
@@ -62,7 +63,7 @@
Profile* profile_;
// Created lazily on first access on the IO thread.
- scoped_ptr<DialRegistry> dial_registry_;
+ std::unique_ptr<DialRegistry> dial_registry_;
DISALLOW_COPY_AND_ASSIGN(DialAPI);
};
diff --git a/chrome/browser/extensions/api/dial/dial_registry.cc b/chrome/browser/extensions/api/dial/dial_registry.cc
index ab0b2a1..1c502d7c 100644
--- a/chrome/browser/extensions/api/dial/dial_registry.cc
+++ b/chrome/browser/extensions/api/dial/dial_registry.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/dial/dial_registry.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
diff --git a/chrome/browser/extensions/api/dial/dial_registry.h b/chrome/browser/extensions/api/dial/dial_registry.h
index c9ddf0b..2ddca1ad 100644
--- a/chrome/browser/extensions/api/dial/dial_registry.h
+++ b/chrome/browser/extensions/api/dial/dial_registry.h
@@ -82,7 +82,7 @@
protected:
// The DIAL service. Periodic discovery is active when this is not NULL.
- scoped_ptr<DialService> dial_;
+ std::unique_ptr<DialService> dial_;
private:
typedef base::hash_map<std::string, linked_ptr<DialDeviceData> >
diff --git a/chrome/browser/extensions/api/dial/dial_registry_unittest.cc b/chrome/browser/extensions/api/dial/dial_registry_unittest.cc
index dfd345c..a9c1753 100644
--- a/chrome/browser/extensions/api/dial/dial_registry_unittest.cc
+++ b/chrome/browser/extensions/api/dial/dial_registry_unittest.cc
@@ -94,7 +94,7 @@
}
protected:
- scoped_ptr<MockDialRegistry> registry_;
+ std::unique_ptr<MockDialRegistry> registry_;
MockDialObserver mock_observer_;
const DialDeviceData first_device_;
const DialDeviceData second_device_;
diff --git a/chrome/browser/extensions/api/dial/dial_service.cc b/chrome/browser/extensions/api/dial/dial_service.cc
index e6f0a3b..114ebe2 100644
--- a/chrome/browser/extensions/api/dial/dial_service.cc
+++ b/chrome/browser/extensions/api/dial/dial_service.cc
@@ -525,14 +525,15 @@
}
void DialServiceImpl::BindAndAddSocket(const IPAddress& bind_ip_address) {
- scoped_ptr<DialServiceImpl::DialSocket> dial_socket(CreateDialSocket());
+ std::unique_ptr<DialServiceImpl::DialSocket> dial_socket(CreateDialSocket());
if (dial_socket->CreateAndBindSocket(bind_ip_address, net_log_,
net_log_source_))
dial_sockets_.push_back(std::move(dial_socket));
}
-scoped_ptr<DialServiceImpl::DialSocket> DialServiceImpl::CreateDialSocket() {
- scoped_ptr<DialServiceImpl::DialSocket> dial_socket(
+std::unique_ptr<DialServiceImpl::DialSocket>
+DialServiceImpl::CreateDialSocket() {
+ std::unique_ptr<DialServiceImpl::DialSocket> dial_socket(
new DialServiceImpl::DialSocket(
base::Bind(&DialServiceImpl::NotifyOnDiscoveryRequest, AsWeakPtr()),
base::Bind(&DialServiceImpl::NotifyOnDeviceDiscovered, AsWeakPtr()),
diff --git a/chrome/browser/extensions/api/dial/dial_service.h b/chrome/browser/extensions/api/dial/dial_service.h
index 4ffaa17..a987890 100644
--- a/chrome/browser/extensions/api/dial/dial_service.h
+++ b/chrome/browser/extensions/api/dial/dial_service.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_
#define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_SERVICE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
@@ -167,7 +167,7 @@
DialDeviceData* device);
// The UDP socket.
- scoped_ptr<net::UDPSocket> socket_;
+ std::unique_ptr<net::UDPSocket> socket_;
// Buffer for socket reads.
scoped_refptr<net::IOBufferWithSize> recv_buffer_;
@@ -218,7 +218,7 @@
void BindAndAddSocket(const net::IPAddress& bind_ip_address);
// Creates a DialSocket with callbacks to this object.
- scoped_ptr<DialSocket> CreateDialSocket();
+ std::unique_ptr<DialSocket> CreateDialSocket();
// Sends a single discovery request to every socket that are currently open.
void SendOneRequest();
@@ -241,7 +241,7 @@
// DialSockets for each network interface whose ip address was
// successfully bound.
- std::vector<scoped_ptr<DialSocket>> dial_sockets_;
+ std::vector<std::unique_ptr<DialSocket>> dial_sockets_;
// The NetLog for this service.
net::NetLog* net_log_;
diff --git a/chrome/browser/extensions/api/dial/dial_service_unittest.cc b/chrome/browser/extensions/api/dial/dial_service_unittest.cc
index fd35897..75a48fd 100644
--- a/chrome/browser/extensions/api/dial/dial_service_unittest.cc
+++ b/chrome/browser/extensions/api/dial/dial_service_unittest.cc
@@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/dial/dial_service.h"
+
#include <stddef.h>
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "chrome/browser/extensions/api/dial/dial_device_data.h"
-#include "chrome/browser/extensions/api/dial/dial_service.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/network_interfaces.h"
@@ -57,7 +59,7 @@
net::TestNetLog test_net_log_;
net::IPAddress mock_ip_;
DialServiceImpl dial_service_;
- scoped_ptr<DialServiceImpl::DialSocket> dial_socket_;
+ std::unique_ptr<DialServiceImpl::DialSocket> dial_socket_;
MockObserver mock_observer_;
};
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index a765a0e4a..7c87a6f 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -245,7 +245,7 @@
exploded.millisecond);
}
-scoped_ptr<base::DictionaryValue> DownloadItemToJSON(
+std::unique_ptr<base::DictionaryValue> DownloadItemToJSON(
DownloadItem* download_item,
Profile* profile) {
base::DictionaryValue* json = new base::DictionaryValue();
@@ -298,7 +298,7 @@
}
// TODO(benjhayden): Implement fileSize.
json->SetDouble(kFileSizeKey, download_item->GetTotalBytes());
- return scoped_ptr<base::DictionaryValue>(json);
+ return std::unique_ptr<base::DictionaryValue>(json);
}
class DownloadFileIconExtractorImpl : public DownloadFileIconExtractor {
@@ -540,7 +540,7 @@
return;
}
- scoped_ptr<base::DictionaryValue> query_in_value(query_in.ToValue());
+ std::unique_ptr<base::DictionaryValue> query_in_value(query_in.ToValue());
for (base::DictionaryValue::Iterator query_json_field(*query_in_value.get());
!query_json_field.IsAtEnd(); query_json_field.Advance()) {
FilterTypeMap::const_iterator filter_type =
@@ -598,7 +598,7 @@
explicit ExtensionDownloadsEventRouterData(
DownloadItem* download_item,
- scoped_ptr<base::DictionaryValue> json_item)
+ std::unique_ptr<base::DictionaryValue> json_item)
: updated_(0),
changed_fired_(0),
json_(std::move(json_item)),
@@ -617,7 +617,7 @@
}
const base::DictionaryValue& json() const { return *json_.get(); }
- void set_json(scoped_ptr<base::DictionaryValue> json_item) {
+ void set_json(std::unique_ptr<base::DictionaryValue> json_item) {
json_ = std::move(json_item);
}
@@ -836,7 +836,7 @@
int updated_;
int changed_fired_;
- scoped_ptr<base::DictionaryValue> json_;
+ std::unique_ptr<base::DictionaryValue> json_;
base::Closure filename_no_change_;
ExtensionDownloadsEventRouter::FilenameChangedCallback filename_change_;
@@ -851,8 +851,8 @@
determined_conflict_action_;
DeterminerInfo determiner_;
- scoped_ptr<base::WeakPtrFactory<ExtensionDownloadsEventRouterData> >
- weak_ptr_factory_;
+ std::unique_ptr<base::WeakPtrFactory<ExtensionDownloadsEventRouterData>>
+ weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouterData);
};
@@ -945,7 +945,7 @@
DownloadsDownloadFunction::~DownloadsDownloadFunction() {}
bool DownloadsDownloadFunction::RunAsync() {
- scoped_ptr<downloads::Download::Params> params(
+ std::unique_ptr<downloads::Download::Params> params(
downloads::Download::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const downloads::DownloadOptions& options = params->options;
@@ -957,7 +957,7 @@
if (include_incognito() && GetProfile()->HasOffTheRecordProfile())
current_profile = GetProfile()->GetOffTheRecordProfile();
- scoped_ptr<content::DownloadUrlParameters> download_params(
+ std::unique_ptr<content::DownloadUrlParameters> download_params(
new content::DownloadUrlParameters(
download_url, render_frame_host()->GetProcess()->GetID(),
render_view_host_do_not_use()->GetRoutingID(),
@@ -1042,8 +1042,8 @@
ExtensionDownloadsEventRouterData::Get(item);
if (!data) {
data = new ExtensionDownloadsEventRouterData(
- item,
- scoped_ptr<base::DictionaryValue>(new base::DictionaryValue()));
+ item, std::unique_ptr<base::DictionaryValue>(
+ new base::DictionaryValue()));
}
data->CreatorSuggestedFilename(
creator_suggested_filename, creator_conflict_action);
@@ -1062,7 +1062,7 @@
DownloadsSearchFunction::~DownloadsSearchFunction() {}
bool DownloadsSearchFunction::RunSync() {
- scoped_ptr<downloads::Search::Params> params(
+ std::unique_ptr<downloads::Search::Params> params(
downloads::Search::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadManager* manager = NULL;
@@ -1094,10 +1094,9 @@
uint32_t download_id = download_item->GetId();
bool off_record = ((incognito_manager != NULL) &&
(incognito_manager->GetDownload(download_id) != NULL));
- scoped_ptr<base::DictionaryValue> json_item(
- DownloadItemToJSON(*it,
- off_record ? GetProfile()->GetOffTheRecordProfile()
- : GetProfile()->GetOriginalProfile()));
+ std::unique_ptr<base::DictionaryValue> json_item(DownloadItemToJSON(
+ *it, off_record ? GetProfile()->GetOffTheRecordProfile()
+ : GetProfile()->GetOriginalProfile()));
json_results->Append(json_item.release());
}
SetResult(json_results);
@@ -1110,7 +1109,7 @@
DownloadsPauseFunction::~DownloadsPauseFunction() {}
bool DownloadsPauseFunction::RunSync() {
- scoped_ptr<downloads::Pause::Params> params(
+ std::unique_ptr<downloads::Pause::Params> params(
downloads::Pause::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1131,7 +1130,7 @@
DownloadsResumeFunction::~DownloadsResumeFunction() {}
bool DownloadsResumeFunction::RunSync() {
- scoped_ptr<downloads::Resume::Params> params(
+ std::unique_ptr<downloads::Resume::Params> params(
downloads::Resume::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1152,7 +1151,7 @@
DownloadsCancelFunction::~DownloadsCancelFunction() {}
bool DownloadsCancelFunction::RunSync() {
- scoped_ptr<downloads::Resume::Params> params(
+ std::unique_ptr<downloads::Resume::Params> params(
downloads::Resume::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1171,7 +1170,7 @@
DownloadsEraseFunction::~DownloadsEraseFunction() {}
bool DownloadsEraseFunction::RunSync() {
- scoped_ptr<downloads::Erase::Params> params(
+ std::unique_ptr<downloads::Erase::Params> params(
downloads::Erase::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadManager* manager = NULL;
@@ -1204,7 +1203,7 @@
}
bool DownloadsRemoveFileFunction::RunAsync() {
- scoped_ptr<downloads::RemoveFile::Params> params(
+ std::unique_ptr<downloads::RemoveFile::Params> params(
downloads::RemoveFile::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1237,7 +1236,7 @@
DownloadsAcceptDangerFunction::on_prompt_created_ = NULL;
bool DownloadsAcceptDangerFunction::RunAsync() {
- scoped_ptr<downloads::AcceptDanger::Params> params(
+ std::unique_ptr<downloads::AcceptDanger::Params> params(
downloads::AcceptDanger::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
PromptOrWait(params->download_id, 10);
@@ -1311,7 +1310,7 @@
DownloadsShowFunction::~DownloadsShowFunction() {}
bool DownloadsShowFunction::RunAsync() {
- scoped_ptr<downloads::Show::Params> params(
+ std::unique_ptr<downloads::Show::Params> params(
downloads::Show::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1343,7 +1342,7 @@
DownloadsOpenFunction::~DownloadsOpenFunction() {}
bool DownloadsOpenFunction::RunSync() {
- scoped_ptr<downloads::Open::Params> params(
+ std::unique_ptr<downloads::Open::Params> params(
downloads::Open::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1368,7 +1367,7 @@
DownloadsDragFunction::~DownloadsDragFunction() {}
bool DownloadsDragFunction::RunAsync() {
- scoped_ptr<downloads::Drag::Params> params(
+ std::unique_ptr<downloads::Drag::Params> params(
downloads::Drag::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadItem* download_item =
@@ -1396,7 +1395,7 @@
DownloadsSetShelfEnabledFunction::~DownloadsSetShelfEnabledFunction() {}
bool DownloadsSetShelfEnabledFunction::RunSync() {
- scoped_ptr<downloads::SetShelfEnabled::Params> params(
+ std::unique_ptr<downloads::SetShelfEnabled::Params> params(
downloads::SetShelfEnabled::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (!extension()->permissions_data()->HasAPIPermission(
@@ -1462,7 +1461,7 @@
}
bool DownloadsGetFileIconFunction::RunAsync() {
- scoped_ptr<downloads::GetFileIcon::Params> params(
+ std::unique_ptr<downloads::GetFileIcon::Params> params(
downloads::GetFileIcon::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const downloads::GetFileIconOptions* options =
@@ -1754,7 +1753,7 @@
downloads::OnDeterminingFilename::kEventName))) {
return;
}
- scoped_ptr<base::DictionaryValue> json_item(
+ std::unique_ptr<base::DictionaryValue> json_item(
DownloadItemToJSON(download_item, profile_));
DispatchEvent(events::DOWNLOADS_ON_CREATED, downloads::OnCreated::kEventName,
true, Event::WillDispatchCallback(), json_item->DeepCopy());
@@ -1781,11 +1780,11 @@
// or else an event listener was added.
data = new ExtensionDownloadsEventRouterData(
download_item,
- scoped_ptr<base::DictionaryValue>(new base::DictionaryValue()));
+ std::unique_ptr<base::DictionaryValue>(new base::DictionaryValue()));
}
- scoped_ptr<base::DictionaryValue> new_json(DownloadItemToJSON(
- download_item, profile_));
- scoped_ptr<base::DictionaryValue> delta(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> new_json(
+ DownloadItemToJSON(download_item, profile_));
+ std::unique_ptr<base::DictionaryValue> delta(new base::DictionaryValue());
delta->SetInteger(kIdKey, download_item->GetId());
std::set<std::string> new_fields;
bool changed = false;
@@ -1854,11 +1853,11 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!EventRouter::Get(profile_))
return;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(arg);
std::string json_args;
base::JSONWriter::Write(*args, &json_args);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
// The downloads system wants to share on-record events with off-record
// extension renderers even in incognito_split_mode because that's how
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
index ae69cffa..e634017 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -295,7 +295,7 @@
private:
void OnIconURLExtracted(const std::string& url);
base::FilePath path_;
- scoped_ptr<DownloadFileIconExtractor> icon_extractor_;
+ std::unique_ptr<DownloadFileIconExtractor> icon_extractor_;
DISALLOW_COPY_AND_ASSIGN(DownloadsGetFileIconFunction);
};
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index 5b5dbcd..d49d933 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -168,7 +168,7 @@
Profile* profile_;
std::string event_name_;
std::string json_args_;
- scoped_ptr<base::Value> args_;
+ std::unique_ptr<base::Value> args_;
base::Time caught_;
DISALLOW_COPY_AND_ASSIGN(Event);
@@ -237,7 +237,7 @@
private:
bool waiting_;
base::Time last_wait_;
- scoped_ptr<Event> waiting_for_;
+ std::unique_ptr<Event> waiting_for_;
content::NotificationRegistrar registrar_;
std::deque<Event*> events_;
@@ -316,7 +316,7 @@
// InProcessBrowserTest
void SetUpOnMainThread() override {
base::FeatureList::ClearInstanceForTesting();
- scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
feature_list->InitializeFromCommandLine(
features::kDownloadResumption.name, std::string());
base::FeatureList::SetInstance(std::move(feature_list));
@@ -459,7 +459,7 @@
void CreateSlowTestDownloads(
size_t count, DownloadManager::DownloadVector* items) {
for (size_t i = 0; i < count; ++i) {
- scoped_ptr<content::DownloadTestObserver> observer(
+ std::unique_ptr<content::DownloadTestObserver> observer(
CreateInProgressDownloadObserver(1));
GURL slow_download_url(net::URLRequestSlowDownloadJob::kUnknownSizeUrl);
ui_test_utils::NavigateToURL(current_browser(), slow_download_url);
@@ -472,7 +472,7 @@
}
DownloadItem* CreateSlowTestDownload() {
- scoped_ptr<content::DownloadTestObserver> observer(
+ std::unique_ptr<content::DownloadTestObserver> observer(
CreateInProgressDownloadObserver(1));
GURL slow_download_url(net::URLRequestSlowDownloadJob::kUnknownSizeUrl);
DownloadManager* manager = GetCurrentManager();
@@ -503,7 +503,7 @@
}
void FinishPendingSlowDownloads() {
- scoped_ptr<content::DownloadTestObserver> observer(
+ std::unique_ptr<content::DownloadTestObserver> observer(
CreateDownloadObserver(1));
GURL finish_url(net::URLRequestSlowDownloadJob::kFinishDownloadUrl);
ui_test_utils::NavigateToURLWithDisposition(
@@ -568,7 +568,8 @@
const std::string& args,
std::string* result_string) {
SetUpExtensionFunction(function.get());
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(function, args));
+ std::unique_ptr<base::Value> result(
+ RunFunctionAndReturnResult(function, args));
EXPECT_TRUE(result.get());
return result.get() && result->GetAsString(result_string);
}
@@ -607,7 +608,7 @@
const Extension* extension_;
Browser* incognito_browser_;
Browser* current_browser_;
- scoped_ptr<DownloadsEventsListener> events_listener_;
+ std::unique_ptr<DownloadsEventsListener> events_listener_;
DISALLOW_COPY_AND_ASSIGN(DownloadExtensionTest);
};
@@ -934,9 +935,8 @@
EXPECT_STREQ(errors::kInvalidId, error.c_str());
int id = download_item->GetId();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsEraseFunction(),
- base::StringPrintf("[{\"id\": %d}]", id)));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsEraseFunction(), base::StringPrintf("[{\"id\": %d}]", id)));
DownloadManager::DownloadVector items;
GetCurrentManager()->GetAllDownloads(&items);
EXPECT_EQ(0UL, items.size());
@@ -1085,8 +1085,8 @@
ScopedCancellingItem item(CreateSlowTestDownload());
ASSERT_TRUE(item.get());
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsSearchFunction(), "[{}]"));
+ std::unique_ptr<base::Value> result(
+ RunFunctionAndReturnResult(new DownloadsSearchFunction(), "[{}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
ASSERT_TRUE(result->GetAsList(&result_list));
@@ -1108,7 +1108,7 @@
ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo),
&all_downloads));
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsSearchFunction(), "[{\"filenameRegex\": \"foobar\"}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1135,9 +1135,9 @@
CreateSlowTestDownloads(2, &items);
ScopedItemVectorCanceller delete_items(&items);
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsSearchFunction(), base::StringPrintf(
- "[{\"id\": %u}]", items[0]->GetId())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsSearchFunction(),
+ base::StringPrintf("[{\"id\": %u}]", items[0]->GetId())));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
ASSERT_TRUE(result->GetAsList(&result_list));
@@ -1163,9 +1163,9 @@
CreateSlowTestDownloads(2, &items);
ScopedItemVectorCanceller delete_items(&items);
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsSearchFunction(),
- "[{\"id\": 0, \"filename\": \"foobar\"}]"));
+ std::unique_ptr<base::Value> result(
+ RunFunctionAndReturnResult(new DownloadsSearchFunction(),
+ "[{\"id\": 0, \"filename\": \"foobar\"}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
ASSERT_TRUE(result->GetAsList(&result_list));
@@ -1187,7 +1187,7 @@
ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo),
&items));
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsSearchFunction(), "[{\"orderBy\": [\"filename\"]}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1220,7 +1220,7 @@
ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo),
&items));
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsSearchFunction(), "[{\"orderBy\": []}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1257,7 +1257,7 @@
ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo),
&items));
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsSearchFunction(), "[{\"danger\": \"content\"}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1281,7 +1281,7 @@
items[0]->Cancel(true);
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsSearchFunction(), "[{\"state\": \"in_progress\"}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1303,7 +1303,7 @@
CreateSlowTestDownloads(2, &items);
ScopedItemVectorCanceller delete_items(&items);
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsSearchFunction(), "[{\"limit\": 1}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
@@ -1346,12 +1346,13 @@
ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo),
&items));
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsSearchFunction(), "[{"
- "\"state\": \"complete\", "
- "\"danger\": \"content\", "
- "\"orderBy\": [\"filename\"], "
- "\"limit\": 1}]"));
+ std::unique_ptr<base::Value> result(
+ RunFunctionAndReturnResult(new DownloadsSearchFunction(),
+ "[{"
+ "\"state\": \"complete\", "
+ "\"danger\": \"content\", "
+ "\"orderBy\": [\"filename\"], "
+ "\"limit\": 1}]"));
ASSERT_TRUE(result.get());
base::ListValue* result_list = NULL;
ASSERT_TRUE(result->GetAsList(&result_list));
@@ -1369,7 +1370,7 @@
// DownloadsResumeFunction, and DownloadsCancelFunction.
IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
DownloadExtensionTest_SearchPauseResumeCancelGetFileIconIncognito) {
- scoped_ptr<base::Value> result_value;
+ std::unique_ptr<base::Value> result_value;
base::ListValue* result_list = NULL;
base::DictionaryValue* result_dict = NULL;
base::FilePath::StringType filename;
@@ -1505,9 +1506,9 @@
GoOnTheRecord();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -1550,9 +1551,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -1687,11 +1688,11 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"sub/dir/ect/ory.txt\"}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"sub/dir/ect/ory.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -1775,7 +1776,7 @@
}
int result_id = -1;
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsDownloadFunction(),
"[{\"url\": \"javascript:document.write(\\\"hello\\\");\"}]"));
ASSERT_TRUE(result.get());
@@ -1824,9 +1825,9 @@
embedded_test_server()->GetURL("/slow?0#fragment").spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -1867,9 +1868,9 @@
std::string download_url = "data:text/plain,hello";
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -1946,10 +1947,11 @@
std::string download_url = "data:text/plain,hello";
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"data.txt\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"data.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2001,10 +2003,11 @@
download_url += "C:/";
#endif
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"file.txt\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"file.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2050,11 +2053,11 @@
embedded_test_server()->GetURL("/auth-basic").spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"auth-basic-fail.txt\"}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"auth-basic-fail.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2086,14 +2089,14 @@
.spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"headers-succeed.txt\","
- " \"headers\": ["
- " {\"name\": \"Foo\", \"value\": \"bar\"},"
- " {\"name\": \"Qx\", \"value\":\"yo\"}]}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"headers-succeed.txt\","
+ " \"headers\": ["
+ " {\"name\": \"Foo\", \"value\": \"bar\"},"
+ " {\"name\": \"Qx\", \"value\":\"yo\"}]}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2143,11 +2146,11 @@
.spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"headers-fail.txt\"}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"headers-fail.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2181,14 +2184,14 @@
static const char kAuthorization[] = "dXNlcm5hbWU6c2VjcmV0";
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"auth-basic-succeed.txt\","
- " \"headers\": [{"
- " \"name\": \"Authorization\","
- " \"value\": \"Basic %s\"}]}]",
- download_url.c_str(), kAuthorization)));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"auth-basic-succeed.txt\","
+ " \"headers\": [{"
+ " \"name\": \"Authorization\","
+ " \"value\": \"Basic %s\"}]}]",
+ download_url.c_str(), kAuthorization)));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2228,13 +2231,13 @@
.spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"filename\": \"post-succeed.txt\","
- " \"method\": \"POST\","
- " \"body\": \"BODY\"}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"filename\": \"post-succeed.txt\","
+ " \"method\": \"POST\","
+ " \"body\": \"BODY\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2284,12 +2287,12 @@
.spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"body\": \"BODY\","
- " \"filename\": \"post-get.txt\"}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"body\": \"BODY\","
+ " \"filename\": \"post-get.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2327,12 +2330,12 @@
.spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\","
- " \"method\": \"POST\","
- " \"filename\": \"post-nobody.txt\"}]",
- download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\","
+ " \"method\": \"POST\","
+ " \"filename\": \"post-nobody.txt\"}]",
+ download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2367,9 +2370,9 @@
spawned_test_server()->GetURL("download-known-size").spec();
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2428,9 +2431,9 @@
strlen(kPayloadData)));
// Now download it.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2477,9 +2480,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2550,9 +2553,9 @@
0);
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2606,9 +2609,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2685,9 +2688,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2763,9 +2766,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2829,9 +2832,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2895,9 +2898,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -2968,9 +2971,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3034,9 +3037,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3100,9 +3103,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3166,9 +3169,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3233,9 +3236,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3301,9 +3304,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3427,9 +3430,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3563,9 +3566,9 @@
std::string download_url = embedded_test_server()->GetURL("/slow?0").spec();
// Start downloading a file.
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3619,9 +3622,9 @@
// Start an on-record download.
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3758,9 +3761,9 @@
// Start an on-record download.
GoOnTheRecord();
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
- new DownloadsDownloadFunction(), base::StringPrintf(
- "[{\"url\": \"%s\"}]", download_url.c_str())));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
+ new DownloadsDownloadFunction(),
+ base::StringPrintf("[{\"url\": \"%s\"}]", download_url.c_str())));
ASSERT_TRUE(result.get());
int result_id = -1;
ASSERT_TRUE(result->GetAsInteger(&result_id));
@@ -3903,7 +3906,7 @@
DownloadItem* item = NULL;
{
DownloadManager* manager = GetCurrentManager();
- scoped_ptr<content::DownloadTestObserver> observer(
+ std::unique_ptr<content::DownloadTestObserver> observer(
new JustInProgressDownloadObserver(manager, 1));
ASSERT_EQ(0, manager->InProgressCount());
ASSERT_EQ(0, manager->NonMaliciousInProgressCount());
@@ -4064,7 +4067,7 @@
// DownloadDangerPrompt is created, pretend that the user clicks the Accept
// button; wait until the download completes.
LoadExtension("downloads_split");
- scoped_ptr<base::Value> result(RunFunctionAndReturnResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
new DownloadsDownloadFunction(),
"[{\"url\": \"data:,\", \"filename\": \"dangerous.swf\"}]"));
ASSERT_TRUE(result.get());
@@ -4081,7 +4084,7 @@
result_id)));
ASSERT_TRUE(item->IsDangerous());
ScopedCancellingItem canceller(item);
- scoped_ptr<content::DownloadTestObserver> observer(
+ std::unique_ptr<content::DownloadTestObserver> observer(
new content::DownloadTestObserverTerminal(
GetCurrentManager(), 1,
content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_IGNORE));
diff --git a/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc b/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc
index 164986b..109d0b8 100644
--- a/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc
+++ b/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc
@@ -20,7 +20,7 @@
DetermineFilenameParams;
bool DownloadsInternalDetermineFilenameFunction::RunAsync() {
- scoped_ptr<DetermineFilenameParams> params(
+ std::unique_ptr<DetermineFilenameParams> params(
DetermineFilenameParams::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
base::FilePath::StringType filename;
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
index c08e8a4..1350f05 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
@@ -137,7 +138,7 @@
}
bool EasyUnlockPrivateGetStringsFunction::RunSync() {
- scoped_ptr<base::DictionaryValue> strings(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> strings(new base::DictionaryValue);
#if defined(OS_CHROMEOS)
const base::string16 device_type = ash::GetChromeOSDeviceName();
@@ -369,7 +370,7 @@
~EasyUnlockPrivatePerformECDHKeyAgreementFunction() {}
bool EasyUnlockPrivatePerformECDHKeyAgreementFunction::RunAsync() {
- scoped_ptr<easy_unlock_private::PerformECDHKeyAgreement::Params> params =
+ std::unique_ptr<easy_unlock_private::PerformECDHKeyAgreement::Params> params =
easy_unlock_private::PerformECDHKeyAgreement::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -422,7 +423,7 @@
~EasyUnlockPrivateCreateSecureMessageFunction() {}
bool EasyUnlockPrivateCreateSecureMessageFunction::RunAsync() {
- scoped_ptr<easy_unlock_private::CreateSecureMessage::Params> params =
+ std::unique_ptr<easy_unlock_private::CreateSecureMessage::Params> params =
easy_unlock_private::CreateSecureMessage::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -450,7 +451,7 @@
~EasyUnlockPrivateUnwrapSecureMessageFunction() {}
bool EasyUnlockPrivateUnwrapSecureMessageFunction::RunAsync() {
- scoped_ptr<easy_unlock_private::UnwrapSecureMessage::Params> params =
+ std::unique_ptr<easy_unlock_private::UnwrapSecureMessage::Params> params =
easy_unlock_private::UnwrapSecureMessage::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -478,8 +479,8 @@
~EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction() {}
bool EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::RunAsync() {
- scoped_ptr<easy_unlock_private::SeekBluetoothDeviceByAddress::Params> params(
- easy_unlock_private::SeekBluetoothDeviceByAddress::Params::Create(
+ std::unique_ptr<easy_unlock_private::SeekBluetoothDeviceByAddress::Params>
+ params(easy_unlock_private::SeekBluetoothDeviceByAddress::Params::Create(
*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -534,7 +535,7 @@
~EasyUnlockPrivateUpdateScreenlockStateFunction() {}
bool EasyUnlockPrivateUpdateScreenlockStateFunction::RunSync() {
- scoped_ptr<easy_unlock_private::UpdateScreenlockState::Params> params(
+ std::unique_ptr<easy_unlock_private::UpdateScreenlockState::Params> params(
easy_unlock_private::UpdateScreenlockState::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -556,7 +557,7 @@
}
bool EasyUnlockPrivateSetPermitAccessFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetPermitAccess::Params> params(
+ std::unique_ptr<easy_unlock_private::SetPermitAccess::Params> params(
easy_unlock_private::SetPermitAccess::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -586,7 +587,7 @@
const base::DictionaryValue* permit_value =
EasyUnlockService::Get(profile)->GetPermitAccess();
if (permit_value) {
- scoped_ptr<easy_unlock_private::PermitRecord> permit =
+ std::unique_ptr<easy_unlock_private::PermitRecord> permit =
easy_unlock_private::PermitRecord::FromValue(*permit_value);
results_ = easy_unlock_private::GetPermitAccess::Results::Create(*permit);
}
@@ -627,7 +628,8 @@
// Fill in the permit access JSON dictionary.
proximity_auth::ProximityAuthClient* client =
easy_unlock_service->proximity_auth_client();
- scoped_ptr<base::DictionaryValue> permit_access(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> permit_access(
+ new base::DictionaryValue());
permit_access->SetString("permitId",
"permit://google.com/" + client->GetAccountId());
permit_access->SetString("id", b64_public_key);
@@ -638,7 +640,7 @@
<< "chrome.easyUnlockPrivate.getPermitAccess:\n"
<< " id: " << b64_public_key;
- scoped_ptr<easy_unlock_private::PermitRecord> result =
+ std::unique_ptr<easy_unlock_private::PermitRecord> result =
easy_unlock_private::PermitRecord::FromValue(*permit_access);
results_ = easy_unlock_private::GetPermitAccess::Results::Create(*result);
}
@@ -666,7 +668,7 @@
}
bool EasyUnlockPrivateSetRemoteDevicesFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetRemoteDevices::Params> params(
+ std::unique_ptr<easy_unlock_private::SetRemoteDevices::Params> params(
easy_unlock_private::SetRemoteDevices::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -791,14 +793,15 @@
&b64_psk);
// Fill in the JSON dictionary containing a single unlock key's data.
- scoped_ptr<base::DictionaryValue> device_dictionary(
+ std::unique_ptr<base::DictionaryValue> device_dictionary(
new base::DictionaryValue());
device_dictionary->SetString("name", device.friendly_device_name());
device_dictionary->SetString("bluetoothAddress", device.bluetooth_address());
device_dictionary->SetString("psk", b64_psk);
// Fill in the permit license for the unlock key.
- scoped_ptr<base::DictionaryValue> permit_license(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> permit_license(
+ new base::DictionaryValue());
permit_license->SetString("permitId", permit_id_);
permit_license->SetString("id", b64_public_key);
permit_license->SetString("type", "license");
@@ -825,7 +828,7 @@
}
bool EasyUnlockPrivateGetSignInChallengeFunction::RunAsync() {
- scoped_ptr<easy_unlock_private::GetSignInChallenge::Params> params(
+ std::unique_ptr<easy_unlock_private::GetSignInChallenge::Params> params(
easy_unlock_private::GetSignInChallenge::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -873,7 +876,7 @@
}
bool EasyUnlockPrivateTrySignInSecretFunction::RunSync() {
- scoped_ptr<easy_unlock_private::TrySignInSecret::Params> params(
+ std::unique_ptr<easy_unlock_private::TrySignInSecret::Params> params(
easy_unlock_private::TrySignInSecret::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -926,7 +929,7 @@
bool EasyUnlockPrivateGetConnectionInfoFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<easy_unlock_private::GetConnectionInfo::Params> params =
+ std::unique_ptr<easy_unlock_private::GetConnectionInfo::Params> params =
easy_unlock_private::GetConnectionInfo::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -951,7 +954,7 @@
void EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo(
const device::BluetoothDevice::ConnectionInfo& connection_info) {
- scoped_ptr<base::ListValue> results(new base::ListValue());
+ std::unique_ptr<base::ListValue> results(new base::ListValue());
results->AppendInteger(connection_info.rssi);
results->AppendInteger(connection_info.transmit_power);
results->AppendInteger(connection_info.max_transmit_power);
@@ -974,7 +977,7 @@
return true;
}
- scoped_ptr<easy_unlock_private::ShowErrorBubble::Params> params(
+ std::unique_ptr<easy_unlock_private::ShowErrorBubble::Params> params(
easy_unlock_private::ShowErrorBubble::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -1028,7 +1031,7 @@
}
bool EasyUnlockPrivateSetAutoPairingResultFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetAutoPairingResult::Params> params =
+ std::unique_ptr<easy_unlock_private::SetAutoPairingResult::Params> params =
easy_unlock_private::SetAutoPairingResult::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1046,7 +1049,7 @@
EasyUnlockPrivateFindSetupConnectionFunction::
EasyUnlockPrivateFindSetupConnectionFunction()
: bluetooth_throttler_(new proximity_auth::BluetoothThrottlerImpl(
- make_scoped_ptr(new base::DefaultTickClock()))) {}
+ base::WrapUnique(new base::DefaultTickClock()))) {}
EasyUnlockPrivateFindSetupConnectionFunction::
~EasyUnlockPrivateFindSetupConnectionFunction() {
@@ -1064,7 +1067,7 @@
}
void EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound(
- scoped_ptr<proximity_auth::Connection> connection) {
+ std::unique_ptr<proximity_auth::Connection> connection) {
// Connection are not persistent by default.
std::string device_address = connection->remote_device().bluetooth_address;
bool persistent = false;
@@ -1077,7 +1080,7 @@
}
bool EasyUnlockPrivateFindSetupConnectionFunction::RunAsync() {
- scoped_ptr<easy_unlock_private::FindSetupConnection::Params> params =
+ std::unique_ptr<easy_unlock_private::FindSetupConnection::Params> params =
easy_unlock_private::FindSetupConnection::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1108,7 +1111,7 @@
~EasyUnlockPrivateSetupConnectionStatusFunction() {}
bool EasyUnlockPrivateSetupConnectionStatusFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetupConnectionStatus::Params> params =
+ std::unique_ptr<easy_unlock_private::SetupConnectionStatus::Params> params =
easy_unlock_private::SetupConnectionStatus::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
api::easy_unlock_private::ConnectionStatus status =
@@ -1128,8 +1131,9 @@
~EasyUnlockPrivateSetupConnectionDisconnectFunction() {}
bool EasyUnlockPrivateSetupConnectionDisconnectFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetupConnectionDisconnect::Params> params =
- easy_unlock_private::SetupConnectionDisconnect::Params::Create(*args_);
+ std::unique_ptr<easy_unlock_private::SetupConnectionDisconnect::Params>
+ params = easy_unlock_private::SetupConnectionDisconnect::Params::Create(
+ *args_);
EXTENSION_FUNCTION_VALIDATE(params);
bool success = GetConnectionManager(browser_context())
->Disconnect(extension(), params->connection_id);
@@ -1145,7 +1149,7 @@
~EasyUnlockPrivateSetupConnectionSendFunction() {}
bool EasyUnlockPrivateSetupConnectionSendFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetupConnectionSend::Params> params =
+ std::unique_ptr<easy_unlock_private::SetupConnectionSend::Params> params =
easy_unlock_private::SetupConnectionSend::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
std::string payload(params->data.begin(), params->data.end());
@@ -1163,7 +1167,7 @@
~EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction() {}
bool EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction::RunSync() {
- scoped_ptr<easy_unlock_private::SetupConnectionGetDeviceAddress::Params>
+ std::unique_ptr<easy_unlock_private::SetupConnectionGetDeviceAddress::Params>
params =
easy_unlock_private::SetupConnectionGetDeviceAddress::Params::Create(
*args_);
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h
index 23c964a..b658bfb 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h
@@ -7,10 +7,10 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "device/bluetooth/bluetooth_device.h"
#include "extensions/browser/api/bluetooth/bluetooth_extension_function.h"
#include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h"
@@ -65,9 +65,9 @@
// BrowserContextKeyedAPI implementation.
static const char* service_name() { return "EasyUnlockPrivate"; }
- scoped_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_;
+ std::unique_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_;
- scoped_ptr<EasyUnlockPrivateConnectionManager> connection_manager_;
+ std::unique_ptr<EasyUnlockPrivateConnectionManager> connection_manager_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI);
};
@@ -333,10 +333,11 @@
size_t expected_devices_count_;
// Working list of the devices to return. Used for the native experiment.
- scoped_ptr<base::ListValue> remote_devices_;
+ std::unique_ptr<base::ListValue> remote_devices_;
// Used to derive devices' PSK. Used for the native experiment.
- scoped_ptr<proximity_auth::SecureMessageDelegate> secure_message_delegate_;
+ std::unique_ptr<proximity_auth::SecureMessageDelegate>
+ secure_message_delegate_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction);
};
@@ -471,20 +472,21 @@
// Called when the connection with the remote device advertising the setup
// service was found.
- void OnConnectionFound(scoped_ptr<proximity_auth::Connection> connection);
+ void OnConnectionFound(
+ std::unique_ptr<proximity_auth::Connection> connection);
// Callback when waiting for |connection_finder_| to return.
void OnConnectionFinderTimedOut();
// The BLE connection finder instance.
- scoped_ptr<proximity_auth::BluetoothLowEnergyConnectionFinder>
+ std::unique_ptr<proximity_auth::BluetoothLowEnergyConnectionFinder>
connection_finder_;
// The connection throttler passed to the BLE connection finder.
- scoped_ptr<proximity_auth::BluetoothThrottler> bluetooth_throttler_;
+ std::unique_ptr<proximity_auth::BluetoothThrottler> bluetooth_throttler_;
// Used for timing out when waiting for the connection finder to return.
- scoped_ptr<base::Timer> timer_;
+ std::unique_ptr<base::Timer> timer_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateFindSetupConnectionFunction);
};
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
index 2f75977..79767f51 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
@@ -4,13 +4,14 @@
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h"
+#include <memory>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
@@ -228,7 +229,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue(private_key_1));
args->Append(StringToBinaryValue(public_key_2));
@@ -260,7 +261,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue("PAYLOAD"));
args->Append(StringToBinaryValue("KEY"));
base::DictionaryValue* options = new base::DictionaryValue();
@@ -302,7 +303,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue("PAYLOAD"));
args->Append(StringToBinaryValue("KEY"));
base::DictionaryValue* options = new base::DictionaryValue();
@@ -334,7 +335,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue("PAYLOAD"));
args->Append(StringToBinaryValue("KEY"));
base::DictionaryValue* options = new base::DictionaryValue();
@@ -372,7 +373,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue("MESSAGE"));
args->Append(StringToBinaryValue("KEY"));
base::DictionaryValue* options = new base::DictionaryValue();
@@ -409,7 +410,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue("MESSAGE"));
args->Append(StringToBinaryValue("KEY"));
base::DictionaryValue* options = new base::DictionaryValue();
@@ -440,7 +441,7 @@
base::Bind(&CopyData, &expected_result));
ASSERT_GT(expected_result.length(), 0u);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(StringToBinaryValue("MESSAGE"));
args->Append(StringToBinaryValue("KEY"));
base::DictionaryValue* options = new base::DictionaryValue();
@@ -471,9 +472,9 @@
};
// Test factory to register EasyUnlockService.
-scoped_ptr<KeyedService> BuildTestEasyUnlockService(
+std::unique_ptr<KeyedService> BuildTestEasyUnlockService(
content::BrowserContext* context) {
- scoped_ptr<EasyUnlockServiceRegular> service(
+ std::unique_ptr<EasyUnlockServiceRegular> service(
new EasyUnlockServiceRegular(Profile::FromBrowserContext(context)));
service->Initialize(
EasyUnlockAppManager::Create(extensions::ExtensionSystem::Get(context),
@@ -484,14 +485,16 @@
// A fake EventRouter that logs event it dispatches for testing.
class FakeEventRouter : public extensions::EventRouter {
public:
- FakeEventRouter(Profile* profile,
- scoped_ptr<extensions::TestExtensionPrefs> extension_prefs)
+ FakeEventRouter(
+ Profile* profile,
+ std::unique_ptr<extensions::TestExtensionPrefs> extension_prefs)
: EventRouter(profile, extension_prefs->prefs()),
extension_prefs_(std::move(extension_prefs)),
event_count_(0) {}
- void DispatchEventToExtension(const std::string& extension_id,
- scoped_ptr<extensions::Event> event) override {
+ void DispatchEventToExtension(
+ const std::string& extension_id,
+ std::unique_ptr<extensions::Event> event) override {
++event_count_;
last_extension_id_ = extension_id;
last_event_name_ = event ? event->event_name : std::string();
@@ -502,19 +505,19 @@
const std::string& last_event_name() const { return last_event_name_; }
private:
- scoped_ptr<extensions::TestExtensionPrefs> extension_prefs_;
+ std::unique_ptr<extensions::TestExtensionPrefs> extension_prefs_;
int event_count_;
std::string last_extension_id_;
std::string last_event_name_;
};
// FakeEventRouter factory function
-scoped_ptr<KeyedService> FakeEventRouterFactoryFunction(
+std::unique_ptr<KeyedService> FakeEventRouterFactoryFunction(
content::BrowserContext* profile) {
- scoped_ptr<extensions::TestExtensionPrefs> extension_prefs(
+ std::unique_ptr<extensions::TestExtensionPrefs> extension_prefs(
new extensions::TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get()));
- return make_scoped_ptr(new FakeEventRouter(static_cast<Profile*>(profile),
- std::move(extension_prefs)));
+ return base::WrapUnique(new FakeEventRouter(static_cast<Profile*>(profile),
+ std::move(extension_prefs)));
}
TEST_F(EasyUnlockPrivateApiTest, AutoPairing) {
@@ -573,7 +576,7 @@
scoped_refptr<TestableGetRemoteDevicesFunction> function(
new TestableGetRemoteDevicesFunction());
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
extensions::api_test_utils::RunFunctionAndReturnSingleResult(
function.get(), "[]", profile()));
ASSERT_TRUE(value.get());
@@ -607,7 +610,7 @@
scoped_refptr<TestableGetRemoteDevicesFunction> function(
new TestableGetRemoteDevicesFunction());
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
extensions::api_test_utils::RunFunctionAndReturnSingleResult(
function.get(), "[]", profile()));
ASSERT_TRUE(value.get());
@@ -628,7 +631,7 @@
scoped_refptr<TestableGetPermitAccessFunction> function(
new TestableGetPermitAccessFunction());
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
extensions::api_test_utils::RunFunctionAndReturnSingleResult(
function.get(), "[]", profile()));
ASSERT_TRUE(value);
@@ -651,7 +654,7 @@
scoped_refptr<TestableGetPermitAccessFunction> function(
new TestableGetPermitAccessFunction());
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
extensions::api_test_utils::RunFunctionAndReturnSingleResult(
function.get(), "[]", profile()));
EXPECT_FALSE(value);
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.cc
index 5e17d0c..c6265f5a 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.cc
@@ -22,7 +22,7 @@
EasyUnlockPrivateConnection::EasyUnlockPrivateConnection(
bool persistent,
const std::string& owner_extension_id,
- scoped_ptr<proximity_auth::Connection> connection)
+ std::unique_ptr<proximity_auth::Connection> connection)
: ApiResource(owner_extension_id),
persistent_(persistent),
connection_(connection.release()) {}
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h
index 42269c41..f72f2a7 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_H_
#define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/api_resource_manager.h"
@@ -21,7 +22,7 @@
EasyUnlockPrivateConnection(
bool persistent,
const std::string& owner_extension_id,
- scoped_ptr<proximity_auth::Connection> connection);
+ std::unique_ptr<proximity_auth::Connection> connection);
~EasyUnlockPrivateConnection() override;
// Returns a pointer to the underlying connection object.
@@ -45,7 +46,7 @@
// The connection is owned by this instance and will automatically disconnect
// when deleted.
- scoped_ptr<proximity_auth::Connection> connection_;
+ std::unique_ptr<proximity_auth::Connection> connection_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateConnection);
};
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.cc
index 84288b79..a11dfb82 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h"
#include "chrome/common/extensions/api/easy_unlock_private.h"
#include "components/proximity_auth/connection.h"
@@ -52,7 +53,7 @@
int EasyUnlockPrivateConnectionManager::AddConnection(
const Extension* extension,
- scoped_ptr<Connection> connection,
+ std::unique_ptr<Connection> connection,
bool persistent) {
DCHECK(connection);
connection->AddObserver(this);
@@ -97,7 +98,7 @@
const std::string& payload) {
Connection* connection = GetConnection(extension->id(), connection_id);
if (connection && connection->IsConnected()) {
- connection->SendMessage(make_scoped_ptr(new WireMessage(payload)));
+ connection->SendMessage(base::WrapUnique(new WireMessage(payload)));
return true;
}
return false;
@@ -111,7 +112,7 @@
api::easy_unlock_private::OnConnectionStatusChanged::kEventName;
events::HistogramValue histogram_value =
events::EASY_UNLOCK_PRIVATE_ON_CONNECTION_STATUS_CHANGED;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
api::easy_unlock_private::OnConnectionStatusChanged::Create(
0, ToApiConnectionStatus(old_status),
ToApiConnectionStatus(new_status));
@@ -126,7 +127,7 @@
events::HistogramValue histogram_value =
events::EASY_UNLOCK_PRIVATE_ON_DATA_RECEIVED;
std::vector<char> data(message.payload().begin(), message.payload().end());
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
api::easy_unlock_private::OnDataReceived::Create(0, data);
DispatchConnectionEvent(event_name, histogram_value, &connection,
std::move(args));
@@ -141,7 +142,7 @@
events::HistogramValue histogram_value =
events::EASY_UNLOCK_PRIVATE_ON_SEND_COMPLETED;
std::vector<char> data(message.payload().begin(), message.payload().end());
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
api::easy_unlock_private::OnSendCompleted::Create(0, data, success);
DispatchConnectionEvent(event_name, histogram_value, &connection,
std::move(args));
@@ -151,7 +152,7 @@
const std::string& event_name,
events::HistogramValue histogram_value,
const Connection* connection,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
const EventListenerMap::ListenerList listeners =
EventRouter::Get(browser_context_)
->listeners()
@@ -159,11 +160,11 @@
for (const auto& listener : listeners) {
std::string extension_id = listener->extension_id();
int connection_id = FindConnectionId(extension_id, connection);
- scoped_ptr<base::ListValue> args_copy(args->DeepCopy());
+ std::unique_ptr<base::ListValue> args_copy(args->DeepCopy());
int connection_index = 0;
args_copy->Set(connection_index,
- make_scoped_ptr(new base::FundamentalValue(connection_id)));
- scoped_ptr<Event> event(
+ base::WrapUnique(new base::FundamentalValue(connection_id)));
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args_copy)));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(extension_id, std::move(event));
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.h b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.h
index f7a0aa7b..be4e4ac 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.h
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection_manager.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_MANAGER_H_
#define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_MANAGER_H_
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h"
#include "chrome/common/extensions/api/easy_unlock_private.h"
#include "components/proximity_auth/connection.h"
@@ -35,7 +35,7 @@
// Stores |connection| in the API connection manager. Returns the
// |connection_id|.
int AddConnection(const Extension* extension,
- scoped_ptr<proximity_auth::Connection> connection,
+ std::unique_ptr<proximity_auth::Connection> connection,
bool persistent);
// Returns the status of the connection with |connection_id|.
@@ -76,7 +76,7 @@
void DispatchConnectionEvent(const std::string& event_name,
events::HistogramValue histogram_value,
const proximity_auth::Connection* connection,
- scoped_ptr<base::ListValue> args);
+ std::unique_ptr<base::ListValue> args);
// Convenience method to get the API resource manager.
ApiResourceManager<EasyUnlockPrivateConnection>* GetResourceManager() const;
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h
index e468354..f03f4704 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
+#include <memory>
#include <string>
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/api/easy_unlock_private.h"
namespace extensions {
@@ -28,7 +28,7 @@
// Creates platform specific delegate instance. Non Chrome OS implementations
// currently do nothing but invoke callbacks with empty data.
- static scoped_ptr<EasyUnlockPrivateCryptoDelegate> Create();
+ static std::unique_ptr<EasyUnlockPrivateCryptoDelegate> Create();
// See chromeos/dbus/easy_unlock_client.h for info on these methods.
virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) = 0;
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_chromeos.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_chromeos.cc
index 62df6c8..6d2a5b9 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_chromeos.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_chromeos.cc
@@ -124,9 +124,9 @@
} // namespace
// static
-scoped_ptr<EasyUnlockPrivateCryptoDelegate>
- EasyUnlockPrivateCryptoDelegate::Create() {
- return scoped_ptr<EasyUnlockPrivateCryptoDelegate>(
+std::unique_ptr<EasyUnlockPrivateCryptoDelegate>
+EasyUnlockPrivateCryptoDelegate::Create() {
+ return std::unique_ptr<EasyUnlockPrivateCryptoDelegate>(
new EasyUnlockPrivateCryptoDelegateChromeOS());
}
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_stub.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_stub.cc
index 879c503..5a7161c 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_stub.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate_stub.cc
@@ -48,9 +48,9 @@
} // namespace
// static
-scoped_ptr<EasyUnlockPrivateCryptoDelegate>
- EasyUnlockPrivateCryptoDelegate::Create() {
- return scoped_ptr<EasyUnlockPrivateCryptoDelegate>(
+std::unique_ptr<EasyUnlockPrivateCryptoDelegate>
+EasyUnlockPrivateCryptoDelegate::Create() {
+ return std::unique_ptr<EasyUnlockPrivateCryptoDelegate>(
new EasyUnlockPrivateCryptoDelegateStub());
}
diff --git a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
index 5d6a5fd..d69fcbc 100644
--- a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
+++ b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
@@ -75,7 +75,7 @@
chromeos::FakeSessionManagerClient* fake_session_manager_client =
new chromeos::FakeSessionManagerClient;
chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
- scoped_ptr<chromeos::SessionManagerClient>(
+ std::unique_ptr<chromeos::SessionManagerClient>(
fake_session_manager_client));
std::set<std::string> device_affiliation_ids;
@@ -95,7 +95,7 @@
affiliated_account_id_.GetUserEmail(), user_affiliation_ids);
// Set up fake install attributes.
- scoped_ptr<policy::StubEnterpriseInstallAttributes> attributes(
+ std::unique_ptr<policy::StubEnterpriseInstallAttributes> attributes(
new policy::StubEnterpriseInstallAttributes());
attributes->SetRegistrationUser(affiliated_account_id_.GetUserEmail());
@@ -140,7 +140,7 @@
GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl(
update_manifest_path.MaybeAsASCII()));
- scoped_ptr<base::ListValue> forcelist(new base::ListValue);
+ std::unique_ptr<base::ListValue> forcelist(new base::ListValue);
forcelist->AppendString(base::StringPrintf(
"%s;%s", kTestExtensionID, update_manifest_url.spec().c_str()));
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
index d21e35e..aaf68c6b 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.cc
@@ -47,7 +47,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysInternalGenerateKeyFunction::Run() {
- scoped_ptr<api_epki::GenerateKey::Params> params(
+ std::unique_ptr<api_epki::GenerateKey::Params> params(
api_epki::GenerateKey::Params::Create(*args_));
// TODO(pneubeck): Add support for unsigned integers to IDL.
EXTENSION_FUNCTION_VALIDATE(params && params->modulus_length >= 0);
@@ -88,7 +88,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysGetCertificatesFunction::Run() {
- scoped_ptr<api_epk::GetCertificates::Params> params(
+ std::unique_ptr<api_epk::GetCertificates::Params> params(
api_epk::GetCertificates::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
std::string platform_keys_token_id;
@@ -105,7 +105,7 @@
}
void EnterprisePlatformKeysGetCertificatesFunction::OnGotCertificates(
- scoped_ptr<net::CertificateList> certs,
+ std::unique_ptr<net::CertificateList> certs,
const std::string& error_message) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!error_message.empty()) {
@@ -113,7 +113,7 @@
return;
}
- scoped_ptr<base::ListValue> client_certs(new base::ListValue());
+ std::unique_ptr<base::ListValue> client_certs(new base::ListValue());
for (net::CertificateList::const_iterator it = certs->begin();
it != certs->end();
++it) {
@@ -123,7 +123,7 @@
der_encoding.data(), der_encoding.size()));
}
- scoped_ptr<base::ListValue> results(new base::ListValue());
+ std::unique_ptr<base::ListValue> results(new base::ListValue());
results->Append(client_certs.release());
Respond(ArgumentList(std::move(results)));
}
@@ -134,7 +134,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysImportCertificateFunction::Run() {
- scoped_ptr<api_epk::ImportCertificate::Params> params(
+ std::unique_ptr<api_epk::ImportCertificate::Params> params(
api_epk::ImportCertificate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
std::string platform_keys_token_id;
@@ -172,7 +172,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysRemoveCertificateFunction::Run() {
- scoped_ptr<api_epk::RemoveCertificate::Params> params(
+ std::unique_ptr<api_epk::RemoveCertificate::Params> params(
api_epk::RemoveCertificate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
std::string platform_keys_token_id;
@@ -220,7 +220,7 @@
}
void EnterprisePlatformKeysInternalGetTokensFunction::OnGotTokens(
- scoped_ptr<std::vector<std::string> > platform_keys_token_ids,
+ std::unique_ptr<std::vector<std::string>> platform_keys_token_ids,
const std::string& error_message) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!error_message.empty()) {
@@ -258,7 +258,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysChallengeMachineKeyFunction::Run() {
- scoped_ptr<api_epk::ChallengeMachineKey::Params> params(
+ std::unique_ptr<api_epk::ChallengeMachineKey::Params> params(
api_epk::ChallengeMachineKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
ChallengeKeyCallback callback = base::Bind(
@@ -299,7 +299,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysChallengeUserKeyFunction::Run() {
- scoped_ptr<api_epk::ChallengeUserKey::Params> params(
+ std::unique_ptr<api_epk::ChallengeUserKey::Params> params(
api_epk::ChallengeUserKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
ChallengeKeyCallback callback = base::Bind(
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h
index 6af1c1e..d844023f 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFORM_KEYS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_ENTERPRISE_PLATFORM_KEYS_API_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h"
#include "extensions/browser/extension_function.h"
@@ -43,7 +43,7 @@
// Called when the list of certificates was determined. If an error occurred,
// |certs| will be NULL and instead |error_message| be set.
- void OnGotCertificates(scoped_ptr<net::CertificateList> certs,
+ void OnGotCertificates(std::unique_ptr<net::CertificateList> certs,
const std::string& error_message);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.getCertificates",
@@ -86,7 +86,7 @@
// Called when the list of tokens was determined. If an error occurred,
// |token_ids| will be NULL and instead |error_message| be set.
- void OnGotTokens(scoped_ptr<std::vector<std::string> > token_ids,
+ void OnGotTokens(std::unique_ptr<std::vector<std::string>> token_ids,
const std::string& error_message);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.getTokens",
@@ -109,7 +109,7 @@
// Otherwise |success| will be false and |data| is an error message.
void OnChallengedKey(bool success, const std::string& data);
- scoped_ptr<EPKPChallengeMachineKey> default_impl_;
+ std::unique_ptr<EPKPChallengeMachineKey> default_impl_;
EPKPChallengeMachineKey* impl_;
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey",
@@ -132,7 +132,7 @@
// Otherwise |success| will be false and |data| is an error message.
void OnChallengedKey(bool success, const std::string& data);
- scoped_ptr<EPKPChallengeUserKey> default_impl_;
+ std::unique_ptr<EPKPChallengeUserKey> default_impl_;
EPKPChallengeUserKey* impl_;
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey",
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
index 97a58a1..f2a43d5 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
@@ -208,7 +208,7 @@
// Like extension_function_test_utils::RunFunctionAndReturnError but with an
// explicit ListValue.
std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
Browser* browser) {
scoped_refptr<ExtensionFunction> function_owner(function);
// Without a callback the function will not generate a result.
@@ -222,7 +222,7 @@
// with an explicit ListValue.
base::Value* RunFunctionAndReturnSingleResult(
UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
Browser* browser) {
scoped_refptr<ExtensionFunction> function_owner(function);
// Without a callback the function will not generate a result.
@@ -268,8 +268,8 @@
EPKPChallengeMachineKey::kGetCertificateFailedError, error_code);
}
- scoped_ptr<base::ListValue> CreateArgs() {
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> CreateArgs() {
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(base::BinaryValue::CreateWithCopiedBuffer("challenge", 9));
return args;
}
@@ -353,7 +353,7 @@
"attest-ent-machine", "google.com", "device_id", _, "challenge", _))
.Times(1);
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
RunFunctionAndReturnSingleResult(func_.get(), CreateArgs(), browser()));
const base::BinaryValue* response;
@@ -404,14 +404,16 @@
error_code);
}
- scoped_ptr<base::ListValue> CreateArgs() { return CreateArgsInternal(true); }
+ std::unique_ptr<base::ListValue> CreateArgs() {
+ return CreateArgsInternal(true);
+ }
- scoped_ptr<base::ListValue> CreateArgsNoRegister() {
+ std::unique_ptr<base::ListValue> CreateArgsNoRegister() {
return CreateArgsInternal(false);
}
- scoped_ptr<base::ListValue> CreateArgsInternal(bool register_key) {
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> CreateArgsInternal(bool register_key) {
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(base::BinaryValue::CreateWithCopiedBuffer("challenge", 9));
args->Append(new base::FundamentalValue(register_key));
return args;
@@ -526,7 +528,7 @@
cryptohome_id, "attest-ent-user", _))
.Times(1);
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
RunFunctionAndReturnSingleResult(func_.get(), CreateArgs(), browser()));
const base::BinaryValue* response;
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
index e97cdbd..1f1d6e0 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
@@ -5,8 +5,9 @@
#include <cryptohi.h>
#include <stddef.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/browser_process.h"
@@ -252,7 +253,7 @@
chromeos::FakeSessionManagerClient* fake_session_manager_client =
new chromeos::FakeSessionManagerClient;
chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
- scoped_ptr<chromeos::SessionManagerClient>(
+ std::unique_ptr<chromeos::SessionManagerClient>(
fake_session_manager_client));
if (GetParam().device_status_ == DEVICE_STATUS_ENROLLED) {
@@ -360,7 +361,7 @@
GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl(
update_manifest_path.MaybeAsASCII()));
- scoped_ptr<base::ListValue> forcelist(new base::ListValue);
+ std::unique_ptr<base::ListValue> forcelist(new base::ListValue);
forcelist->AppendString(base::StringPrintf(
"%s;%s", kTestExtensionID, update_manifest_url.spec().c_str()));
@@ -426,7 +427,7 @@
}
policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
- scoped_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_;
+ std::unique_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_;
policy::MockConfigurationPolicyProvider policy_provider_;
FakeGaia fake_gaia_;
chromeos::HTTPSForwarder gaia_https_forwarder_;
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
index b394488a..6593ceb1 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
@@ -84,7 +84,7 @@
install_attributes_(g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetInstallAttributes()) {
- scoped_ptr<chromeos::attestation::ServerProxy> ca_client(
+ std::unique_ptr<chromeos::attestation::ServerProxy> ca_client(
new chromeos::attestation::AttestationCAClient());
default_attestation_flow_.reset(new chromeos::attestation::AttestationFlow(
async_caller_, cryptohome_client_, std::move(ca_client)));
@@ -566,7 +566,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysPrivateChallengeMachineKeyFunction::Run() {
- scoped_ptr<api_epkp::ChallengeMachineKey::Params> params(
+ std::unique_ptr<api_epkp::ChallengeMachineKey::Params> params(
api_epkp::ChallengeMachineKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
ChallengeKeyCallback callback =
@@ -610,7 +610,7 @@
ExtensionFunction::ResponseAction
EnterprisePlatformKeysPrivateChallengeUserKeyFunction::Run() {
- scoped_ptr<api_epkp::ChallengeUserKey::Params> params(
+ std::unique_ptr<api_epkp::ChallengeUserKey::Params> params(
api_epkp::ChallengeUserKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
ChallengeKeyCallback callback = base::Bind(
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
index 98bb8d2..24adc2d8 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
+++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
@@ -8,11 +8,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERPRISE_PLATFORM_KEYS_PRIVATE_API_H__
#define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERPRISE_PLATFORM_KEYS_PRIVATE_API_H__
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/api/enterprise_platform_keys_private.h"
#include "chromeos/attestation/attestation_constants.h"
#include "chromeos/attestation/attestation_flow.h"
@@ -116,7 +116,8 @@
chromeos::CryptohomeClient* cryptohome_client_;
cryptohome::AsyncMethodCaller* async_caller_;
chromeos::attestation::AttestationFlow* attestation_flow_;
- scoped_ptr<chromeos::attestation::AttestationFlow> default_attestation_flow_;
+ std::unique_ptr<chromeos::attestation::AttestationFlow>
+ default_attestation_flow_;
ChallengeKeyCallback callback_;
Profile* profile_;
std::string extension_id_;
@@ -260,7 +261,7 @@
// Otherwise |success| will be false and |data| is an error message.
void OnChallengedKey(bool success, const std::string& data);
- scoped_ptr<EPKPChallengeMachineKey> default_impl_;
+ std::unique_ptr<EPKPChallengeMachineKey> default_impl_;
EPKPChallengeMachineKey* impl_;
DECLARE_EXTENSION_FUNCTION(
@@ -284,7 +285,7 @@
// Otherwise |success| will be false and |data| is an error message.
void OnChallengedKey(bool success, const std::string& data);
- scoped_ptr<EPKPChallengeUserKey> default_impl_;
+ std::unique_ptr<EPKPChallengeUserKey> default_impl_;
EPKPChallengeUserKey* impl_;
DECLARE_EXTENSION_FUNCTION(
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
index e52f893..112315c 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
@@ -335,7 +335,7 @@
"attest-ent-machine", "google.com", "device_id", _, "challenge", _))
.Times(1);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func_.get(), kArgs, browser(), utils::NONE));
std::string response;
@@ -507,7 +507,7 @@
"attest-ent-user", _))
.Times(1);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func_.get(), kArgs, browser(), utils::NONE));
std::string response;
diff --git a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
index 0290f987b..e941c25 100644
--- a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
+++ b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
@@ -34,7 +34,7 @@
"extension_install_dialog_";
// static
-scoped_ptr<ExperienceSamplingEvent> ExperienceSamplingEvent::Create(
+std::unique_ptr<ExperienceSamplingEvent> ExperienceSamplingEvent::Create(
const std::string& element_name,
const GURL& destination,
const GURL& referrer) {
@@ -42,13 +42,13 @@
if (g_browser_process->profile_manager())
profile = g_browser_process->profile_manager()->GetLastUsedProfile();
if (!profile)
- return scoped_ptr<ExperienceSamplingEvent>();
- return scoped_ptr<ExperienceSamplingEvent>(new ExperienceSamplingEvent(
+ return std::unique_ptr<ExperienceSamplingEvent>();
+ return std::unique_ptr<ExperienceSamplingEvent>(new ExperienceSamplingEvent(
element_name, destination, referrer, profile));
}
// static
-scoped_ptr<ExperienceSamplingEvent> ExperienceSamplingEvent::Create(
+std::unique_ptr<ExperienceSamplingEvent> ExperienceSamplingEvent::Create(
const std::string& element_name) {
return ExperienceSamplingEvent::Create(element_name, GURL(), GURL());
}
@@ -82,10 +82,10 @@
decision.details = has_viewed_details();
decision.time = base::Time::Now().ToJsTime();
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(ui_element_.ToValue().release());
args->Append(decision.ToValue().release());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::EXPERIENCE_SAMPLING_PRIVATE_ON_DECISION,
api::experience_sampling_private::OnDecision::kEventName,
std::move(args)));
@@ -99,9 +99,9 @@
// any events.
if (browser_context_ && browser_context_->IsOffTheRecord())
return;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(ui_element_.ToValue().release());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::EXPERIENCE_SAMPLING_PRIVATE_ON_DISPLAYED,
api::experience_sampling_private::OnDisplayed::kEventName,
std::move(args)));
diff --git a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h
index 398b0c4..0283c444 100644
--- a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h
+++ b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h
@@ -36,12 +36,12 @@
// The Create() functions can return an empty scoped_ptr if they cannot find
// the BrowserContext. Code using them should check the scoped pointer using
// scoped_ptr::get().
- static scoped_ptr<ExperienceSamplingEvent> Create(
+ static std::unique_ptr<ExperienceSamplingEvent> Create(
const std::string& element_name,
const GURL& destination,
const GURL& referrer);
- static scoped_ptr<ExperienceSamplingEvent> Create(
+ static std::unique_ptr<ExperienceSamplingEvent> Create(
const std::string& element_name);
ExperienceSamplingEvent(const std::string& element_name,
diff --git a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling_private_api_unittest.cc b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling_private_api_unittest.cc
index 6f96a246..8cc23994 100644
--- a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling_private_api_unittest.cc
@@ -18,8 +18,9 @@
// field trials and groups.
TEST_F(ExperienceSamplingPrivateTest, GetBrowserInfoTest) {
// Start with an empty FieldTrialList.
- scoped_ptr<base::FieldTrialList> trial_list(new base::FieldTrialList(NULL));
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
+ std::unique_ptr<base::FieldTrialList> trial_list(
+ new base::FieldTrialList(NULL));
+ std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
new ExperienceSamplingPrivateGetBrowserInfoFunction(), "[]"));
ASSERT_TRUE(result->HasKey("variations"));
std::string trials_string;
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index a0da086..0ae5d37 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -123,7 +123,7 @@
}
private:
- scoped_ptr<BrowserActionTestUtil> browser_action_test_util_;
+ std::unique_ptr<BrowserActionTestUtil> browser_action_test_util_;
DISALLOW_COPY_AND_ASSIGN(BrowserActionApiTest);
};
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_browsertest.cc b/chrome/browser/extensions/api/extension_action/browser_action_browsertest.cc
index 555e7faf..d474eff 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_browsertest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_browsertest.cc
@@ -26,7 +26,7 @@
const char kExtensionName[] = "Default Persistence Test Extension";
void QuitMessageLoop(content::MessageLoopRunner* runner,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
runner->Quit();
}
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
index 4c57cf7a..7b3041b 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
@@ -234,7 +234,7 @@
}
if (event_name) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(
ExtensionTabUtil::CreateTabObject(web_contents)->ToValue().release());
@@ -279,11 +279,11 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
+ std::unique_ptr<base::ListValue> event_args) {
if (!EventRouter::Get(context))
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(event_args)));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.h b/chrome/browser/extensions/api/extension_action/extension_action_api.h
index f6c5d58..070b6686 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.h
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.h
@@ -118,7 +118,7 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
// BrowserContextKeyedAPI implementation.
void Shutdown() override;
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_prefs_unittest.cc b/chrome/browser/extensions/api/extension_action/extension_action_prefs_unittest.cc
index d307196..80a80a9 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_prefs_unittest.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_prefs_unittest.cc
@@ -55,7 +55,7 @@
}
private:
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ExtensionList extensions_;
DISALLOW_COPY_AND_ASSIGN(ExtensionPrefsHidingBrowserActions);
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
index 1772b04..5edd22b 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
+++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
@@ -4,11 +4,12 @@
#include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h"
+#include <memory>
#include <utility>
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/statistics_recorder.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -92,8 +93,8 @@
if (browser_context_ && EventRouter::Get(browser_context_)) {
FeedbackInfo info;
info.description = description_template;
- info.category_tag = make_scoped_ptr(new std::string(category_tag));
- info.page_url = make_scoped_ptr(new std::string(page_url.spec()));
+ info.category_tag = base::WrapUnique(new std::string(category_tag));
+ info.page_url = base::WrapUnique(new std::string(page_url.spec()));
info.system_information.reset(new SystemInformationList);
// The manager is only available if tracing is enabled.
if (TracingManager* manager = TracingManager::Get()) {
@@ -101,10 +102,10 @@
}
info.flow = flow;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
feedback_private::OnFeedbackRequested::Create(info);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::FEEDBACK_PRIVATE_ON_FEEDBACK_REQUESTED,
feedback_private::OnFeedbackRequested::kEventName, std::move(args)));
event->restrict_to_browser_context = browser_context_;
@@ -191,7 +192,7 @@
}
bool FeedbackPrivateSendFeedbackFunction::RunAsync() {
- scoped_ptr<feedback_private::SendFeedback::Params> params(
+ std::unique_ptr<feedback_private::SendFeedback::Params> params(
feedback_private::SendFeedback::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -232,7 +233,7 @@
feedback_data->set_trace_id(*feedback_info.trace_id.get());
}
- scoped_ptr<FeedbackData::SystemLogsMap> sys_logs(
+ std::unique_ptr<FeedbackData::SystemLogsMap> sys_logs(
new FeedbackData::SystemLogsMap);
SystemInformationList* sys_info = feedback_info.system_information.get();
if (sys_info) {
@@ -246,7 +247,7 @@
DCHECK(service);
if (feedback_info.send_histograms) {
- scoped_ptr<std::string> histograms(new std::string);
+ std::unique_ptr<std::string> histograms(new std::string);
*histograms = base::StatisticsRecorder::ToJSON(std::string());
if (!histograms->empty())
feedback_data->SetAndCompressHistograms(std::move(histograms));
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_service.cc b/chrome/browser/extensions/api/feedback_private/feedback_service.cc
index 13a7cbd..18c46b8 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_service.cc
+++ b/chrome/browser/extensions/api/feedback_private/feedback_service.cc
@@ -82,7 +82,7 @@
void FeedbackService::AttachedFileCallback(
scoped_refptr<feedback::FeedbackData> feedback_data,
const SendFeedbackCallback& callback,
- scoped_ptr<std::string> data,
+ std::unique_ptr<std::string> data,
int64_t /* total_blob_length */) {
feedback_data->set_attached_file_uuid(std::string());
if (data)
@@ -94,7 +94,7 @@
void FeedbackService::ScreenshotCallback(
scoped_refptr<feedback::FeedbackData> feedback_data,
const SendFeedbackCallback& callback,
- scoped_ptr<std::string> data,
+ std::unique_ptr<std::string> data,
int64_t /* total_blob_length */) {
feedback_data->set_screenshot_uuid(std::string());
if (data)
@@ -105,7 +105,7 @@
void FeedbackService::OnSystemLogsFetchComplete(
const GetSystemInformationCallback& callback,
- scoped_ptr<system_logs::SystemLogsResponse> sys_info_map) {
+ std::unique_ptr<system_logs::SystemLogsResponse> sys_info_map) {
SystemInformationList sys_info_list;
if (sys_info_map.get()) {
for (const auto& itr : *sys_info_map)
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_service.h b/chrome/browser/extensions/api/feedback_private/feedback_service.h
index 19211430..5becf7a 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_service.h
+++ b/chrome/browser/extensions/api/feedback_private/feedback_service.h
@@ -50,16 +50,16 @@
// Callbacks to receive blob data.
void AttachedFileCallback(scoped_refptr<feedback::FeedbackData> feedback_data,
const SendFeedbackCallback& callback,
- scoped_ptr<std::string> data,
+ std::unique_ptr<std::string> data,
int64_t total_blob_length);
void ScreenshotCallback(scoped_refptr<feedback::FeedbackData> feedback_data,
const SendFeedbackCallback& callback,
- scoped_ptr<std::string> data,
+ std::unique_ptr<std::string> data,
int64_t total_blob_length);
void OnSystemLogsFetchComplete(
const GetSystemInformationCallback& callback,
- scoped_ptr<system_logs::SystemLogsResponse> sys_info);
+ std::unique_ptr<system_logs::SystemLogsResponse> sys_info);
// Checks if we have read all the blobs we need to; signals the feedback
// data object once all the requisite data has been populated.
diff --git a/chrome/browser/extensions/api/file_handlers/directory_util.cc b/chrome/browser/extensions/api/file_handlers/directory_util.cc
index 6076209..6d08f59 100644
--- a/chrome/browser/extensions/api/file_handlers/directory_util.cc
+++ b/chrome/browser/extensions/api/file_handlers/directory_util.cc
@@ -28,7 +28,7 @@
}
void OnGetIsDirectoryFromFileInfoCompleted(
- scoped_ptr<bool> is_directory,
+ std::unique_ptr<bool> is_directory,
const base::Callback<void(bool)>& callback) {
callback.Run(*is_directory);
}
@@ -46,7 +46,7 @@
}
#endif
- scoped_ptr<bool> is_directory(new bool);
+ std::unique_ptr<bool> is_directory(new bool);
bool* const is_directory_ptr = is_directory.get();
content::BrowserThread::PostBlockingPoolTaskAndReply(
diff --git a/chrome/browser/extensions/api/file_handlers/directory_util.h b/chrome/browser/extensions/api/file_handlers/directory_util.h
index ec87d01..5ed26be 100644
--- a/chrome/browser/extensions/api/file_handlers/directory_util.h
+++ b/chrome/browser/extensions/api/file_handlers/directory_util.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_DIRECTORY_UTIL_H_
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
class Profile;
@@ -29,7 +29,7 @@
class IsDirectoryCollector {
public:
- typedef base::Callback<void(scoped_ptr<std::set<base::FilePath>>)>
+ typedef base::Callback<void(std::unique_ptr<std::set<base::FilePath>>)>
CompletionCallback;
explicit IsDirectoryCollector(Profile* profile);
@@ -45,7 +45,7 @@
Profile* profile_;
std::vector<base::FilePath> paths_;
- scoped_ptr<std::set<base::FilePath>> result_;
+ std::unique_ptr<std::set<base::FilePath>> result_;
size_t left_;
CompletionCallback callback_;
base::WeakPtrFactory<IsDirectoryCollector> weak_ptr_factory_;
diff --git a/chrome/browser/extensions/api/file_handlers/directory_util_unittest.cc b/chrome/browser/extensions/api/file_handlers/directory_util_unittest.cc
index 0e55d74..c9549c1 100644
--- a/chrome/browser/extensions/api/file_handlers/directory_util_unittest.cc
+++ b/chrome/browser/extensions/api/file_handlers/directory_util_unittest.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/api/file_handlers/directory_util.h"
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/browser_thread.h"
@@ -26,7 +26,7 @@
void OnCollectForEntriesPath(
std::set<base::FilePath>* output,
- scoped_ptr<std::set<base::FilePath>> path_directory_set) {
+ std::unique_ptr<std::set<base::FilePath>> path_directory_set) {
*output = *path_directory_set;
}
diff --git a/chrome/browser/extensions/api/file_handlers/mime_util.cc b/chrome/browser/extensions/api/file_handlers/mime_util.cc
index 862eaba..6cb4ebf 100644
--- a/chrome/browser/extensions/api/file_handlers/mime_util.cc
+++ b/chrome/browser/extensions/api/file_handlers/mime_util.cc
@@ -52,7 +52,7 @@
// Converts a result passed as a scoped pointer to a dereferenced value passed
// to |callback|.
void OnGetMimeTypeFromFileForNonNativeLocalPathCompleted(
- scoped_ptr<std::string> mime_type,
+ std::unique_ptr<std::string> mime_type,
const base::Callback<void(const std::string&)>& callback) {
callback.Run(*mime_type);
}
@@ -72,7 +72,7 @@
// MIME type not available with metadata, hence try to guess it from the
// file's extension.
- scoped_ptr<std::string> mime_type_from_extension(new std::string);
+ std::unique_ptr<std::string> mime_type_from_extension(new std::string);
std::string* const mime_type_from_extension_ptr =
mime_type_from_extension.get();
BrowserThread::PostBlockingPoolTaskAndReply(
@@ -88,7 +88,7 @@
// Called when sniffing for MIME type in the native local file is completed.
void OnSniffMimeTypeForNativeLocalPathCompleted(
- scoped_ptr<std::string> mime_type,
+ std::unique_ptr<std::string> mime_type,
const base::Callback<void(const std::string&)>& callback) {
// Do not return application/zip as sniffed result. If the file has .zip
// extension, it should be already returned as application/zip. If the file
@@ -109,14 +109,14 @@
// to sniffing.
void OnGetMimeTypeFromFileForNativeLocalPathCompleted(
const base::FilePath& local_path,
- scoped_ptr<std::string> mime_type,
+ std::unique_ptr<std::string> mime_type,
const base::Callback<void(const std::string&)>& callback) {
if (!mime_type->empty()) {
callback.Run(*mime_type);
return;
}
- scoped_ptr<std::string> sniffed_mime_type(
+ std::unique_ptr<std::string> sniffed_mime_type(
new std::string(kMimeTypeApplicationOctetStream));
std::string* const sniffed_mime_type_ptr = sniffed_mime_type.get();
BrowserThread::PostBlockingPoolTaskAndReply(
@@ -149,7 +149,7 @@
// For native local files, try to guess the mime from the extension. If
// not available, then try to sniff if.
- scoped_ptr<std::string> mime_type_from_extension(new std::string);
+ std::unique_ptr<std::string> mime_type_from_extension(new std::string);
std::string* const mime_type_from_extension_ptr =
mime_type_from_extension.get();
BrowserThread::PostBlockingPoolTaskAndReply(
diff --git a/chrome/browser/extensions/api/file_handlers/mime_util.h b/chrome/browser/extensions/api/file_handlers/mime_util.h
index 2f1e7c69..e192664 100644
--- a/chrome/browser/extensions/api/file_handlers/mime_util.h
+++ b/chrome/browser/extensions/api/file_handlers/mime_util.h
@@ -9,12 +9,12 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
class Profile;
@@ -43,7 +43,7 @@
// available, then an empty string is returned in the result vector.
class MimeTypeCollector {
public:
- typedef base::Callback<void(scoped_ptr<std::vector<std::string> >)>
+ typedef base::Callback<void(std::unique_ptr<std::vector<std::string>>)>
CompletionCallback;
explicit MimeTypeCollector(Profile* profile);
@@ -64,7 +64,7 @@
void OnMimeTypeCollected(size_t index, const std::string& mime_type);
Profile* profile_;
- scoped_ptr<std::vector<std::string> > result_;
+ std::unique_ptr<std::vector<std::string>> result_;
size_t left_;
CompletionCallback callback_;
base::WeakPtrFactory<MimeTypeCollector> weak_ptr_factory_;
diff --git a/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc b/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc
index bc34cc2..defec7f 100644
--- a/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc
+++ b/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/extensions/api/file_handlers/mime_util.h"
+#include <memory>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/browser_thread.h"
@@ -32,8 +32,9 @@
}
// Saves returned mime types to a vector.
-void OnMimeTypesCollected(std::vector<std::string>* output,
- scoped_ptr<std::vector<std::string> > mime_types) {
+void OnMimeTypesCollected(
+ std::vector<std::string>* output,
+ std::unique_ptr<std::vector<std::string>> mime_types) {
*output = *mime_types;
}
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index bcbca161..9a166c0 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -16,6 +16,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -213,14 +214,15 @@
#endif
};
-typedef base::Callback<void(scoped_ptr<base::File::Info>)> FileInfoOptCallback;
+typedef base::Callback<void(std::unique_ptr<base::File::Info>)>
+ FileInfoOptCallback;
// Passes optional file info to the UI thread depending on |result| and |info|.
void PassFileInfoToUIThread(const FileInfoOptCallback& callback,
base::File::Error result,
const base::File::Info& info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- scoped_ptr<base::File::Info> file_info(
+ std::unique_ptr<base::File::Info> file_info(
result == base::File::FILE_OK ? new base::File::Info(info) : NULL);
content::BrowserThread::PostTask(
content::BrowserThread::UI,
@@ -316,7 +318,7 @@
continue;
event_router->DispatchEventToExtension(
extension->id(),
- make_scoped_ptr(new Event(
+ base::WrapUnique(new Event(
events::FILE_SYSTEM_ON_VOLUME_LIST_CHANGED,
api::file_system::OnVolumeListChanged::kEventName,
api::file_system::OnVolumeListChanged::Create(event_args))));
@@ -1044,7 +1046,8 @@
}
bool FileSystemChooseEntryFunction::RunAsync() {
- scoped_ptr<ChooseEntry::Params> params(ChooseEntry::Params::Create(*args_));
+ std::unique_ptr<ChooseEntry::Params> params(
+ ChooseEntry::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
base::FilePath suggested_name;
@@ -1182,7 +1185,7 @@
void FileSystemRetainEntryFunction::RetainFileEntry(
const std::string& entry_id,
const base::FilePath& path,
- scoped_ptr<base::File::Info> file_info) {
+ std::unique_ptr<base::File::Info> file_info) {
if (!file_info) {
SendResponse(false);
return;
@@ -1251,7 +1254,7 @@
#if !defined(OS_CHROMEOS)
ExtensionFunction::ResponseAction FileSystemRequestFileSystemFunction::Run() {
using api::file_system::RequestFileSystem::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
NOTIMPLEMENTED();
@@ -1273,7 +1276,7 @@
ExtensionFunction::ResponseAction FileSystemRequestFileSystemFunction::Run() {
using api::file_system::RequestFileSystem::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
// Only kiosk apps in kiosk sessions can use this API.
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.h b/chrome/browser/extensions/api/file_system/file_system_api.h
index d1693d8c..5034de81 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.h
+++ b/chrome/browser/extensions/api/file_system/file_system_api.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
@@ -297,7 +297,7 @@
// be obtained.
void RetainFileEntry(const std::string& entry_id,
const base::FilePath& path,
- scoped_ptr<base::File::Info> file_info);
+ std::unique_ptr<base::File::Info> file_info);
};
class FileSystemIsRestorableFunction : public ChromeSyncExtensionFunction {
diff --git a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc
index da57b51..2a7f36a 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc
@@ -177,10 +177,11 @@
protected:
base::WeakPtr<Volume> volume_;
- scoped_ptr<TestingPrefServiceSimple> testing_pref_service_;
+ std::unique_ptr<TestingPrefServiceSimple> testing_pref_service_;
chromeos::FakeChromeUserManager*
user_manager_; // Owned by the scope enabler.
- scoped_ptr<chromeos::ScopedUserManagerEnabler> scoped_user_manager_enabler_;
+ std::unique_ptr<chromeos::ScopedUserManagerEnabler>
+ scoped_user_manager_enabler_;
content::TestBrowserThreadBundle thread_bundle_;
};
#endif
diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
index d56001d..aea16aa3 100644
--- a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
@@ -129,7 +129,7 @@
void SetUpOnMainThread() override {
PlatformAppBrowserTest::SetUpOnMainThread();
- scoped_ptr<drive::ResourceEntry> entry;
+ std::unique_ptr<drive::ResourceEntry> entry;
drive::FileError error = drive::FILE_ERROR_FAILED;
integration_service_->file_system()->GetResourceEntry(
base::FilePath::FromUTF8Unsafe("drive/root"), // whatever
@@ -178,7 +178,7 @@
bool AddTestFile(const std::string& title,
const std::string& data,
const std::string& parent_id) {
- scoped_ptr<google_apis::FileResource> entry;
+ std::unique_ptr<google_apis::FileResource> entry;
google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
fake_drive_service_->AddNewFile(
"text/plain", data, parent_id, title, false,
@@ -189,7 +189,7 @@
std::string AddTestDirectory(const std::string& title,
const std::string& parent_id) {
- scoped_ptr<google_apis::FileResource> entry;
+ std::unique_ptr<google_apis::FileResource> entry;
google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
fake_drive_service_->AddNewDirectory(
parent_id, title, drive::AddNewDirectoryOptions(),
@@ -203,7 +203,7 @@
drive::DriveIntegrationService* integration_service_;
drive::DriveIntegrationServiceFactory::FactoryCallback
create_drive_integration_service_;
- scoped_ptr<drive::DriveIntegrationServiceFactory::ScopedFactoryForTest>
+ std::unique_ptr<drive::DriveIntegrationServiceFactory::ScopedFactoryForTest>
service_factory_for_test_;
};
@@ -238,7 +238,7 @@
protected:
base::ScopedTempDir temp_dir_;
chromeos::FakeChromeUserManager* fake_user_manager_;
- scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
+ std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
// Creates a testing file system in a testing directory.
void CreateTestingFileSystem(const std::string& mount_point_name,
diff --git a/chrome/browser/extensions/api/file_system/request_file_system_notification.cc b/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
index e77e316..7c91036 100644
--- a/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
+++ b/chrome/browser/extensions/api/file_system/request_file_system_notification.cc
@@ -29,7 +29,7 @@
// Extension icon size for the notification.
const int kIconSize = 48;
-scoped_ptr<Notification> CreateAutoGrantedNotification(
+std::unique_ptr<Notification> CreateAutoGrantedNotification(
const extensions::Extension& extension,
const base::WeakPtr<Volume>& volume,
bool writable,
@@ -38,7 +38,7 @@
// If the volume is gone, then do not show the notification.
if (!volume.get())
- return scoped_ptr<Notification>(nullptr);
+ return std::unique_ptr<Notification>(nullptr);
const std::string notification_id =
extension.id() + "-" + volume->volume_id();
@@ -55,7 +55,7 @@
: IDS_FILE_SYSTEM_REQUEST_FILE_SYSTEM_NOTIFICATION_MESSAGE,
display_name);
- scoped_ptr<Notification> notification(new Notification(
+ std::unique_ptr<Notification> notification(new Notification(
message_center::NOTIFICATION_TYPE_SIMPLE, notification_id,
base::UTF8ToUTF16(extension.name()), message,
gfx::Image(), // Updated asynchronously later.
@@ -80,7 +80,7 @@
scoped_refptr<RequestFileSystemNotification>
request_file_system_notification = make_scoped_refptr(
new RequestFileSystemNotification(profile, extension));
- scoped_ptr<message_center::Notification> notification(
+ std::unique_ptr<message_center::Notification> notification(
CreateAutoGrantedNotification(
extension, volume, writable,
request_file_system_notification.get() /* delegate */));
@@ -112,7 +112,7 @@
}
void RequestFileSystemNotification::Show(
- scoped_ptr<Notification> notification) {
+ std::unique_ptr<Notification> notification) {
pending_notification_.reset(notification.release());
// If the extension icon is not known yet, then defer showing the notification
// until it is (from SetAppImage).
diff --git a/chrome/browser/extensions/api/file_system/request_file_system_notification.h b/chrome/browser/extensions/api/file_system/request_file_system_notification.h
index d98d7ee1..2528531 100644
--- a/chrome/browser/extensions/api/file_system/request_file_system_notification.h
+++ b/chrome/browser/extensions/api/file_system/request_file_system_notification.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_NOTIFICATION_H_
#define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_NOTIFICATION_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/app_icon_loader.h"
#include "ui/message_center/notification_delegate.h"
@@ -51,15 +51,15 @@
~RequestFileSystemNotification() override;
// Shows the notification. Can be called only once.
- void Show(scoped_ptr<message_center::Notification> notification);
+ void Show(std::unique_ptr<message_center::Notification> notification);
// AppIconLoaderDelegate overrides:
void OnAppImageUpdated(const std::string& id,
const gfx::ImageSkia& image) override;
- scoped_ptr<AppIconLoader> icon_loader_;
- scoped_ptr<gfx::Image> extension_icon_;
- scoped_ptr<message_center::Notification> pending_notification_;
+ std::unique_ptr<AppIconLoader> icon_loader_;
+ std::unique_ptr<gfx::Image> extension_icon_;
+ std::unique_ptr<message_center::Notification> pending_notification_;
DISALLOW_COPY_AND_ASSIGN(RequestFileSystemNotification);
};
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
index 0859c77..cce471f 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
@@ -230,7 +230,7 @@
return false;
}
- scoped_ptr<fonts::ClearFont::Params> params(
+ std::unique_ptr<fonts::ClearFont::Params> params(
fonts::ClearFont::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -247,7 +247,7 @@
}
bool FontSettingsGetFontFunction::RunSync() {
- scoped_ptr<fonts::GetFont::Params> params(
+ std::unique_ptr<fonts::GetFont::Params> params(
fonts::GetFont::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -283,7 +283,7 @@
return false;
}
- scoped_ptr<fonts::SetFont::Params> params(
+ std::unique_ptr<fonts::SetFont::Params> params(
fonts::SetFont::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -309,14 +309,14 @@
}
void FontSettingsGetFontListFunction::FontListHasLoaded(
- scoped_ptr<base::ListValue> list) {
+ std::unique_ptr<base::ListValue> list) {
bool success = CopyFontsToResult(list.get());
SendResponse(success);
}
bool FontSettingsGetFontListFunction::CopyFontsToResult(
base::ListValue* fonts) {
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
for (base::ListValue::iterator it = fonts->begin();
it != fonts->end(); ++it) {
base::ListValue* font_list_value;
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.h b/chrome/browser/extensions/api/font_settings/font_settings_api.h
index 54239913..4f62fc1 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.h
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h
@@ -8,10 +8,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
@@ -95,7 +95,7 @@
}
static const bool kServiceIsNULLWhileTesting = true;
- scoped_ptr<FontSettingsEventRouter> font_settings_event_router_;
+ std::unique_ptr<FontSettingsEventRouter> font_settings_event_router_;
};
// fontSettings.clearFont API function.
@@ -149,7 +149,7 @@
bool RunAsync() override;
private:
- void FontListHasLoaded(scoped_ptr<base::ListValue> list);
+ void FontListHasLoaded(std::unique_ptr<base::ListValue> list);
bool CopyFontsToResult(base::ListValue* fonts);
};
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
index c0844f6f..f9c7d42 100644
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
@@ -73,7 +73,7 @@
void RemoveSession(int session_id);
void RemoveSessionDelayed(int session_id);
- scoped_ptr<base::ListValue> GetPrefetchedSSIDList();
+ std::unique_ptr<base::ListValue> GetPrefetchedSSIDList();
private:
typedef std::map<std::string /* ssid */, std::string /* password */>
@@ -179,7 +179,7 @@
const base::DictionaryValue& input,
const MessageResponseCallback& callback) {
const base::DictionaryValue* input_actual = &input;
- scoped_ptr<base::DictionaryValue> input_cloned;
+ std::unique_ptr<base::DictionaryValue> input_cloned;
if (api == kPrivatAPISetup) {
const base::DictionaryValue* wifi = NULL;
@@ -221,8 +221,8 @@
weak_ptr_factory_.GetWeakPtr(), session_id));
}
-scoped_ptr<base::ListValue> GcdPrivateAPIImpl::GetPrefetchedSSIDList() {
- scoped_ptr<base::ListValue> retval(new base::ListValue);
+std::unique_ptr<base::ListValue> GcdPrivateAPIImpl::GetPrefetchedSSIDList() {
+ std::unique_ptr<base::ListValue> retval(new base::ListValue);
return retval;
}
@@ -249,7 +249,7 @@
}
bool GcdPrivateGetDeviceInfoFunction::RunAsync() {
- scoped_ptr<gcd_private::CreateSession::Params> params =
+ std::unique_ptr<gcd_private::CreateSession::Params> params =
gcd_private::CreateSession::Params::Create(*args_);
if (!params)
@@ -285,7 +285,7 @@
}
bool GcdPrivateCreateSessionFunction::RunAsync() {
- scoped_ptr<gcd_private::CreateSession::Params> params =
+ std::unique_ptr<gcd_private::CreateSession::Params> params =
gcd_private::CreateSession::Params::Create(*args_);
if (!params)
@@ -336,7 +336,7 @@
}
bool GcdPrivateStartPairingFunction::RunAsync() {
- scoped_ptr<gcd_private::StartPairing::Params> params =
+ std::unique_ptr<gcd_private::StartPairing::Params> params =
gcd_private::StartPairing::Params::Create(*args_);
if (!params)
@@ -364,7 +364,7 @@
}
bool GcdPrivateConfirmCodeFunction::RunAsync() {
- scoped_ptr<gcd_private::ConfirmCode::Params> params =
+ std::unique_ptr<gcd_private::ConfirmCode::Params> params =
gcd_private::ConfirmCode::Params::Create(*args_);
if (!params)
@@ -392,7 +392,7 @@
}
bool GcdPrivateSendMessageFunction::RunAsync() {
- scoped_ptr<gcd_private::PassMessage::Params> params =
+ std::unique_ptr<gcd_private::PassMessage::Params> params =
gcd_private::PassMessage::Params::Create(*args_);
if (!params)
@@ -427,7 +427,7 @@
}
bool GcdPrivateTerminateSessionFunction::RunAsync() {
- scoped_ptr<gcd_private::TerminateSession::Params> params =
+ std::unique_ptr<gcd_private::TerminateSession::Params> params =
gcd_private::TerminateSession::Params::Create(*args_);
if (!params)
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_api.h b/chrome/browser/extensions/api/gcd_private/gcd_private_api.h
index 746e387..8898b39 100644
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_api.h
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_api.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/gcd_private.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
@@ -29,7 +30,7 @@
// BrowserContextKeyedAPI implementation.
static const char* service_name() { return "GcdPrivateAPI"; }
- scoped_ptr<GcdPrivateAPIImpl> impl_;
+ std::unique_ptr<GcdPrivateAPIImpl> impl_;
};
class GcdPrivateGetDeviceInfoFunction : public ChromeAsyncExtensionFunction {
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc
index 89bff03..485aad4 100644
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc
@@ -91,13 +91,13 @@
"ddchlicdkolnonkihahngkmmmjnjlkkf");
}
- scoped_ptr<net::FakeURLFetcher> CreateFakeURLFetcher(
+ std::unique_ptr<net::FakeURLFetcher> CreateFakeURLFetcher(
const GURL& url,
net::URLFetcherDelegate* fetcher_delegate,
const std::string& response_data,
net::HttpStatusCode response_code,
net::URLRequestStatus::Status status) {
- scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
+ std::unique_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
url, fetcher_delegate, response_data, response_code, status));
scoped_refptr<net::HttpResponseHeaders> headers =
new net::HttpResponseHeaders("");
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc
index b413462..2d902f2 100644
--- a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "chrome/common/chrome_content_client.h"
#include "net/base/net_errors.h"
#include "net/cert/cert_verifier.h"
@@ -30,7 +31,7 @@
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
const net::CompletionCallback& callback,
- scoped_ptr<Request>* out_req,
+ std::unique_ptr<Request>* out_req,
const net::BoundNetLog& net_log) override {
verify_result->Reset();
verify_result->verified_cert = cert;
@@ -108,7 +109,7 @@
builder.SetSpdyAndQuicEnabled(false, false);
builder.DisableHttpCache();
cert_verifier_ = new CertVerifier();
- builder.SetCertVerifier(make_scoped_ptr(cert_verifier_));
+ builder.SetCertVerifier(base::WrapUnique(cert_verifier_));
builder.set_user_agent(::GetUserAgent());
context_ = builder.Build();
}
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h
index f64cad4..517b258 100644
--- a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h
@@ -5,9 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_CONTEXT_GETTER_H_
#define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_CONTEXT_GETTER_H_
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "net/url_request/url_request_context_getter.h"
@@ -50,7 +51,7 @@
// Owned by context_
CertVerifier* cert_verifier_ = nullptr;
- scoped_ptr<net::URLRequestContext> context_;
+ std::unique_ptr<net::URLRequestContext> context_;
scoped_refptr<base::SingleThreadTaskRunner> net_task_runner_;
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter_unittest.cc b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter_unittest.cc
index 0294c4e..64c2577 100644
--- a/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter_unittest.cc
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_context_getter_unittest.cc
@@ -85,8 +85,8 @@
net::URLRequestStatus status_ = net::URLRequestStatus();
content::TestBrowserThreadBundle thread_bundle_;
scoped_refptr<extensions::PrivetV3ContextGetter> context_getter_;
- scoped_ptr<EmbeddedTestServer> server_;
- scoped_ptr<net::URLFetcher> fetcher_;
+ std::unique_ptr<EmbeddedTestServer> server_;
+ std::unique_ptr<net::URLFetcher> fetcher_;
base::Closure quit_;
};
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_session.cc b/chrome/browser/extensions/api/gcd_private/privet_v3_session.cc
index 6074cd87..957dcc2 100644
--- a/chrome/browser/extensions/api/gcd_private/privet_v3_session.cc
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_session.cc
@@ -86,7 +86,7 @@
return false;
}
-scoped_ptr<base::DictionaryValue> GetJson(const net::URLFetcher* source) {
+std::unique_ptr<base::DictionaryValue> GetJson(const net::URLFetcher* source) {
if (!source->GetStatus().is_success())
return nullptr;
@@ -128,7 +128,7 @@
void ReplyAndDestroyItself(Result result, const base::DictionaryValue& value);
void OnTimeout();
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
base::WeakPtr<PrivetV3Session> session_;
MessageCallback callback_;
@@ -152,7 +152,7 @@
<< ", error: " << source->GetStatus().error()
<< ", response code: " << source->GetResponseCode();
- scoped_ptr<base::DictionaryValue> value = GetJson(source);
+ std::unique_ptr<base::DictionaryValue> value = GetJson(source);
if (!value) {
return ReplyAndDestroyItself(Result::STATUS_CONNECTIONERROR,
base::DictionaryValue());
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_session.h b/chrome/browser/extensions/api/gcd_private/privet_v3_session.h
index 45445854..f653959b 100644
--- a/chrome/browser/extensions/api/gcd_private/privet_v3_session.h
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_session.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "chrome/common/extensions/api/gcd_private.h"
@@ -116,7 +116,7 @@
std::string commitment_;
// Key exchange algorithm for pairing.
- scoped_ptr<crypto::P224EncryptedKeyExchange> spake_;
+ std::unique_ptr<crypto::P224EncryptedKeyExchange> spake_;
// HTTPS port of the device.
uint16_t https_port_ = 0;
diff --git a/chrome/browser/extensions/api/gcd_private/privet_v3_session_unittest.cc b/chrome/browser/extensions/api/gcd_private/privet_v3_session_unittest.cc
index b99877a..14132ff 100644
--- a/chrome/browser/extensions/api/gcd_private/privet_v3_session_unittest.cc
+++ b/chrome/browser/extensions/api/gcd_private/privet_v3_session_unittest.cc
@@ -78,13 +78,13 @@
base::Bind(&PrivetV3SessionTest::OnPostData, base::Unretained(this));
}
- scoped_ptr<net::FakeURLFetcher> CreateFakeURLFetcher(
+ std::unique_ptr<net::FakeURLFetcher> CreateFakeURLFetcher(
const GURL& url,
net::URLFetcherDelegate* fetcher_delegate,
const std::string& response_data,
net::HttpStatusCode response_code,
net::URLRequestStatus::Status status) {
- scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
+ std::unique_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
url, fetcher_delegate, response_data, response_code, status));
scoped_refptr<net::HttpResponseHeaders> headers =
new net::HttpResponseHeaders("");
@@ -96,7 +96,7 @@
content::TestBrowserThreadBundle thread_bundle_;
net::FakeURLFetcherFactory fetcher_factory_;
base::DictionaryValue info_;
- scoped_ptr<PrivetV3Session> session_;
+ std::unique_ptr<PrivetV3Session> session_;
};
TEST_F(PrivetV3SessionTest, InitError) {
diff --git a/chrome/browser/extensions/api/gcm/gcm_api.cc b/chrome/browser/extensions/api/gcm/gcm_api.cc
index abb68abb..cebe90e 100644
--- a/chrome/browser/extensions/api/gcm/gcm_api.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_api.cc
@@ -112,7 +112,7 @@
GcmRegisterFunction::~GcmRegisterFunction() {}
bool GcmRegisterFunction::DoWork() {
- scoped_ptr<api::gcm::Register::Params> params(
+ std::unique_ptr<api::gcm::Register::Params> params(
api::gcm::Register::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -157,7 +157,7 @@
GcmSendFunction::~GcmSendFunction() {}
bool GcmSendFunction::DoWork() {
- scoped_ptr<api::gcm::Send::Params> params(
+ std::unique_ptr<api::gcm::Send::Params> params(
api::gcm::Send::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
EXTENSION_FUNCTION_VALIDATE(
@@ -217,7 +217,7 @@
if (!message.collapse_key.empty())
message_arg.collapse_key.reset(new std::string(message.collapse_key));
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::GCM_ON_MESSAGE, api::gcm::OnMessage::kEventName,
api::gcm::OnMessage::Create(message_arg), profile_));
EventRouter::Get(profile_)
@@ -225,7 +225,7 @@
}
void GcmJsEventRouter::OnMessagesDeleted(const std::string& app_id) {
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::GCM_ON_MESSAGES_DELETED, api::gcm::OnMessagesDeleted::kEventName,
api::gcm::OnMessagesDeleted::Create(), profile_));
EventRouter::Get(profile_)
@@ -240,7 +240,7 @@
error.error_message = GcmResultToError(send_error_details.result);
error.details.additional_properties = send_error_details.additional_data;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::GCM_ON_SEND_ERROR, api::gcm::OnSendError::kEventName,
api::gcm::OnSendError::Create(error), profile_));
EventRouter::Get(profile_)
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc
index 5de2840..34a61d98 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/history/history_api.h"
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -13,7 +14,6 @@
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -143,7 +143,8 @@
const history::URLRow& row,
const history::RedirectList& redirects,
base::Time visit_time) {
- scoped_ptr<base::ListValue> args = OnVisited::Create(GetHistoryItem(row));
+ std::unique_ptr<base::ListValue> args =
+ OnVisited::Create(GetHistoryItem(row));
DispatchEvent(profile_, events::HISTORY_ON_VISITED,
api::history::OnVisited::kEventName, std::move(args));
}
@@ -161,17 +162,18 @@
urls->push_back(row.url().spec());
removed.urls.reset(urls);
- scoped_ptr<base::ListValue> args = OnVisitRemoved::Create(removed);
+ std::unique_ptr<base::ListValue> args = OnVisitRemoved::Create(removed);
DispatchEvent(profile_, events::HISTORY_ON_VISIT_REMOVED,
api::history::OnVisitRemoved::kEventName, std::move(args));
}
-void HistoryEventRouter::DispatchEvent(Profile* profile,
- events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
+void HistoryEventRouter::DispatchEvent(
+ Profile* profile,
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args) {
if (profile && EventRouter::Get(profile)) {
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(event_args)));
event->restrict_to_browser_context = profile;
EventRouter::Get(profile)->BroadcastEvent(std::move(event));
@@ -272,7 +274,7 @@
}
bool HistoryGetVisitsFunction::RunAsyncImpl() {
- scoped_ptr<GetVisits::Params> params(GetVisits::Params::Create(*args_));
+ std::unique_ptr<GetVisits::Params> params(GetVisits::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL url;
@@ -304,7 +306,7 @@
}
bool HistorySearchFunction::RunAsyncImpl() {
- scoped_ptr<Search::Params> params(Search::Params::Create(*args_));
+ std::unique_ptr<Search::Params> params(Search::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
base::string16 search_text = base::UTF8ToUTF16(params->query.text);
@@ -342,7 +344,7 @@
}
bool HistoryAddUrlFunction::RunAsync() {
- scoped_ptr<AddUrl::Params> params(AddUrl::Params::Create(*args_));
+ std::unique_ptr<AddUrl::Params> params(AddUrl::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL url;
@@ -358,7 +360,7 @@
}
bool HistoryDeleteUrlFunction::RunAsync() {
- scoped_ptr<DeleteUrl::Params> params(DeleteUrl::Params::Create(*args_));
+ std::unique_ptr<DeleteUrl::Params> params(DeleteUrl::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (!VerifyDeleteAllowed())
@@ -387,7 +389,8 @@
}
bool HistoryDeleteRangeFunction::RunAsyncImpl() {
- scoped_ptr<DeleteRange::Params> params(DeleteRange::Params::Create(*args_));
+ std::unique_ptr<DeleteRange::Params> params(
+ DeleteRange::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (!VerifyDeleteAllowed())
diff --git a/chrome/browser/extensions/api/history/history_api.h b/chrome/browser/extensions/api/history/history_api.h
index 55c48fa..bfbb01404 100644
--- a/chrome/browser/extensions/api/history/history_api.h
+++ b/chrome/browser/extensions/api/history/history_api.h
@@ -52,7 +52,7 @@
void DispatchEvent(Profile* profile,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
Profile* profile_;
ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
@@ -87,7 +87,7 @@
static const bool kServiceIsNULLWhileTesting = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<HistoryEventRouter> history_event_router_;
+ std::unique_ptr<HistoryEventRouter> history_event_router_;
};
template <>
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
index 19e3ba76..cba3f4f 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
@@ -8,6 +8,7 @@
#include <utility>
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -132,24 +133,24 @@
events::HistogramValue histogram_value,
const std::string& event_name) {
SignalEvent(histogram_value, event_name,
- make_scoped_ptr(new base::ListValue()));
+ base::WrapUnique(new base::ListValue()));
}
void HotwordPrivateEventService::SignalEvent(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
EventRouter* router = EventRouter::Get(profile_);
if (!router || !router->HasEventListener(event_name))
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
router->BroadcastEvent(std::move(event));
}
bool HotwordPrivateSetEnabledFunction::RunSync() {
- scoped_ptr<api::hotword_private::SetEnabled::Params> params(
+ std::unique_ptr<api::hotword_private::SetEnabled::Params> params(
api::hotword_private::SetEnabled::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -159,7 +160,7 @@
}
bool HotwordPrivateSetAudioLoggingEnabledFunction::RunSync() {
- scoped_ptr<api::hotword_private::SetAudioLoggingEnabled::Params> params(
+ std::unique_ptr<api::hotword_private::SetAudioLoggingEnabled::Params> params(
api::hotword_private::SetAudioLoggingEnabled::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -171,9 +172,10 @@
}
bool HotwordPrivateSetHotwordAlwaysOnSearchEnabledFunction::RunSync() {
- scoped_ptr<api::hotword_private::SetHotwordAlwaysOnSearchEnabled::Params>
- params(api::hotword_private::SetHotwordAlwaysOnSearchEnabled::Params::
- Create(*args_));
+ std::unique_ptr<api::hotword_private::SetHotwordAlwaysOnSearchEnabled::Params>
+ params(
+ api::hotword_private::SetHotwordAlwaysOnSearchEnabled::Params::Create(
+ *args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
PrefService* prefs = GetProfile()->GetPrefs();
@@ -182,7 +184,7 @@
}
bool HotwordPrivateGetStatusFunction::RunSync() {
- scoped_ptr<api::hotword_private::GetStatus::Params> params(
+ std::unique_ptr<api::hotword_private::GetStatus::Params> params(
api::hotword_private::GetStatus::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -223,7 +225,7 @@
}
bool HotwordPrivateSetHotwordSessionStateFunction::RunSync() {
- scoped_ptr<api::hotword_private::SetHotwordSessionState::Params> params(
+ std::unique_ptr<api::hotword_private::SetHotwordSessionState::Params> params(
api::hotword_private::SetHotwordSessionState::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -237,8 +239,9 @@
}
bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() {
- scoped_ptr<api::hotword_private::NotifyHotwordRecognition::Params> params(
- api::hotword_private::NotifyHotwordRecognition::Params::Create(*args_));
+ std::unique_ptr<api::hotword_private::NotifyHotwordRecognition::Params>
+ params(api::hotword_private::NotifyHotwordRecognition::Params::Create(
+ *args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
scoped_refptr<content::SpeechRecognitionSessionPreamble> preamble;
@@ -455,7 +458,7 @@
}
bool HotwordPrivateSetAudioHistoryEnabledFunction::RunAsync() {
- scoped_ptr<api::hotword_private::SetAudioHistoryEnabled::Params> params(
+ std::unique_ptr<api::hotword_private::SetAudioHistoryEnabled::Params> params(
api::hotword_private::SetAudioHistoryEnabled::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -508,8 +511,9 @@
}
bool HotwordPrivateSpeakerModelExistsResultFunction::RunSync() {
- scoped_ptr<api::hotword_private::SpeakerModelExistsResult::Params> params(
- api::hotword_private::SpeakerModelExistsResult::Params::Create(*args_));
+ std::unique_ptr<api::hotword_private::SpeakerModelExistsResult::Params>
+ params(api::hotword_private::SpeakerModelExistsResult::Params::Create(
+ *args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
HotwordService* hotword_service =
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.h b/chrome/browser/extensions/api/hotword_private/hotword_private_api.h
index 6db2891..39423ad4 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.h
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.h
@@ -54,7 +54,7 @@
const std::string& event_name);
void SignalEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args);
+ std::unique_ptr<base::ListValue> args);
Profile* profile_;
PrefChangeRegistrar pref_change_registrar_;
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
index 551b85f5..37699dff 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
@@ -2,9 +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/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -85,7 +87,7 @@
}
private:
- scoped_ptr<history::WebHistoryService> web_history_;
+ std::unique_ptr<history::WebHistoryService> web_history_;
};
class MockHotwordService : public HotwordService {
@@ -100,8 +102,8 @@
service_available_ = available;
}
- static scoped_ptr<KeyedService> Build(content::BrowserContext* profile) {
- return make_scoped_ptr(
+ static std::unique_ptr<KeyedService> Build(content::BrowserContext* profile) {
+ return base::WrapUnique(
new MockHotwordService(static_cast<Profile*>(profile)));
}
diff --git a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc
index 825c87c..d98d0fc8 100644
--- a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc
@@ -231,11 +231,9 @@
}
}
-scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) {
- return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this,
- profile_,
- url,
- WebAuthFlow::INTERACTIVE));
+std::unique_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) {
+ return std::unique_ptr<WebAuthFlow>(
+ new WebAuthFlow(this, profile_, url, WebAuthFlow::INTERACTIVE));
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
index e00847b1..7cb132a5 100644
--- a/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
+++ b/chrome/browser/extensions/api/identity/gaia_web_auth_flow.h
@@ -81,7 +81,7 @@
private:
// Creates a WebAuthFlow, which will navigate to |url|. Can override
// for testing. Used to kick off the MergeSession (step #2).
- virtual scoped_ptr<WebAuthFlow> CreateWebAuthFlow(GURL url);
+ virtual std::unique_ptr<WebAuthFlow> CreateWebAuthFlow(GURL url);
Delegate* delegate_;
Profile* profile_;
@@ -89,8 +89,8 @@
std::string redirect_scheme_;
std::string redirect_path_prefix_;
GURL auth_url_;
- scoped_ptr<UbertokenFetcher> ubertoken_fetcher_;
- scoped_ptr<WebAuthFlow> web_flow_;
+ std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_;
+ std::unique_ptr<WebAuthFlow> web_flow_;
DISALLOW_COPY_AND_ASSIGN(GaiaWebAuthFlow);
};
diff --git a/chrome/browser/extensions/api/identity/gaia_web_auth_flow_unittest.cc b/chrome/browser/extensions/api/identity/gaia_web_auth_flow_unittest.cc
index 555cff82..5f8ab3e 100644
--- a/chrome/browser/extensions/api/identity/gaia_web_auth_flow_unittest.cc
+++ b/chrome/browser/extensions/api/identity/gaia_web_auth_flow_unittest.cc
@@ -42,8 +42,8 @@
}
private:
- scoped_ptr<WebAuthFlow> CreateWebAuthFlow(GURL url) override {
- return scoped_ptr<WebAuthFlow>(new FakeWebAuthFlow(this));
+ std::unique_ptr<WebAuthFlow> CreateWebAuthFlow(GURL url) override {
+ return std::unique_ptr<WebAuthFlow>(new FakeWebAuthFlow(this));
}
GoogleServiceAuthError ubertoken_error_;
@@ -72,10 +72,10 @@
loop.RunUntilIdle(); // Run tasks so FakeWebAuthFlows get deleted.
}
- scoped_ptr<TestGaiaWebAuthFlow> CreateTestFlow() {
+ std::unique_ptr<TestGaiaWebAuthFlow> CreateTestFlow() {
ExtensionTokenKey token_key(
"extension_id", "account_id", std::set<std::string>());
- return scoped_ptr<TestGaiaWebAuthFlow>(new TestGaiaWebAuthFlow(
+ return std::unique_ptr<TestGaiaWebAuthFlow>(new TestGaiaWebAuthFlow(
&delegate_, &token_key, "fake.client.id", ubertoken_error_state_));
}
@@ -100,7 +100,7 @@
};
TEST_F(IdentityGaiaWebAuthFlowTest, OAuthError) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(delegate_, OnGaiaFlowFailure(
GaiaWebAuthFlow::OAUTH_ERROR,
@@ -110,14 +110,14 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, Token) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(delegate_, OnGaiaFlowCompleted("fake_access_token", ""));
flow->OnAuthFlowTitleChange(GetFinalTitle("access_token=fake_access_token"));
}
TEST_F(IdentityGaiaWebAuthFlowTest, TokenAndExpiration) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(delegate_, OnGaiaFlowCompleted("fake_access_token", "3600"));
flow->OnAuthFlowTitleChange(
@@ -125,7 +125,7 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, ExtraFragmentParametersSuccess) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(delegate_,
OnGaiaFlowCompleted("fake_access_token", "3600"));
@@ -139,7 +139,7 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, ExtraFragmentParametersError) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(delegate_, OnGaiaFlowFailure(
GaiaWebAuthFlow::OAUTH_ERROR,
@@ -155,7 +155,7 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, TitleSpam) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
flow->OnAuthFlowTitleChange(
"Loading https://extension_id.chromiumapp.org/#error=non_final_title");
@@ -170,7 +170,7 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, EmptyFragment) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(
delegate_,
@@ -182,7 +182,7 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, JunkFragment) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(
delegate_,
@@ -194,14 +194,14 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, NoFragment) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
// This won't be recognized as an interesting title.
flow->OnAuthFlowTitleChange("Loading id.client.fake:/extension_id");
}
TEST_F(IdentityGaiaWebAuthFlowTest, Host) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
// These won't be recognized as interesting titles.
flow->OnAuthFlowTitleChange(
@@ -215,7 +215,7 @@
TEST_F(IdentityGaiaWebAuthFlowTest, UbertokenFailure) {
set_ubertoken_error(GoogleServiceAuthError::CONNECTION_FAILED);
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
EXPECT_CALL(
delegate_,
OnGaiaFlowFailure(
@@ -226,7 +226,7 @@
}
TEST_F(IdentityGaiaWebAuthFlowTest, AuthFlowFailure) {
- scoped_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
+ std::unique_ptr<TestGaiaWebAuthFlow> flow = CreateTestFlow();
flow->Start();
EXPECT_CALL(
delegate_,
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 3155af0..52bacbb 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -247,11 +247,12 @@
api::identity::AccountInfo account_info;
account_info.id = ids.gaia;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
api::identity::OnSignInChanged::Create(account_info, is_signed_in);
- scoped_ptr<Event> event(new Event(events::IDENTITY_ON_SIGN_IN_CHANGED,
- api::identity::OnSignInChanged::kEventName,
- std::move(args), browser_context_));
+ std::unique_ptr<Event> event(
+ new Event(events::IDENTITY_ON_SIGN_IN_CHANGED,
+ api::identity::OnSignInChanged::kEventName, std::move(args),
+ browser_context_));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
@@ -326,7 +327,7 @@
return false;
}
- scoped_ptr<identity::GetAuthToken::Params> params(
+ std::unique_ptr<identity::GetAuthToken::Params> params(
identity::GetAuthToken::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
interactive_ = params->details.get() &&
@@ -932,7 +933,7 @@
return false;
}
- scoped_ptr<identity::RemoveCachedAuthToken::Params> params(
+ std::unique_ptr<identity::RemoveCachedAuthToken::Params> params(
identity::RemoveCachedAuthToken::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
IdentityAPI::GetFactoryInstance()->Get(GetProfile())->EraseCachedToken(
@@ -953,7 +954,7 @@
return false;
}
- scoped_ptr<identity::LaunchWebAuthFlow::Params> params(
+ std::unique_ptr<identity::LaunchWebAuthFlow::Params> params(
identity::LaunchWebAuthFlow::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index c0fe913..bf5d77f 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -228,7 +228,7 @@
// Exposed for testing.
virtual OAuth2MintTokenFlow* CreateMintTokenFlow();
- scoped_ptr<OAuth2TokenService::Request> login_token_request_;
+ std::unique_ptr<OAuth2TokenService::Request> login_token_request_;
private:
FRIEND_TEST_ALL_PREFIXES(GetAuthTokenFunctionTest,
@@ -290,17 +290,17 @@
bool interactive_;
bool should_prompt_for_scopes_;
IdentityMintRequestQueue::MintType mint_token_flow_type_;
- scoped_ptr<OAuth2MintTokenFlow> mint_token_flow_;
+ std::unique_ptr<OAuth2MintTokenFlow> mint_token_flow_;
OAuth2MintTokenFlow::Mode gaia_mint_token_mode_;
bool should_prompt_for_signin_;
- scoped_ptr<ExtensionTokenKey> token_key_;
+ std::unique_ptr<ExtensionTokenKey> token_key_;
std::string oauth2_client_id_;
// When launched in interactive mode, and if there is no existing grant,
// a permissions prompt will be popped up to the user.
IssueAdviceInfo issue_advice_;
- scoped_ptr<GaiaWebAuthFlow> gaia_web_auth_flow_;
- scoped_ptr<IdentitySigninFlow> signin_flow_;
+ std::unique_ptr<GaiaWebAuthFlow> gaia_web_auth_flow_;
+ std::unique_ptr<IdentitySigninFlow> signin_flow_;
};
class IdentityGetProfileUserInfoFunction
@@ -355,7 +355,7 @@
// Helper to initialize final URL prefix.
void InitFinalRedirectURLPrefix(const std::string& extension_id);
- scoped_ptr<WebAuthFlow> auth_flow_;
+ std::unique_ptr<WebAuthFlow> auth_flow_;
GURL final_url_prefix_;
};
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index 33a2980..acc987d 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -112,7 +113,7 @@
}
private:
- scoped_ptr<bool> response_;
+ std::unique_ptr<bool> response_;
bool should_post_quit_;
};
@@ -125,7 +126,7 @@
const std::string& args) {
response_delegate_.reset(new SendResponseDelegate);
function->set_test_delegate(response_delegate_.get());
- scoped_ptr<base::ListValue> parsed_args(utils::ParseList(args));
+ std::unique_ptr<base::ListValue> parsed_args(utils::ParseList(args));
EXPECT_TRUE(parsed_args.get()) <<
"Could not parse extension function arguments: " << args;
function->SetArgs(parsed_args.get());
@@ -170,7 +171,7 @@
EXPECT_TRUE(response_delegate_->HasResponse());
}
- scoped_ptr<SendResponseDelegate> response_delegate_;
+ std::unique_ptr<SendResponseDelegate> response_delegate_;
};
class TestHangOAuth2MintTokenFlow : public OAuth2MintTokenFlow {
@@ -306,13 +307,13 @@
void set_login_ui_result(bool result) { login_ui_result_ = result; }
- void set_mint_token_flow(scoped_ptr<OAuth2MintTokenFlow> flow) {
+ void set_mint_token_flow(std::unique_ptr<OAuth2MintTokenFlow> flow) {
flow_ = std::move(flow);
}
void set_mint_token_result(TestOAuth2MintTokenFlow::ResultType result_type) {
set_mint_token_flow(
- make_scoped_ptr(new TestOAuth2MintTokenFlow(result_type, this)));
+ base::WrapUnique(new TestOAuth2MintTokenFlow(result_type, this)));
}
void set_scope_ui_failure(GaiaWebAuthFlow::Failure failure) {
@@ -402,7 +403,7 @@
bool login_ui_shown_;
bool scope_ui_shown_;
- scoped_ptr<OAuth2MintTokenFlow> flow_;
+ std::unique_ptr<OAuth2MintTokenFlow> flow_;
std::string login_access_token_;
};
@@ -459,7 +460,7 @@
for (base::ListValue::const_iterator it = results->begin();
it != results->end();
++it) {
- scoped_ptr<api::identity::AccountInfo> info =
+ std::unique_ptr<api::identity::AccountInfo> info =
api::identity::AccountInfo::FromValue(**it);
if (info.get())
result_ids.insert(info->id);
@@ -493,7 +494,7 @@
for (base::ListValue::const_iterator it = results->begin();
it != results->end();
++it) {
- scoped_ptr<api::identity::AccountInfo> info =
+ std::unique_ptr<api::identity::AccountInfo> info =
api::identity::AccountInfo::FromValue(**it);
if (info.get())
msg << info->id << " ";
@@ -614,33 +615,35 @@
FakeSigninManagerForTesting* signin_manager_;
FakeProfileOAuth2TokenService* token_service_;
- scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription>
+ std::unique_ptr<
+ base::CallbackList<void(content::BrowserContext*)>::Subscription>
will_create_browser_context_services_subscription_;
};
class IdentityGetProfileUserInfoFunctionTest : public IdentityTestWithSignin {
protected:
- scoped_ptr<api::identity::ProfileUserInfo> RunGetProfileUserInfo() {
+ std::unique_ptr<api::identity::ProfileUserInfo> RunGetProfileUserInfo() {
scoped_refptr<IdentityGetProfileUserInfoFunction> func(
new IdentityGetProfileUserInfoFunction);
func->set_extension(test_util::CreateEmptyExtension(kExtensionId).get());
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
utils::RunFunctionAndReturnSingleResult(func.get(), "[]", browser()));
return api::identity::ProfileUserInfo::FromValue(*value.get());
}
- scoped_ptr<api::identity::ProfileUserInfo> RunGetProfileUserInfoWithEmail() {
+ std::unique_ptr<api::identity::ProfileUserInfo>
+ RunGetProfileUserInfoWithEmail() {
scoped_refptr<IdentityGetProfileUserInfoFunction> func(
new IdentityGetProfileUserInfoFunction);
func->set_extension(CreateExtensionWithEmailPermission());
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
utils::RunFunctionAndReturnSingleResult(func.get(), "[]", browser()));
return api::identity::ProfileUserInfo::FromValue(*value.get());
}
private:
scoped_refptr<Extension> CreateExtensionWithEmailPermission() {
- scoped_ptr<base::DictionaryValue> test_extension_value(
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
api_test_utils::ParseDictionary(
"{\"name\": \"Test\", \"version\": \"1.0\", "
"\"permissions\": [\"identity.email\"]}"));
@@ -649,7 +652,7 @@
};
IN_PROC_BROWSER_TEST_F(IdentityGetProfileUserInfoFunctionTest, NotSignedIn) {
- scoped_ptr<api::identity::ProfileUserInfo> info =
+ std::unique_ptr<api::identity::ProfileUserInfo> info =
RunGetProfileUserInfoWithEmail();
EXPECT_TRUE(info->email.empty());
EXPECT_TRUE(info->id.empty());
@@ -657,7 +660,7 @@
IN_PROC_BROWSER_TEST_F(IdentityGetProfileUserInfoFunctionTest, SignedIn) {
SignIn("[email protected]", "12345");
- scoped_ptr<api::identity::ProfileUserInfo> info =
+ std::unique_ptr<api::identity::ProfileUserInfo> info =
RunGetProfileUserInfoWithEmail();
EXPECT_EQ("[email protected]", info->email);
EXPECT_EQ("12345", info->id);
@@ -665,7 +668,8 @@
IN_PROC_BROWSER_TEST_F(IdentityGetProfileUserInfoFunctionTest,
NotSignedInNoEmail) {
- scoped_ptr<api::identity::ProfileUserInfo> info = RunGetProfileUserInfo();
+ std::unique_ptr<api::identity::ProfileUserInfo> info =
+ RunGetProfileUserInfo();
EXPECT_TRUE(info->email.empty());
EXPECT_TRUE(info->id.empty());
}
@@ -673,7 +677,8 @@
IN_PROC_BROWSER_TEST_F(IdentityGetProfileUserInfoFunctionTest,
SignedInNoEmail) {
SignIn("[email protected]", "12345");
- scoped_ptr<api::identity::ProfileUserInfo> info = RunGetProfileUserInfo();
+ std::unique_ptr<api::identity::ProfileUserInfo> info =
+ RunGetProfileUserInfo();
EXPECT_TRUE(info->email.empty());
EXPECT_TRUE(info->id.empty());
}
@@ -897,7 +902,7 @@
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
func->set_extension(extension.get());
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
utils::RunFunctionAndReturnSingleResult(func.get(), "[]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -922,8 +927,8 @@
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
func->set_extension(extension.get());
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
- func.get(), "[{}]", browser()));
+ std::unique_ptr<base::Value> value(
+ utils::RunFunctionAndReturnSingleResult(func.get(), "[{}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1008,7 +1013,7 @@
func->set_extension(CreateExtension(CLIENT_ID | SCOPES));
func->set_login_ui_result(true);
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func.get(), "[{\"interactive\": true}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1039,7 +1044,7 @@
func->set_login_ui_result(true);
func->set_mint_token_result(TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func.get(), "[{\"interactive\": true}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1144,7 +1149,7 @@
func->set_extension(extension.get());
func->set_mint_token_result(TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func.get(), "[{\"interactive\": true}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1181,7 +1186,7 @@
QueueRequestComplete(type, &queued_request);
- scoped_ptr<base::Value> value(WaitForSingleResult(func.get()));
+ std::unique_ptr<base::Value> value(WaitForSingleResult(func.get()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1215,7 +1220,7 @@
// queued request clears.
QueueRequestComplete(type, &queued_request);
- scoped_ptr<base::Value> value(WaitForSingleResult(func.get()));
+ std::unique_ptr<base::Value> value(WaitForSingleResult(func.get()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1260,7 +1265,8 @@
scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
func->set_extension(extension.get());
- func->set_mint_token_flow(make_scoped_ptr(new TestHangOAuth2MintTokenFlow()));
+ func->set_mint_token_flow(
+ base::WrapUnique(new TestHangOAuth2MintTokenFlow()));
RunFunctionAsync(func.get(), "[{\"interactive\": false}]");
// After the request is canceled, the function will complete.
@@ -1307,8 +1313,8 @@
SetCachedToken(token);
// Get a token. Should not require a GAIA request.
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
- func.get(), "[{}]", browser()));
+ std::unique_ptr<base::Value> value(
+ utils::RunFunctionAndReturnSingleResult(func.get(), "[{}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1366,7 +1372,7 @@
QueueRequestComplete(type, &queued_request);
- scoped_ptr<base::Value> value(WaitForSingleResult(func.get()));
+ std::unique_ptr<base::Value> value(WaitForSingleResult(func.get()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1390,7 +1396,7 @@
func->set_login_ui_result(true);
func->set_mint_token_result(TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func.get(), "[{\"interactive\": true}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1435,7 +1441,7 @@
IssueLoginAccessTokenForAccount("[email protected]");
- scoped_ptr<base::Value> value(WaitForSingleResult(func.get()));
+ std::unique_ptr<base::Value> value(WaitForSingleResult(func.get()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1460,7 +1466,7 @@
IssueLoginAccessTokenForAccount("[email protected]");
- scoped_ptr<base::Value> value(WaitForSingleResult(func.get()));
+ std::unique_ptr<base::Value> value(WaitForSingleResult(func.get()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1485,7 +1491,7 @@
IssueLoginAccessTokenForAccount("[email protected]");
- scoped_ptr<base::Value> value(WaitForSingleResult(func.get()));
+ std::unique_ptr<base::Value> value(WaitForSingleResult(func.get()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
EXPECT_EQ(std::string(kAccessToken), access_token);
@@ -1570,7 +1576,7 @@
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
func->set_extension(extension.get());
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
utils::RunFunctionAndReturnSingleResult(func.get(), "[{}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1599,7 +1605,7 @@
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
func->set_extension(extension.get());
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func.get(), "[{\"scopes\": [\"email\"]}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1616,7 +1622,7 @@
scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
func->set_extension(extension.get());
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
func.get(), "[{\"scopes\": [\"email\", \"foo\", \"bar\"]}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1648,12 +1654,12 @@
// Set up fake install attributes to make the device appeared as
// enterprise-managed.
- scoped_ptr<policy::StubEnterpriseInstallAttributes> attributes(
- new policy::StubEnterpriseInstallAttributes());
- attributes->SetDomain("example.com");
- attributes->SetRegistrationUser("[email protected]");
- policy::BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(
- attributes.release());
+ std::unique_ptr<policy::StubEnterpriseInstallAttributes> attributes(
+ new policy::StubEnterpriseInstallAttributes());
+ attributes->SetDomain("example.com");
+ attributes->SetRegistrationUser("[email protected]");
+ policy::BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(
+ attributes.release());
}
scoped_refptr<Extension> CreateTestExtension(const std::string& id) {
@@ -1696,7 +1702,7 @@
scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
func->set_extension(CreateTestExtension("ljacajndfccfgnfohlgkdphmbnpkjflk"));
func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS);
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
utils::RunFunctionAndReturnSingleResult(func.get(), "[{}]", browser()));
std::string access_token;
EXPECT_TRUE(value->GetAsString(&access_token));
@@ -1858,7 +1864,7 @@
function->set_extension(empty_extension.get());
function->InitFinalRedirectURLPrefixForTest("abcdefghij");
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
function.get(),
"[{\"interactive\": false,"
"\"url\": \"https://abcdefghij.chromiumapp.org/callback#test\"}]",
@@ -1885,7 +1891,7 @@
function->set_extension(empty_extension.get());
function->InitFinalRedirectURLPrefixForTest("abcdefghij");
- scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
function.get(),
"[{\"interactive\": true,"
"\"url\": \"https://abcdefghij.chromiumapp.org/callback#test\"}]",
@@ -1913,7 +1919,7 @@
function->InitFinalRedirectURLPrefixForTest("abcdefghij");
std::string args = "[{\"interactive\": true, \"url\": \"" +
auth_url.spec() + "\"}]";
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
utils::RunFunctionAndReturnSingleResult(function.get(), args, browser()));
std::string url;
diff --git a/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc b/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc
index 8626ef9..3dd5952 100644
--- a/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc
+++ b/chrome/browser/extensions/api/identity/identity_mint_queue_unittest.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/extensions/api/identity/identity_mint_queue.h"
+#include <memory>
#include <vector>
-#include "base/memory/scoped_ptr.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,10 +20,10 @@
MOCK_METHOD1(StartMintToken, void(IdentityMintRequestQueue::MintType));
};
-scoped_ptr<ExtensionTokenKey> ExtensionIdToKey(
+std::unique_ptr<ExtensionTokenKey> ExtensionIdToKey(
const std::string& extension_id) {
- return scoped_ptr<ExtensionTokenKey>(new ExtensionTokenKey(
- extension_id, "user_id", std::set<std::string>()));
+ return std::unique_ptr<ExtensionTokenKey>(
+ new ExtensionTokenKey(extension_id, "user_id", std::set<std::string>()));
}
} // namespace
@@ -32,7 +32,7 @@
IdentityMintRequestQueue::MintType type =
IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE;
IdentityMintRequestQueue queue;
- scoped_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
+ std::unique_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
MockRequest request1;
MockRequest request2;
@@ -49,7 +49,7 @@
IdentityMintRequestQueue::MintType type =
IdentityMintRequestQueue::MINT_TYPE_INTERACTIVE;
IdentityMintRequestQueue queue;
- scoped_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
+ std::unique_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
MockRequest request1;
EXPECT_CALL(request1, StartMintToken(type)).Times(1);
@@ -61,7 +61,7 @@
IdentityMintRequestQueue::MintType type =
IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE;
IdentityMintRequestQueue queue;
- scoped_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
+ std::unique_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
MockRequest request1;
MockRequest request2;
MockRequest request3;
@@ -84,8 +84,8 @@
IdentityMintRequestQueue::MintType type =
IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE;
IdentityMintRequestQueue queue;
- scoped_ptr<ExtensionTokenKey> key1(ExtensionIdToKey("ext_id_1"));
- scoped_ptr<ExtensionTokenKey> key2(ExtensionIdToKey("ext_id_2"));
+ std::unique_ptr<ExtensionTokenKey> key1(ExtensionIdToKey("ext_id_1"));
+ std::unique_ptr<ExtensionTokenKey> key2(ExtensionIdToKey("ext_id_2"));
MockRequest request1;
MockRequest request2;
@@ -102,7 +102,7 @@
IdentityMintRequestQueue::MintType type =
IdentityMintRequestQueue::MINT_TYPE_INTERACTIVE;
IdentityMintRequestQueue queue;
- scoped_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
+ std::unique_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
MockRequest request1;
EXPECT_TRUE(queue.empty(type, *key));
@@ -117,7 +117,7 @@
IdentityMintRequestQueue::MintType type =
IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE;
IdentityMintRequestQueue queue;
- scoped_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
+ std::unique_ptr<ExtensionTokenKey> key(ExtensionIdToKey("ext_id"));
MockRequest request1;
MockRequest request2;
MockRequest request3;
diff --git a/chrome/browser/extensions/api/identity/identity_signin_flow.h b/chrome/browser/extensions/api/identity/identity_signin_flow.h
index d744e8e..43a8393 100644
--- a/chrome/browser/extensions/api/identity/identity_signin_flow.h
+++ b/chrome/browser/extensions/api/identity/identity_signin_flow.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_
#define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "google_apis/gaia/oauth2_token_service.h"
class Profile;
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc
index 6336764..d8092c70 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc
@@ -82,7 +82,7 @@
base::Base64Encode(random_bytes, &app_window_key_);
// identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_)
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->AppendString(app_window_key_);
args->AppendString(provider_url_.spec());
if (mode_ == WebAuthFlow::INTERACTIVE)
@@ -90,7 +90,7 @@
else
args->AppendString("silent");
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST,
identity_private::OnWebFlowRequest::kEventName, std::move(args)));
event->restrict_to_browser_context = profile_;
diff --git a/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc b/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc
index d7b78eed..b1ee49b 100644
--- a/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc
+++ b/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc
@@ -31,7 +31,7 @@
return;
}
- scoped_ptr<char[]> buffer(new char[kPartitionTableSize]);
+ std::unique_ptr<char[]> buffer(new char[kPartitionTableSize]);
memset(buffer.get(), 0, kPartitionTableSize);
if (base::WriteFile(image_path_, buffer.get(), kPartitionTableSize) !=
diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc b/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
index 5afa7be5..6310bc6c 100644
--- a/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
+++ b/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
@@ -24,7 +24,7 @@
}
bool ImageWriterPrivateWriteFromUrlFunction::RunAsync() {
- scoped_ptr<image_writer_api::WriteFromUrl::Params> params(
+ std::unique_ptr<image_writer_api::WriteFromUrl::Params> params(
image_writer_api::WriteFromUrl::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -134,7 +134,7 @@
}
bool ImageWriterPrivateDestroyPartitionsFunction::RunAsync() {
- scoped_ptr<image_writer_api::DestroyPartitions::Params> params(
+ std::unique_ptr<image_writer_api::DestroyPartitions::Params> params(
image_writer_api::DestroyPartitions::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/image_writer_private/operation.cc b/chrome/browser/extensions/api/image_writer_private/operation.cc
index f27b229..491cb44 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation.cc
@@ -330,7 +330,7 @@
CHECK_LE(bytes_processed, bytes_total);
- scoped_ptr<char[]> buffer(new char[kMD5BufferSize]);
+ std::unique_ptr<char[]> buffer(new char[kMD5BufferSize]);
int read_size = std::min(bytes_total - bytes_processed,
static_cast<int64_t>(kMD5BufferSize));
diff --git a/chrome/browser/extensions/api/image_writer_private/operation.h b/chrome/browser/extensions/api/image_writer_private/operation.h
index bf629529..c524d255 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation.h
+++ b/chrome/browser/extensions/api/image_writer_private/operation.h
@@ -217,7 +217,7 @@
// Zip reader for unzip operations. The reason for using a pointer is that we
// don't want to include zip_reader.h here which can mangle definitions in
// jni.h when included in the same file. See crbug.com/554199.
- scoped_ptr<zip::ZipReader> zip_reader_;
+ std::unique_ptr<zip::ZipReader> zip_reader_;
// CleanUp operations that must be run. All these functions are run on the
// FILE thread.
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
index 30a31a8..a62d500 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc
@@ -162,9 +162,9 @@
info.stage = stage;
info.percent_complete = progress;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
image_writer_api::OnWriteProgress::Create(info));
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::IMAGE_WRITER_PRIVATE_ON_WRITE_PROGRESS,
image_writer_api::OnWriteProgress::kEventName, std::move(args)));
@@ -175,8 +175,9 @@
void OperationManager::OnComplete(const ExtensionId& extension_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- scoped_ptr<base::ListValue> args(image_writer_api::OnWriteComplete::Create());
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<base::ListValue> args(
+ image_writer_api::OnWriteComplete::Create());
+ std::unique_ptr<Event> event(new Event(
events::IMAGE_WRITER_PRIVATE_ON_WRITE_COMPLETE,
image_writer_api::OnWriteComplete::kEventName, std::move(args)));
@@ -198,11 +199,11 @@
info.stage = stage;
info.percent_complete = progress;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
image_writer_api::OnWriteError::Create(info, error_message));
- scoped_ptr<Event> event(new Event(events::IMAGE_WRITER_PRIVATE_ON_WRITE_ERROR,
- image_writer_api::OnWriteError::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::IMAGE_WRITER_PRIVATE_ON_WRITE_ERROR,
+ image_writer_api::OnWriteError::kEventName, std::move(args)));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(extension_id, std::move(event));
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc
index bc64c8b..8c54edd 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_manager_unittest.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/image_writer_private/operation_manager.h"
+
+#include <memory>
+
#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
-#include "chrome/browser/extensions/api/image_writer_private/operation_manager.h"
#include "chrome/browser/extensions/api/image_writer_private/test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system_factory.h"
@@ -30,16 +33,17 @@
public:
explicit FakeEventRouter(Profile* profile) : EventRouter(profile, NULL) {}
- void DispatchEventToExtension(const std::string& extension_id,
- scoped_ptr<extensions::Event> event) override {
+ void DispatchEventToExtension(
+ const std::string& extension_id,
+ std::unique_ptr<extensions::Event> event) override {
// Do nothing with the event as no tests currently care.
}
};
// FakeEventRouter factory function
-scoped_ptr<KeyedService> FakeEventRouterFactoryFunction(
+std::unique_ptr<KeyedService> FakeEventRouterFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(new FakeEventRouter(static_cast<Profile*>(context)));
+ return base::WrapUnique(new FakeEventRouter(static_cast<Profile*>(context)));
}
namespace {
diff --git a/chrome/browser/extensions/api/image_writer_private/operation_unittest.cc b/chrome/browser/extensions/api/image_writer_private/operation_unittest.cc
index f0e4b86e..55ab362b 100644
--- a/chrome/browser/extensions/api/image_writer_private/operation_unittest.cc
+++ b/chrome/browser/extensions/api/image_writer_private/operation_unittest.cc
@@ -99,7 +99,7 @@
base::FilePath image_path_;
base::FilePath zip_file_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
MockOperationManager manager_;
scoped_refptr<OperationForTest> operation_;
diff --git a/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_win.cc b/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_win.cc
index 0ed3731..86038b3 100644
--- a/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_win.cc
+++ b/chrome/browser/extensions/api/image_writer_private/removable_storage_provider_win.cc
@@ -35,7 +35,7 @@
return false;
}
- scoped_ptr<char[]> interface_detail_data_buffer(
+ std::unique_ptr<char[]> interface_detail_data_buffer(
new char[interface_detail_data_size]);
SP_DEVICE_INTERFACE_DETAIL_DATA* interface_detail_data =
@@ -101,7 +101,7 @@
query.PropertyId = StorageDeviceProperty;
query.QueryType = PropertyStandardQuery;
- scoped_ptr<char[]> output_buf(new char[1024]);
+ std::unique_ptr<char[]> output_buf(new char[1024]);
status = DeviceIoControl(
device_handle.Get(), // Device handle.
IOCTL_STORAGE_QUERY_PROPERTY, // Flag to request device properties.
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.cc b/chrome/browser/extensions/api/image_writer_private/test_utils.cc
index 51f84d4c..18b8a2c 100644
--- a/chrome/browser/extensions/api/image_writer_private/test_utils.cc
+++ b/chrome/browser/extensions/api/image_writer_private/test_utils.cc
@@ -165,10 +165,10 @@
#if defined(OS_CHROMEOS)
if (!chromeos::DBusThreadManager::IsInitialized()) {
- scoped_ptr<chromeos::DBusThreadManagerSetter> dbus_setter =
+ std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter =
chromeos::DBusThreadManager::GetSetterForTesting();
- scoped_ptr<chromeos::ImageBurnerClient>
- image_burner_fake(new ImageWriterFakeImageBurnerClient());
+ std::unique_ptr<chromeos::ImageBurnerClient> image_burner_fake(
+ new ImageWriterFakeImageBurnerClient());
dbus_setter->SetImageBurnerClient(std::move(image_burner_fake));
}
@@ -230,8 +230,8 @@
#endif
bool ImageWriterTestUtils::ImageWrittenToDevice() {
- scoped_ptr<char[]> image_buffer(new char[kTestFileSize]);
- scoped_ptr<char[]> device_buffer(new char[kTestFileSize]);
+ std::unique_ptr<char[]> image_buffer(new char[kTestFileSize]);
+ std::unique_ptr<char[]> device_buffer(new char[kTestFileSize]);
int image_bytes_read =
ReadFile(test_image_path_, image_buffer.get(), kTestFileSize);
@@ -251,7 +251,7 @@
bool ImageWriterTestUtils::FillFile(const base::FilePath& file,
const int pattern,
const int length) {
- scoped_ptr<char[]> buffer(new char[length]);
+ std::unique_ptr<char[]> buffer(new char[length]);
memset(buffer.get(), pattern, length);
return base::WriteFile(file, buffer.get(), length) == length;
diff --git a/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc b/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
index 2dfa5db0..bb241d0 100644
--- a/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
+++ b/chrome/browser/extensions/api/image_writer_private/write_from_file_operation_unittest.cc
@@ -20,7 +20,7 @@
protected:
ImageWriterFromFileTest()
: profile_(new TestingProfile), manager_(profile_.get()) {}
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
MockOperationManager manager_;
};
diff --git a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h
index 1ccd75a6..ce94db0 100644
--- a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h
+++ b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h
@@ -71,7 +71,7 @@
const std::string hash_;
// Local state
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
base::Closure download_continuation_;
};
diff --git a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
index f539ce4c..afb4639 100644
--- a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
+++ b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc
@@ -102,7 +102,7 @@
}
TestingProfile test_profile_;
- scoped_ptr<GetInterceptor> get_interceptor_;
+ std::unique_ptr<GetInterceptor> get_interceptor_;
MockOperationManager manager_;
};
@@ -174,7 +174,7 @@
}
TEST_F(ImageWriterWriteFromUrlOperationTest, VerifyFile) {
- scoped_ptr<char[]> data_buffer(new char[kTestFileSize]);
+ std::unique_ptr<char[]> data_buffer(new char[kTestFileSize]);
base::ReadFile(test_utils_.GetImagePath(), data_buffer.get(), kTestFileSize);
base::MD5Digest expected_digest;
base::MD5Sum(data_buffer.get(), kTestFileSize, &expected_digest);
diff --git a/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.cc b/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.cc
index 45a28d77..e85b190 100644
--- a/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.cc
+++ b/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/inline_install_private/inline_install_private_api.h"
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/webstore_install_with_prompt.h"
#include "chrome/browser/profiles/profile.h"
@@ -32,7 +33,7 @@
// webstore.
const GURL& GetRequestorURL() const override { return requestor_url_; }
- scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const override;
void OnManifestParsed() override;
@@ -52,9 +53,9 @@
Installer::~Installer() {
}
-scoped_ptr<ExtensionInstallPrompt::Prompt> Installer::CreateInstallPrompt()
+std::unique_ptr<ExtensionInstallPrompt::Prompt> Installer::CreateInstallPrompt()
const {
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::INLINE_INSTALL_PROMPT));
prompt->SetWebstoreData(localized_user_count(),
@@ -72,7 +73,7 @@
}
Manifest parsed_manifest(Manifest::INTERNAL,
- make_scoped_ptr(manifest()->DeepCopy()));
+ base::WrapUnique(manifest()->DeepCopy()));
std::string manifest_error;
std::vector<InstallWarning> warnings;
@@ -99,7 +100,7 @@
ExtensionFunction::ResponseAction
InlineInstallPrivateInstallFunction::Run() {
typedef api::inline_install_private::Install::Params Params;
- scoped_ptr<Params> params(Params::Create(*args_));
+ std::unique_ptr<Params> params(Params::Create(*args_));
if (!user_gesture())
return RespondNow(CreateResponse("Must be called with a user gesture",
diff --git a/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.h b/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.h
index 1c04f7c..c08091c9 100644
--- a/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.h
+++ b/chrome/browser/extensions/api/inline_install_private/inline_install_private_api.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_INLINE_INSTALL_PRIVATE_INLINE_INSTALL_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_INLINE_INSTALL_PRIVATE_INLINE_INSTALL_PRIVATE_API_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "chrome/common/extensions/webstore_install_result.h"
#include "extensions/browser/extension_function.h"
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
index 7e3028d..8cef3353 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -32,9 +32,8 @@
if (extension_id_.empty() || !HasListener(input_ime::OnActivate::kEventName))
return;
- scoped_ptr<base::ListValue> args(input_ime::OnActivate::Create(
- component_id,
- input_ime::ParseScreenType(GetCurrentScreenType())));
+ std::unique_ptr<base::ListValue> args(input_ime::OnActivate::Create(
+ component_id, input_ime::ParseScreenType(GetCurrentScreenType())));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_ACTIVATE,
input_ime::OnActivate::kEventName,
@@ -54,7 +53,8 @@
context_value.auto_complete = ConvertInputContextAutoComplete(context);
context_value.spell_check = ConvertInputContextSpellCheck(context);
- scoped_ptr<base::ListValue> args(input_ime::OnFocus::Create(context_value));
+ std::unique_ptr<base::ListValue> args(
+ input_ime::OnFocus::Create(context_value));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_FOCUS,
input_ime::OnFocus::kEventName, std::move(args));
@@ -64,7 +64,7 @@
if (extension_id_.empty() || !HasListener(input_ime::OnBlur::kEventName))
return;
- scoped_ptr<base::ListValue> args(input_ime::OnBlur::Create(context_id));
+ std::unique_ptr<base::ListValue> args(input_ime::OnBlur::Create(context_id));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_BLUR,
input_ime::OnBlur::kEventName, std::move(args));
@@ -105,7 +105,7 @@
key_data_value.shift_key.reset(new bool(event.shift_key));
key_data_value.caps_lock.reset(new bool(event.caps_lock));
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
input_ime::OnKeyEvent::Create(component_id, key_data_value));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_KEY_EVENT,
@@ -116,7 +116,8 @@
if (extension_id_.empty() || !HasListener(input_ime::OnReset::kEventName))
return;
- scoped_ptr<base::ListValue> args(input_ime::OnReset::Create(component_id));
+ std::unique_ptr<base::ListValue> args(
+ input_ime::OnReset::Create(component_id));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_RESET,
input_ime::OnReset::kEventName, std::move(args));
@@ -127,7 +128,7 @@
!HasListener(input_ime::OnDeactivated::kEventName))
return;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
input_ime::OnDeactivated::Create(component_id));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_DEACTIVATED,
@@ -158,8 +159,8 @@
info.focus = cursor_pos;
info.anchor = anchor_pos;
info.offset = offset_pos;
- scoped_ptr<base::ListValue> args(
- input_ime::OnSurroundingTextChanged::Create(component_id, info));
+ std::unique_ptr<base::ListValue> args(
+ input_ime::OnSurroundingTextChanged::Create(component_id, info));
DispatchEventToExtension(
extensions::events::INPUT_IME_ON_SURROUNDING_TEXT_CHANGED,
@@ -270,7 +271,7 @@
}
ExtensionFunction::ResponseAction InputImeKeyEventHandledFunction::Run() {
- scoped_ptr<KeyEventHandled::Params> params(
+ std::unique_ptr<KeyEventHandled::Params> params(
KeyEventHandled::Params::Create(*args_));
InputImeEventRouter* event_router =
GetInputImeEventRouter(Profile::FromBrowserContext(browser_context()));
@@ -290,7 +291,7 @@
InputMethodEngineBase* engine =
event_router ? event_router->GetActiveEngine(extension_id()) : nullptr;
if (engine) {
- scoped_ptr<SetComposition::Params> parent_params(
+ std::unique_ptr<SetComposition::Params> parent_params(
SetComposition::Params::Create(*args_));
const SetComposition::Params::Parameters& params =
parent_params->parameters;
@@ -323,7 +324,8 @@
selection_start, selection_end,
params.cursor, segments, &error_);
}
- scoped_ptr<base::ListValue> output = SetComposition::Results::Create(success);
+ std::unique_ptr<base::ListValue> output =
+ SetComposition::Results::Create(success);
return RespondNow(ArgumentList(std::move(output)));
}
@@ -334,13 +336,14 @@
InputMethodEngineBase* engine =
event_router ? event_router->GetActiveEngine(extension_id()) : nullptr;
if (engine) {
- scoped_ptr<CommitText::Params> parent_params(
+ std::unique_ptr<CommitText::Params> parent_params(
CommitText::Params::Create(*args_));
const CommitText::Params::Parameters& params = parent_params->parameters;
success =
engine->CommitText(params.context_id, params.text.c_str(), &error_);
}
- scoped_ptr<base::ListValue> output = CommitText::Results::Create(success);
+ std::unique_ptr<base::ListValue> output =
+ CommitText::Results::Create(success);
return RespondNow(ArgumentList(std::move(output)));
}
@@ -352,7 +355,7 @@
if (!engine)
return RespondNow(Error(kErrorEngineNotAvailable));
- scoped_ptr<SendKeyEvents::Params> parent_params(
+ std::unique_ptr<SendKeyEvents::Params> parent_params(
SendKeyEvents::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(parent_params);
const SendKeyEvents::Params::Parameters& params = parent_params->parameters;
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chrome/browser/extensions/api/input_ime/input_ime_api.h
index 85496332..2b2f81be 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.h
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.h
@@ -72,7 +72,7 @@
virtual void DispatchEventToExtension(
extensions::events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) = 0;
+ std::unique_ptr<base::ListValue> args) = 0;
// Returns the type of the current screen.
virtual std::string GetCurrentScreenType() = 0;
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
index fdde5fbb..dc04808 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -97,7 +97,7 @@
context_value.type =
input_ime::ParseInputContextType(ConvertInputContextType(context));
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
input_ime::OnInputContextUpdate::Create(context_value));
DispatchEventToExtension(
@@ -130,7 +130,7 @@
break;
}
- scoped_ptr<base::ListValue> args(input_ime::OnCandidateClicked::Create(
+ std::unique_ptr<base::ListValue> args(input_ime::OnCandidateClicked::Create(
component_id, candidate_id, button_enum));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_CANDIDATE_CLICKED,
@@ -144,7 +144,7 @@
!HasListener(input_ime::OnMenuItemActivated::kEventName))
return;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
input_ime::OnMenuItemActivated::Create(component_id, menu_id));
DispatchEventToExtension(
@@ -171,7 +171,7 @@
if (bounds_list->GetSize() <= 0)
return;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
// The old extension code uses the first parameter to get the bounds of the
// first composition character, so for backward compatibility, add it here.
@@ -190,7 +190,7 @@
void DispatchEventToExtension(
extensions::events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) override {
+ std::unique_ptr<base::ListValue> args) override {
if (event_name != input_ime::OnActivate::kEventName) {
// For suspended IME extension (e.g. XKB extension), don't awake it by IME
// events except onActivate. The IME extension should be awake by other
@@ -214,7 +214,7 @@
}
}
- scoped_ptr<extensions::Event> event(
+ std::unique_ptr<extensions::Event> event(
new extensions::Event(histogram_value, event_name, std::move(args)));
event->restrict_to_browser_context = profile_;
extensions::EventRouter::Get(profile_)
@@ -316,7 +316,7 @@
profile = profile->GetOffTheRecordProfile();
}
- scoped_ptr<InputMethodEngineBase::Observer> observer(
+ std::unique_ptr<InputMethodEngineBase::Observer> observer(
new ImeObserverChromeOS(extension_id, profile));
chromeos::InputMethodEngine* engine = new chromeos::InputMethodEngine();
engine->Initialize(std::move(observer), extension_id.c_str(), profile);
@@ -364,7 +364,7 @@
return true;
}
- scoped_ptr<ClearComposition::Params> parent_params(
+ std::unique_ptr<ClearComposition::Params> parent_params(
ClearComposition::Params::Create(*args_));
const ClearComposition::Params::Parameters& params =
parent_params->parameters;
@@ -385,7 +385,7 @@
}
bool InputImeSetCandidateWindowPropertiesFunction::RunSync() {
- scoped_ptr<SetCandidateWindowProperties::Params> parent_params(
+ std::unique_ptr<SetCandidateWindowProperties::Params> parent_params(
SetCandidateWindowProperties::Params::Create(*args_));
const SetCandidateWindowProperties::Params::Parameters&
params = parent_params->parameters;
@@ -464,7 +464,7 @@
return true;
}
- scoped_ptr<SetCandidates::Params> parent_params(
+ std::unique_ptr<SetCandidates::Params> parent_params(
SetCandidates::Params::Create(*args_));
const SetCandidates::Params::Parameters& params =
parent_params->parameters;
@@ -497,7 +497,7 @@
return true;
}
- scoped_ptr<SetCursorPosition::Params> parent_params(
+ std::unique_ptr<SetCursorPosition::Params> parent_params(
SetCursorPosition::Params::Create(*args_));
const SetCursorPosition::Params::Parameters& params =
parent_params->parameters;
@@ -509,7 +509,7 @@
}
bool InputImeSetMenuItemsFunction::RunSync() {
- scoped_ptr<SetMenuItems::Params> parent_params(
+ std::unique_ptr<SetMenuItems::Params> parent_params(
SetMenuItems::Params::Create(*args_));
const SetMenuItems::Params::Parameters& params =
parent_params->parameters;
@@ -536,7 +536,7 @@
}
bool InputImeUpdateMenuItemsFunction::RunSync() {
- scoped_ptr<UpdateMenuItems::Params> parent_params(
+ std::unique_ptr<UpdateMenuItems::Params> parent_params(
UpdateMenuItems::Params::Create(*args_));
const UpdateMenuItems::Params::Parameters& params =
parent_params->parameters;
@@ -563,7 +563,7 @@
}
bool InputImeDeleteSurroundingTextFunction::RunSync() {
- scoped_ptr<DeleteSurroundingText::Params> parent_params(
+ std::unique_ptr<DeleteSurroundingText::Params> parent_params(
DeleteSurroundingText::Params::Create(*args_));
const DeleteSurroundingText::Params::Parameters& params =
parent_params->parameters;
@@ -597,7 +597,7 @@
if (!engine)
return RespondNow(Error(kErrorEngineNotAvailable));
- scoped_ptr<NotifyImeMenuItemActivated::Params> params(
+ std::unique_ptr<NotifyImeMenuItemActivated::Params> params(
NotifyImeMenuItemActivated::Params::Create(*args_));
if (params->engine_id != engine->GetActiveComponentId())
return RespondNow(Error(kErrorEngineNotActive));
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc
index b2dac0c..d8502707 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc
@@ -78,7 +78,7 @@
bounds_list.push_back(std::move(bounds_value));
}
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
OnCompositionBoundsChanged::Create(bounds_list));
DispatchEventToExtension(
@@ -91,12 +91,12 @@
void DispatchEventToExtension(
extensions::events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) override {
+ std::unique_ptr<base::ListValue> args) override {
if (!IsInputImeEnabled()) {
return;
}
- scoped_ptr<extensions::Event> event(
+ std::unique_ptr<extensions::Event> event(
new extensions::Event(histogram_value, event_name, std::move(args)));
event->restrict_to_browser_context = profile_;
extensions::EventRouter::Get(profile_)
@@ -171,9 +171,9 @@
DeleteInputMethodEngine(active_engine_->GetExtensionId());
}
- scoped_ptr<input_method::InputMethodEngine> engine(
+ std::unique_ptr<input_method::InputMethodEngine> engine(
new input_method::InputMethodEngine());
- scoped_ptr<InputMethodEngineBase::Observer> observer(
+ std::unique_ptr<InputMethodEngineBase::Observer> observer(
new ImeObserverNonChromeOS(extension_id, GetProfile()));
engine->Initialize(std::move(observer), extension_id.c_str(), GetProfile());
engine->Enable(std::string());
@@ -339,7 +339,7 @@
if (!frame_id)
return RespondNow(Error(error_));
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
result->Set("frameId", new base::FundamentalValue(frame_id));
return RespondNow(OneArgument(std::move(result)));
@@ -354,7 +354,7 @@
if (!engine)
return RespondNow(Error(kErrorNoActiveEngine));
- scoped_ptr<api::input_ime::ShowWindow::Params> params(
+ std::unique_ptr<api::input_ime::ShowWindow::Params> params(
api::input_ime::ShowWindow::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
engine->ShowImeWindow(params->window_id);
@@ -370,7 +370,7 @@
if (!engine)
return RespondNow(Error(kErrorNoActiveEngine));
- scoped_ptr<api::input_ime::HideWindow::Params> params(
+ std::unique_ptr<api::input_ime::HideWindow::Params> params(
api::input_ime::HideWindow::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
engine->HideImeWindow(params->window_id);
diff --git a/chrome/browser/extensions/api/instance_id/instance_id_api.cc b/chrome/browser/extensions/api/instance_id/instance_id_api.cc
index f7cdbe2..57609b3a 100644
--- a/chrome/browser/extensions/api/instance_id/instance_id_api.cc
+++ b/chrome/browser/extensions/api/instance_id/instance_id_api.cc
@@ -118,7 +118,7 @@
InstanceIDGetTokenFunction::~InstanceIDGetTokenFunction() {}
ExtensionFunction::ResponseAction InstanceIDGetTokenFunction::DoWork() {
- scoped_ptr<api::instance_id::GetToken::Params> params =
+ std::unique_ptr<api::instance_id::GetToken::Params> params =
api::instance_id::GetToken::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -149,7 +149,7 @@
InstanceIDDeleteTokenFunction::~InstanceIDDeleteTokenFunction() {}
ExtensionFunction::ResponseAction InstanceIDDeleteTokenFunction::DoWork() {
- scoped_ptr<api::instance_id::DeleteToken::Params> params =
+ std::unique_ptr<api::instance_id::DeleteToken::Params> params =
api::instance_id::DeleteToken::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/instance_id/instance_id_apitest.cc b/chrome/browser/extensions/api/instance_id/instance_id_apitest.cc
index 646fab0..2709a73b 100644
--- a/chrome/browser/extensions/api/instance_id/instance_id_apitest.cc
+++ b/chrome/browser/extensions/api/instance_id/instance_id_apitest.cc
@@ -2,11 +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 <utility>
#include "base/base_switches.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/browser/extensions/api/instance_id/instance_id_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
@@ -26,9 +26,9 @@
namespace {
-scoped_ptr<KeyedService> BuildFakeGCMProfileService(
+std::unique_ptr<KeyedService> BuildFakeGCMProfileService(
content::BrowserContext* context) {
- scoped_ptr<gcm::FakeGCMProfileService> service(
+ std::unique_ptr<gcm::FakeGCMProfileService> service(
new gcm::FakeGCMProfileService(Profile::FromBrowserContext(context)));
service->SetDriverForTesting(new instance_id::FakeGCMDriverForInstanceID());
return std::move(service);
diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc
index 4535c327..1c422cb4 100644
--- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc
+++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/language_settings_private/language_settings_private_api.h"
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -12,7 +13,6 @@
#include "base/containers/hash_tables.h"
#include "base/i18n/rtl.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -71,8 +71,8 @@
// Collator used to sort display names in the current locale.
UErrorCode error = U_ZERO_ERROR;
- scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(
- icu::Locale(app_locale.c_str()), error));
+ std::unique_ptr<icu::Collator> collator(
+ icu::Collator::createInstance(icu::Locale(app_locale.c_str()), error));
if (U_FAILURE(error))
collator.reset();
LanguageMap language_map(
@@ -106,7 +106,7 @@
translate_languages.begin(), translate_languages.end());
// Build the language list from the language map.
- scoped_ptr<base::ListValue> language_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> language_list(new base::ListValue);
for (const auto& entry : language_map) {
const base::string16& display_name = entry.first;
const LanguagePair& pair = entry.second;
@@ -149,11 +149,12 @@
ExtensionFunction::ResponseAction
LanguageSettingsPrivateSetLanguageListFunction::Run() {
- scoped_ptr<language_settings_private::SetLanguageList::Params> parameters =
- language_settings_private::SetLanguageList::Params::Create(*args_);
+ std::unique_ptr<language_settings_private::SetLanguageList::Params>
+ parameters =
+ language_settings_private::SetLanguageList::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
- scoped_ptr<translate::TranslatePrefs> translate_prefs =
+ std::unique_ptr<translate::TranslatePrefs> translate_prefs =
ChromeTranslateClient::CreateTranslatePrefs(
chrome_details_.GetProfile()->GetPrefs());
translate_prefs->UpdateLanguageList(parameters->language_codes);
@@ -219,7 +220,7 @@
"OnCustomDictionaryLoaded()";
}
-scoped_ptr<base::ListValue>
+std::unique_ptr<base::ListValue>
LanguageSettingsPrivateGetSpellcheckWordsFunction::GetSpellcheckWords() const {
SpellcheckService* service =
SpellcheckServiceFactory::GetForContext(browser_context());
@@ -227,7 +228,7 @@
DCHECK(dictionary->IsLoaded());
// TODO(michaelpg): Sort using app locale.
- scoped_ptr<base::ListValue> word_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> word_list(new base::ListValue());
const std::set<std::string>& words = dictionary->GetWords();
for (const std::string& word : words)
word_list->AppendString(word);
@@ -244,7 +245,7 @@
ExtensionFunction::ResponseAction
LanguageSettingsPrivateAddSpellcheckWordFunction::Run() {
- scoped_ptr<language_settings_private::AddSpellcheckWord::Params> params =
+ std::unique_ptr<language_settings_private::AddSpellcheckWord::Params> params =
language_settings_private::AddSpellcheckWord::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -265,8 +266,9 @@
ExtensionFunction::ResponseAction
LanguageSettingsPrivateRemoveSpellcheckWordFunction::Run() {
- scoped_ptr<language_settings_private::RemoveSpellcheckWord::Params> params =
- language_settings_private::RemoveSpellcheckWord::Params::Create(*args_);
+ std::unique_ptr<language_settings_private::RemoveSpellcheckWord::Params>
+ params = language_settings_private::RemoveSpellcheckWord::Params::Create(
+ *args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
SpellcheckService* service =
diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.h b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.h
index 1702754..f458fa33 100644
--- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.h
+++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.h
@@ -92,7 +92,7 @@
const SpellcheckCustomDictionary::Change& dictionary_change) override;
// Returns the list of words from the loaded custom dictionary.
- scoped_ptr<base::ListValue> GetSpellcheckWords() const;
+ std::unique_ptr<base::ListValue> GetSpellcheckWords() const;
private:
DISALLOW_COPY_AND_ASSIGN(LanguageSettingsPrivateGetSpellcheckWordsFunction);
diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.cc
index 718a19c8..52c1e37 100644
--- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.cc
+++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -11,7 +12,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -158,10 +158,10 @@
change.to_add().end());
std::vector<std::string> to_remove(change.to_remove().begin(),
change.to_remove().end());
- scoped_ptr<base::ListValue> args(
- language_settings_private::OnCustomDictionaryChanged::Create(
- to_add, to_remove));
- scoped_ptr<Event> extension_event(new Event(
+ std::unique_ptr<base::ListValue> args(
+ language_settings_private::OnCustomDictionaryChanged::Create(to_add,
+ to_remove));
+ std::unique_ptr<Event> extension_event(new Event(
events::LANGUAGE_SETTINGS_PRIVATE_ON_CUSTOM_DICTIONARY_CHANGED,
language_settings_private::OnCustomDictionaryChanged::kEventName,
std::move(args)));
@@ -237,10 +237,10 @@
std::vector<language_settings_private::SpellcheckDictionaryStatus> statuses =
GetHunspellDictionaryStatuses();
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
language_settings_private::OnSpellcheckDictionariesChanged::Create(
statuses));
- scoped_ptr<extensions::Event> extension_event(new extensions::Event(
+ std::unique_ptr<extensions::Event> extension_event(new extensions::Event(
events::LANGUAGE_SETTINGS_PRIVATE_ON_SPELLCHECK_DICTIONARIES_CHANGED,
language_settings_private::OnSpellcheckDictionariesChanged::kEventName,
std::move(args)));
diff --git a/chrome/browser/extensions/api/launcher_page/launcher_page_api.cc b/chrome/browser/extensions/api/launcher_page/launcher_page_api.cc
index 6795385..4510827 100644
--- a/chrome/browser/extensions/api/launcher_page/launcher_page_api.cc
+++ b/chrome/browser/extensions/api/launcher_page/launcher_page_api.cc
@@ -73,7 +73,7 @@
}
ExtensionFunction::ResponseAction LauncherPageSetEnabledFunction::Run() {
- scoped_ptr<api::launcher_page::SetEnabled::Params> params(
+ std::unique_ptr<api::launcher_page::SetEnabled::Params> params(
api::launcher_page::SetEnabled::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/log_private/filter_handler.cc b/chrome/browser/extensions/api/log_private/filter_handler.cc
index 02c1306..62b9d25 100644
--- a/chrome/browser/extensions/api/log_private/filter_handler.cc
+++ b/chrome/browser/extensions/api/log_private/filter_handler.cc
@@ -23,7 +23,7 @@
} // namespace
FilterHandler::FilterHandler(const api::log_private::Filter& filter) {
- scoped_ptr<base::DictionaryValue> filter_value = filter.ToValue();
+ std::unique_ptr<base::DictionaryValue> filter_value = filter.ToValue();
api::log_private::Filter::Populate(*filter_value, &filter_);
}
diff --git a/chrome/browser/extensions/api/log_private/log_private_api.h b/chrome/browser/extensions/api/log_private/log_private_api.h
index d54ef61..4ea5c34 100644
--- a/chrome/browser/extensions/api/log_private/log_private_api.h
+++ b/chrome/browser/extensions/api/log_private/log_private_api.h
@@ -88,7 +88,7 @@
void OnAddEntry(const net::NetLog::Entry& entry) override;
void PostPendingEntries();
- void AddEntriesOnUI(scoped_ptr<base::ListValue> value);
+ void AddEntriesOnUI(std::unique_ptr<base::ListValue> value);
// Creates a file that will be written to by net::WriteToFileNetLogObserver.
void CreateTempNetLogFile(const std::string& owner_extension_id,
@@ -113,8 +113,8 @@
bool logging_net_internals_;
api::log_private::EventSink event_sink_;
std::set<std::string> net_internal_watches_;
- scoped_ptr<base::ListValue> pending_entries_;
- scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_;
+ std::unique_ptr<base::ListValue> pending_entries_;
+ std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_;
// Listen to extension unloaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
@@ -136,9 +136,10 @@
bool RunAsync() override;
private:
- void OnSystemLogsLoaded(scoped_ptr<system_logs::SystemLogsResponse> sys_info);
+ void OnSystemLogsLoaded(
+ std::unique_ptr<system_logs::SystemLogsResponse> sys_info);
- scoped_ptr<FilterHandler> filter_handler_;
+ std::unique_ptr<FilterHandler> filter_handler_;
DISALLOW_COPY_AND_ASSIGN(LogPrivateGetHistoricalFunction);
};
diff --git a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc
index d0de98a..64d66a0 100644
--- a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc
+++ b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/log_private/log_private_api.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -13,7 +14,6 @@
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_prefs.h"
@@ -68,13 +68,13 @@
pool->GetNamedSequenceToken(FileResource::kSequenceToken));
}
-scoped_ptr<LogParser> CreateLogParser(const std::string& log_type) {
+std::unique_ptr<LogParser> CreateLogParser(const std::string& log_type) {
if (log_type == "syslog")
- return scoped_ptr<LogParser>(new SyslogParser());
+ return std::unique_ptr<LogParser>(new SyslogParser());
// TODO(shinfan): Add more parser here
NOTREACHED() << "Invalid log type: " << log_type;
- return scoped_ptr<LogParser>();
+ return std::unique_ptr<LogParser>();
}
void CollectLogInfo(FilterHandler* filter_handler,
@@ -85,7 +85,7 @@
if (!filter_handler->IsValidSource(request_it->first)) {
continue;
}
- scoped_ptr<LogParser> parser(CreateLogParser(request_it->first));
+ std::unique_ptr<LogParser> parser(CreateLogParser(request_it->first));
if (parser) {
parser->Parse(request_it->second, output, filter_handler);
}
@@ -241,15 +241,15 @@
base::Passed(&pending_entries_)));
}
-void LogPrivateAPI::AddEntriesOnUI(scoped_ptr<base::ListValue> value) {
+void LogPrivateAPI::AddEntriesOnUI(std::unique_ptr<base::ListValue> value) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (std::set<std::string>::iterator ix = net_internal_watches_.begin();
ix != net_internal_watches_.end(); ++ix) {
// Create the event's arguments value.
- scoped_ptr<base::ListValue> event_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue());
event_args->Append(value->DeepCopy());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(::extensions::events::LOG_PRIVATE_ON_CAPTURED_EVENTS,
::events::kOnCapturedEvents, std::move(event_args)));
EventRouter::Get(browser_context_)
@@ -403,7 +403,7 @@
bool LogPrivateGetHistoricalFunction::RunAsync() {
// Get parameters
- scoped_ptr<api::log_private::GetHistorical::Params> params(
+ std::unique_ptr<api::log_private::GetHistorical::Params> params(
api::log_private::GetHistorical::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
filter_handler_.reset(new FilterHandler(params->filter));
@@ -421,8 +421,7 @@
}
void LogPrivateGetHistoricalFunction::OnSystemLogsLoaded(
- scoped_ptr<system_logs::SystemLogsResponse> sys_info) {
-
+ std::unique_ptr<system_logs::SystemLogsResponse> sys_info) {
// Prepare result
api::log_private::Result result;
CollectLogInfo(filter_handler_.get(), sys_info.get(), &result.data);
@@ -439,7 +438,7 @@
}
bool LogPrivateStartEventRecorderFunction::RunAsync() {
- scoped_ptr<api::log_private::StartEventRecorder::Params> params(
+ std::unique_ptr<api::log_private::StartEventRecorder::Params> params(
api::log_private::StartEventRecorder::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
switch (params->event_type) {
@@ -471,7 +470,7 @@
}
bool LogPrivateStopEventRecorderFunction::RunAsync() {
- scoped_ptr<api::log_private::StopEventRecorder::Params> params(
+ std::unique_ptr<api::log_private::StopEventRecorder::Params> params(
api::log_private::StopEventRecorder::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
switch (params->event_type) {
@@ -523,7 +522,7 @@
->RegisterTempFile(extension_id(), log_path);
}
- scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue());
extensions::GrantedFileEntry file_entry =
extensions::app_file_handler_util::CreateFileEntry(
Profile::FromBrowserContext(browser_context()),
diff --git a/chrome/browser/extensions/api/log_private/log_private_apitest_chromeos.cc b/chrome/browser/extensions/api/log_private/log_private_apitest_chromeos.cc
index bddbdab7..1cb54030 100644
--- a/chrome/browser/extensions/api/log_private/log_private_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/log_private/log_private_apitest_chromeos.cc
@@ -72,13 +72,13 @@
base::FilePath tar_file_path =
test_data_dir_.Append("log_private/dump_logs/system_logs.tar");
chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient(
- scoped_ptr<chromeos::DebugDaemonClient>(
+ std::unique_ptr<chromeos::DebugDaemonClient>(
new TestDebugDaemonClient(tar_file_path)));
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
}
- scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
- scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse);
+ std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
+ std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse);
response->set_code(net::HTTP_OK);
response->set_content(
"<html><head><title>LogPrivateTest</title>"
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
index caeedfeb..8ad8f83e 100644
--- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
+++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -6,6 +6,7 @@
#include "base/callback_helpers.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/bookmark_app_helper.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
@@ -60,7 +61,7 @@
OnInstallPromptDone,
weak_factory_.GetWeakPtr()),
extension, nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
}
~ManagementSetEnabledFunctionInstallPromptDelegate() override {}
@@ -72,7 +73,7 @@
}
// Used for prompting to re-enable items with permissions escalation updates.
- scoped_ptr<ExtensionInstallPrompt> install_prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> install_prompt_;
base::Callback<void(bool)> callback_;
@@ -119,7 +120,8 @@
private:
extensions::ManagementUninstallFunctionBase* function_;
- scoped_ptr<extensions::ExtensionUninstallDialog> extension_uninstall_dialog_;
+ std::unique_ptr<extensions::ExtensionUninstallDialog>
+ extension_uninstall_dialog_;
DISALLOW_COPY_AND_ASSIGN(ManagementUninstallFunctionUninstallDialogDelegate);
};
@@ -155,7 +157,7 @@
function));
}
- scoped_ptr<extensions::BookmarkAppHelper> bookmark_app_helper_;
+ std::unique_ptr<extensions::BookmarkAppHelper> bookmark_app_helper_;
// Used for favicon loading tasks.
base::CancelableTaskTracker cancelable_task_tracker_;
@@ -213,28 +215,28 @@
function));
}
-scoped_ptr<extensions::InstallPromptDelegate>
+std::unique_ptr<extensions::InstallPromptDelegate>
ChromeManagementAPIDelegate::SetEnabledFunctionDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const {
- return scoped_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>(
+ return std::unique_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>(
new ManagementSetEnabledFunctionInstallPromptDelegate(
web_contents, browser_context, extension, callback));
}
-scoped_ptr<extensions::RequirementsChecker>
+std::unique_ptr<extensions::RequirementsChecker>
ChromeManagementAPIDelegate::CreateRequirementsChecker() const {
- return make_scoped_ptr(new extensions::ChromeRequirementsChecker());
+ return base::WrapUnique(new extensions::ChromeRequirementsChecker());
}
-scoped_ptr<extensions::UninstallDialogDelegate>
+std::unique_ptr<extensions::UninstallDialogDelegate>
ChromeManagementAPIDelegate::UninstallFunctionDelegate(
extensions::ManagementUninstallFunctionBase* function,
const extensions::Extension* target_extension,
bool show_programmatic_uninstall_ui) const {
- return scoped_ptr<extensions::UninstallDialogDelegate>(
+ return std::unique_ptr<extensions::UninstallDialogDelegate>(
new ManagementUninstallFunctionUninstallDialogDelegate(
function, target_extension, show_programmatic_uninstall_ui));
}
@@ -260,7 +262,7 @@
return true;
}
-scoped_ptr<extensions::AppForLinkDelegate>
+std::unique_ptr<extensions::AppForLinkDelegate>
ChromeManagementAPIDelegate::GenerateAppForLinkFunctionDelegate(
extensions::ManagementGenerateAppForLinkFunction* function,
content::BrowserContext* context,
@@ -280,7 +282,7 @@
context, title, launch_url),
&delegate->cancelable_task_tracker_);
- return scoped_ptr<extensions::AppForLinkDelegate>(delegate);
+ return std::unique_ptr<extensions::AppForLinkDelegate>(delegate);
}
bool ChromeManagementAPIDelegate::CanHostedAppsOpenInWindows() const {
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.h b/chrome/browser/extensions/api/management/chrome_management_api_delegate.h
index 73c417a..7af6ca90 100644
--- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.h
+++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.h
@@ -30,21 +30,23 @@
void GetPermissionWarningsByManifestFunctionDelegate(
extensions::ManagementGetPermissionWarningsByManifestFunction* function,
const std::string& manifest_str) const override;
- scoped_ptr<extensions::InstallPromptDelegate> SetEnabledFunctionDelegate(
+ std::unique_ptr<extensions::InstallPromptDelegate> SetEnabledFunctionDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const override;
- scoped_ptr<extensions::RequirementsChecker> CreateRequirementsChecker()
+ std::unique_ptr<extensions::RequirementsChecker> CreateRequirementsChecker()
const override;
- scoped_ptr<extensions::UninstallDialogDelegate> UninstallFunctionDelegate(
+ std::unique_ptr<extensions::UninstallDialogDelegate>
+ UninstallFunctionDelegate(
extensions::ManagementUninstallFunctionBase* function,
const extensions::Extension* target_extension,
bool show_programmatic_uninstall_ui) const override;
bool CreateAppShortcutFunctionDelegate(
extensions::ManagementCreateAppShortcutFunction* function,
const extensions::Extension* extension) const override;
- scoped_ptr<extensions::AppForLinkDelegate> GenerateAppForLinkFunctionDelegate(
+ std::unique_ptr<extensions::AppForLinkDelegate>
+ GenerateAppForLinkFunctionDelegate(
extensions::ManagementGenerateAppForLinkFunction* function,
content::BrowserContext* context,
const std::string& title,
diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc
index 3bfa548b..6635667 100644
--- a/chrome/browser/extensions/api/management/management_api_browsertest.cc
+++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -156,8 +156,8 @@
// The management API should list this extension.
scoped_refptr<ManagementGetAllFunction> function =
new ManagementGetAllFunction();
- scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult(
- function.get(), "[]", browser()));
+ std::unique_ptr<base::Value> result(
+ util::RunFunctionAndReturnSingleResult(function.get(), "[]", browser()));
base::ListValue* list;
ASSERT_TRUE(result->GetAsList(&list));
EXPECT_EQ(1U, list->GetSize());
@@ -242,10 +242,8 @@
DisabledReason) {
scoped_refptr<ManagementGetFunction> function =
new ManagementGetFunction();
- scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult(
- function.get(),
- base::StringPrintf("[\"%s\"]", kId),
- browser()));
+ std::unique_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult(
+ function.get(), base::StringPrintf("[\"%s\"]", kId), browser()));
ASSERT_TRUE(result.get() != NULL);
ASSERT_TRUE(result->IsType(base::Value::TYPE_DICTIONARY));
base::DictionaryValue* dict =
diff --git a/chrome/browser/extensions/api/management/management_api_unittest.cc b/chrome/browser/extensions/api/management/management_api_unittest.cc
index 26e0235..abb13248 100644
--- a/chrome/browser/extensions/api/management/management_api_unittest.cc
+++ b/chrome/browser/extensions/api/management/management_api_unittest.cc
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
@@ -28,12 +30,14 @@
namespace {
-scoped_ptr<KeyedService> BuildManagementApi(content::BrowserContext* context) {
- return make_scoped_ptr(new ManagementAPI(context));
+std::unique_ptr<KeyedService> BuildManagementApi(
+ content::BrowserContext* context) {
+ return base::WrapUnique(new ManagementAPI(context));
}
-scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* profile) {
- return make_scoped_ptr(
+std::unique_ptr<KeyedService> BuildEventRouter(
+ content::BrowserContext* profile) {
+ return base::WrapUnique(
new extensions::EventRouter(profile, ExtensionPrefs::Get(profile)));
}
@@ -61,8 +65,8 @@
void TearDown() override;
// The browser (and accompanying window).
- scoped_ptr<TestBrowserWindow> browser_window_;
- scoped_ptr<Browser> browser_;
+ std::unique_ptr<TestBrowserWindow> browser_window_;
+ std::unique_ptr<Browser> browser_;
DISALLOW_COPY_AND_ASSIGN(ManagementApiUnitTest);
};
@@ -71,9 +75,7 @@
const scoped_refptr<UIThreadExtensionFunction>& function,
const base::ListValue& args) {
return extension_function_test_utils::RunFunction(
- function.get(),
- make_scoped_ptr(args.DeepCopy()),
- browser(),
+ function.get(), base::WrapUnique(args.DeepCopy()), browser(),
extension_function_test_utils::NONE);
}
@@ -198,7 +200,7 @@
function->GetError());
// Try again, using showConfirmDialog: false.
- scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue());
options->SetBoolean("showConfirmDialog", false);
uninstall_args.Append(options.release());
function = new ManagementUninstallFunction();
diff --git a/chrome/browser/extensions/api/mdns/dns_sd_registry.cc b/chrome/browser/extensions/api/mdns/dns_sd_registry.cc
index d07e6e4..7649698 100644
--- a/chrome/browser/extensions/api/mdns/dns_sd_registry.cc
+++ b/chrome/browser/extensions/api/mdns/dns_sd_registry.cc
@@ -30,7 +30,7 @@
} // namespace
DnsSdRegistry::ServiceTypeData::ServiceTypeData(
- scoped_ptr<DnsSdDeviceLister> lister)
+ std::unique_ptr<DnsSdDeviceLister> lister)
: ref_count(1), lister_(std::move(lister)) {}
DnsSdRegistry::ServiceTypeData::~ServiceTypeData() {}
@@ -155,8 +155,9 @@
return;
}
- scoped_ptr<DnsSdDeviceLister> dns_sd_device_lister(CreateDnsSdDeviceLister(
- this, service_type, service_discovery_client_.get()));
+ std::unique_ptr<DnsSdDeviceLister> dns_sd_device_lister(
+ CreateDnsSdDeviceLister(this, service_type,
+ service_discovery_client_.get()));
dns_sd_device_lister->Discover(false);
linked_ptr<ServiceTypeData> service_type_data(
new ServiceTypeData(std::move(dns_sd_device_lister)));
diff --git a/chrome/browser/extensions/api/mdns/dns_sd_registry.h b/chrome/browser/extensions/api/mdns/dns_sd_registry.h
index 3c32408..d85f297 100644
--- a/chrome/browser/extensions/api/mdns/dns_sd_registry.h
+++ b/chrome/browser/extensions/api/mdns/dns_sd_registry.h
@@ -6,13 +6,13 @@
#define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h"
@@ -65,7 +65,7 @@
// particular service type.
class ServiceTypeData {
public:
- explicit ServiceTypeData(scoped_ptr<DnsSdDeviceLister> lister);
+ explicit ServiceTypeData(std::unique_ptr<DnsSdDeviceLister> lister);
virtual ~ServiceTypeData();
// Notify the data class of listeners so that it can be reference counted.
@@ -89,7 +89,7 @@
private:
int ref_count;
- scoped_ptr<DnsSdDeviceLister> lister_;
+ std::unique_ptr<DnsSdDeviceLister> lister_;
DnsSdRegistry::DnsSdServiceList service_list_;
DISALLOW_COPY_AND_ASSIGN(ServiceTypeData);
};
diff --git a/chrome/browser/extensions/api/mdns/dns_sd_registry_unittest.cc b/chrome/browser/extensions/api/mdns/dns_sd_registry_unittest.cc
index 8349577..c112d49 100644
--- a/chrome/browser/extensions/api/mdns/dns_sd_registry_unittest.cc
+++ b/chrome/browser/extensions/api/mdns/dns_sd_registry_unittest.cc
@@ -79,7 +79,7 @@
}
protected:
- scoped_ptr<TestDnsSdRegistry> registry_;
+ std::unique_ptr<TestDnsSdRegistry> registry_;
MockDnsSdObserver observer_;
};
diff --git a/chrome/browser/extensions/api/mdns/mdns_api.cc b/chrome/browser/extensions/api/mdns/mdns_api.cc
index 50bab5f..7cf7026 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_api.cc
@@ -63,7 +63,7 @@
}
void MDnsAPI::SetDnsSdRegistryForTesting(
- scoped_ptr<DnsSdRegistry> dns_sd_registry) {
+ std::unique_ptr<DnsSdRegistry> dns_sd_registry) {
dns_sd_registry_ = std::move(dns_sd_registry);
if (dns_sd_registry_.get())
dns_sd_registry_.get()->AddObserver(this);
@@ -170,10 +170,10 @@
args.push_back(std::move(mdns_service));
}
- scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args);
- scoped_ptr<Event> event(new Event(events::MDNS_ON_SERVICE_LIST,
- mdns::OnServiceList::kEventName,
- std::move(results)));
+ std::unique_ptr<base::ListValue> results = mdns::OnServiceList::Create(args);
+ std::unique_ptr<Event> event(new Event(events::MDNS_ON_SERVICE_LIST,
+ mdns::OnServiceList::kEventName,
+ std::move(results)));
event->restrict_to_browser_context = browser_context_;
event->filter_info.SetServiceType(service_type);
diff --git a/chrome/browser/extensions/api/mdns/mdns_api.h b/chrome/browser/extensions/api/mdns/mdns_api.h
index 13d847a..8871d02 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api.h
+++ b/chrome/browser/extensions/api/mdns/mdns_api.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "chrome/browser/extensions/api/mdns/dns_sd_registry.h"
#include "chrome/common/extensions/api/mdns.h"
@@ -45,7 +45,7 @@
static BrowserContextKeyedAPIFactory<MDnsAPI>* GetFactoryInstance();
// Used to mock out the DnsSdRegistry for testing.
- void SetDnsSdRegistryForTesting(scoped_ptr<DnsSdRegistry> registry);
+ void SetDnsSdRegistryForTesting(std::unique_ptr<DnsSdRegistry> registry);
// Immediately issues a multicast DNS query for all service types.
// NOTE: Discovery queries are sent to all event handlers associated with
@@ -110,7 +110,7 @@
base::ThreadChecker thread_checker_;
content::BrowserContext* const browser_context_;
// Lazily created on first access and destroyed with this API class.
- scoped_ptr<DnsSdRegistry> dns_sd_registry_;
+ std::unique_ptr<DnsSdRegistry> dns_sd_registry_;
// Count of active listeners per service type, saved from the previous
// invocation of UpdateMDnsListeners().
ServiceTypeCounts prev_service_counts_;
diff --git a/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc b/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
index 857ae6e..962fde4 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
@@ -5,11 +5,13 @@
#include "chrome/browser/extensions/api/mdns/mdns_api.h"
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include <vector>
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/test_extension_system.h"
@@ -40,7 +42,7 @@
const std::string& extension_id,
const std::string& service_type,
extensions::EventListenerMap::ListenerList* listener_list) {
- scoped_ptr<base::DictionaryValue> filter(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> filter(new base::DictionaryValue);
filter->SetString(kEventFilterServiceTypeKey, service_type);
listener_list->push_back(make_linked_ptr(
EventListener::ForExtension(kEventFilterServiceTypeKey, extension_id,
@@ -69,18 +71,19 @@
const extensions::EventListenerMap::ListenerList&());
};
-scoped_ptr<KeyedService> MockedMDnsAPITestingFactoryFunction(
+std::unique_ptr<KeyedService> MockedMDnsAPITestingFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(new MockedMDnsAPI(context));
+ return base::WrapUnique(new MockedMDnsAPI(context));
}
-scoped_ptr<KeyedService> MDnsAPITestingFactoryFunction(
+std::unique_ptr<KeyedService> MDnsAPITestingFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(new MDnsAPI(context));
+ return base::WrapUnique(new MDnsAPI(context));
}
-scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* context) {
- return make_scoped_ptr(
+std::unique_ptr<KeyedService> BuildEventRouter(
+ content::BrowserContext* context) {
+ return base::WrapUnique(
new extensions::EventRouter(context, ExtensionPrefs::Get(context)));
}
@@ -118,15 +121,15 @@
: EventRouter(browser_context, extension_prefs) {}
virtual ~MockEventRouter() {}
- virtual void BroadcastEvent(scoped_ptr<Event> event) {
+ virtual void BroadcastEvent(std::unique_ptr<Event> event) {
BroadcastEventPtr(event.get());
}
MOCK_METHOD1(BroadcastEventPtr, void(Event* event));
};
-scoped_ptr<KeyedService> MockEventRouterFactoryFunction(
+std::unique_ptr<KeyedService> MockEventRouterFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(
+ return base::WrapUnique(
new MockEventRouter(context, ExtensionPrefs::Get(context)));
}
@@ -207,8 +210,8 @@
EXPECT_CALL(*dns_sd_registry(),
AddObserver(MDnsAPI::Get(browser_context())))
.Times(1);
- MDnsAPI::Get(browser_context())->SetDnsSdRegistryForTesting(
- scoped_ptr<DnsSdRegistry>(registry_));
+ MDnsAPI::Get(browser_context())
+ ->SetDnsSdRegistryForTesting(std::unique_ptr<DnsSdRegistry>(registry_));
render_process_host_.reset(
new content::MockRenderProcessHost(browser_context()));
@@ -267,7 +270,7 @@
// for it, so use a private member.
MockDnsSdRegistry* registry_;
- scoped_ptr<content::RenderProcessHost> render_process_host_;
+ std::unique_ptr<content::RenderProcessHost> render_process_host_;
};
class MDnsAPIMaxServicesTest : public MDnsAPITest {
diff --git a/chrome/browser/extensions/api/mdns/mdns_apitest.cc b/chrome/browser/extensions/api/mdns/mdns_apitest.cc
index 3154afc..c6c26674 100644
--- a/chrome/browser/extensions/api/mdns/mdns_apitest.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_apitest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/mdns/mdns_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
@@ -58,7 +59,7 @@
.Times(1);
// Transfers ownership of the registry instance.
api->SetDnsSdRegistryForTesting(
- make_scoped_ptr<DnsSdRegistry>(dns_sd_registry_));
+ base::WrapUnique<DnsSdRegistry>(dns_sd_registry_));
}
protected:
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 34f14cbe..3b54415 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h"
#include <stddef.h>
+
#include <set>
#include <string>
#include <utility>
@@ -15,6 +16,7 @@
#include "base/callback.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
@@ -157,9 +159,9 @@
APIPermission::kMediaGalleries, &delete_param);
const int child_id = rfh->GetProcess()->GetID();
- scoped_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (size_t i = 0; i < filesystems.size(); ++i) {
- scoped_ptr<base::DictionaryValue> file_system_dict_value(
+ std::unique_ptr<base::DictionaryValue> file_system_dict_value(
new base::DictionaryValue());
// Send the file system id so the renderer can create a valid FileSystem
@@ -314,14 +316,14 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
+ std::unique_ptr<base::ListValue> event_args) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
EventRouter* router = EventRouter::Get(profile_);
if (!router->ExtensionHasEventListener(extension_id, event_name))
return;
- scoped_ptr<extensions::Event> event(new extensions::Event(
+ std::unique_ptr<extensions::Event> event(new extensions::Event(
histogram_value, event_name, std::move(event_args)));
router->DispatchEventToExtension(extension_id, std::move(event));
}
@@ -364,7 +366,7 @@
bool MediaGalleriesGetMediaFileSystemsFunction::RunAsync() {
media_galleries::UsageCount(media_galleries::GET_MEDIA_FILE_SYSTEMS);
- scoped_ptr<GetMediaFileSystems::Params> params(
+ std::unique_ptr<GetMediaFileSystems::Params> params(
GetMediaFileSystems::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
MediaGalleries::GetMediaFileSystemsInteractivity interactive =
@@ -427,7 +429,7 @@
void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries(
const std::vector<MediaFileSystemInfo>& filesystems) {
- scoped_ptr<base::ListValue> list(
+ std::unique_ptr<base::ListValue> list(
ConstructFileSystemList(render_frame_host(), extension(), filesystems));
if (!list.get()) {
SendResponse(false);
@@ -535,7 +537,7 @@
void MediaGalleriesAddUserSelectedFolderFunction::ReturnGalleriesAndId(
MediaGalleryPrefId pref_id,
const std::vector<MediaFileSystemInfo>& filesystems) {
- scoped_ptr<base::ListValue> list(
+ std::unique_ptr<base::ListValue> list(
ConstructFileSystemList(render_frame_host(), extension(), filesystems));
if (!list.get()) {
SendResponse(false);
@@ -584,7 +586,7 @@
const base::Value* options_value = NULL;
if (!args_->Get(1, &options_value))
return false;
- scoped_ptr<MediaGalleries::MediaMetadataOptions> options =
+ std::unique_ptr<MediaGalleries::MediaMetadataOptions> options =
MediaGalleries::MediaMetadataOptions::FromValue(*options_value);
if (!options)
return false;
@@ -612,7 +614,7 @@
void MediaGalleriesGetMetadataFunction::GetMetadata(
MediaGalleries::GetMetadataType metadata_type,
const std::string& blob_uuid,
- scoped_ptr<std::string> blob_header,
+ std::unique_ptr<std::string> blob_header,
int64_t total_blob_length) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -651,8 +653,9 @@
}
void MediaGalleriesGetMetadataFunction::OnSafeMediaMetadataParserDone(
- bool parse_success, scoped_ptr<base::DictionaryValue> metadata_dictionary,
- scoped_ptr<std::vector<metadata::AttachedImage> > attached_images) {
+ bool parse_success,
+ std::unique_ptr<base::DictionaryValue> metadata_dictionary,
+ std::unique_ptr<std::vector<metadata::AttachedImage>> attached_images) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!parse_success) {
@@ -663,7 +666,7 @@
DCHECK(metadata_dictionary.get());
DCHECK(attached_images.get());
- scoped_ptr<base::DictionaryValue> result_dictionary(
+ std::unique_ptr<base::DictionaryValue> result_dictionary(
new base::DictionaryValue);
result_dictionary->Set(kMetadataKey, metadata_dictionary.release());
@@ -676,20 +679,18 @@
result_dictionary->Set(kAttachedImagesBlobInfoKey, new base::ListValue);
metadata::AttachedImage* first_image = &attached_images->front();
content::BrowserContext::CreateMemoryBackedBlob(
- GetProfile(),
- first_image->data.c_str(),
- first_image->data.size(),
- base::Bind(&MediaGalleriesGetMetadataFunction::ConstructNextBlob,
- this, base::Passed(&result_dictionary),
+ GetProfile(), first_image->data.c_str(), first_image->data.size(),
+ base::Bind(&MediaGalleriesGetMetadataFunction::ConstructNextBlob, this,
+ base::Passed(&result_dictionary),
base::Passed(&attached_images),
- base::Passed(make_scoped_ptr(new std::vector<std::string>))));
+ base::Passed(base::WrapUnique(new std::vector<std::string>))));
}
void MediaGalleriesGetMetadataFunction::ConstructNextBlob(
- scoped_ptr<base::DictionaryValue> result_dictionary,
- scoped_ptr<std::vector<metadata::AttachedImage> > attached_images,
- scoped_ptr<std::vector<std::string> > blob_uuids,
- scoped_ptr<content::BlobHandle> current_blob) {
+ std::unique_ptr<base::DictionaryValue> result_dictionary,
+ std::unique_ptr<std::vector<metadata::AttachedImage>> attached_images,
+ std::unique_ptr<std::vector<std::string>> blob_uuids,
+ std::unique_ptr<content::BlobHandle> current_blob) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(result_dictionary.get());
@@ -756,7 +757,7 @@
if (!render_frame_host() || !render_frame_host()->GetProcess())
return false;
- scoped_ptr<AddGalleryWatch::Params> params(
+ std::unique_ptr<AddGalleryWatch::Params> params(
AddGalleryWatch::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -840,7 +841,7 @@
if (!render_frame_host() || !render_frame_host()->GetProcess())
return false;
- scoped_ptr<RemoveGalleryWatch::Params> params(
+ std::unique_ptr<RemoveGalleryWatch::Params> params(
RemoveGalleryWatch::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
index e5f692b7..e092728 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
@@ -10,12 +10,12 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/media_galleries/gallery_watch_manager_observer.h"
@@ -66,7 +66,7 @@
void DispatchEventToExtension(const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
explicit MediaGalleriesEventRouter(content::BrowserContext* context);
~MediaGalleriesEventRouter() override;
@@ -180,18 +180,19 @@
void GetMetadata(MediaGalleries::GetMetadataType metadata_type,
const std::string& blob_uuid,
- scoped_ptr<std::string> blob_header,
+ std::unique_ptr<std::string> blob_header,
int64_t total_blob_length);
void OnSafeMediaMetadataParserDone(
- bool parse_success, scoped_ptr<base::DictionaryValue> result_dictionary,
- scoped_ptr<std::vector<metadata::AttachedImage> > attached_images);
+ bool parse_success,
+ std::unique_ptr<base::DictionaryValue> result_dictionary,
+ std::unique_ptr<std::vector<metadata::AttachedImage>> attached_images);
void ConstructNextBlob(
- scoped_ptr<base::DictionaryValue> result_dictionary,
- scoped_ptr<std::vector<metadata::AttachedImage> > attached_images,
- scoped_ptr<std::vector<std::string> > blob_uuids,
- scoped_ptr<content::BlobHandle> current_blob);
+ std::unique_ptr<base::DictionaryValue> result_dictionary,
+ std::unique_ptr<std::vector<metadata::AttachedImage>> attached_images,
+ std::unique_ptr<std::vector<std::string>> blob_uuids,
+ std::unique_ptr<content::BlobHandle> current_blob);
};
class MediaGalleriesAddGalleryWatchFunction
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
index 95a96e5..e51dd43 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
@@ -264,7 +264,8 @@
std::string device_id_;
base::ScopedTempDir fake_gallery_temp_dir_;
int test_jpg_size_;
- scoped_ptr<EnsureMediaDirectoriesExists> ensure_media_directories_exists_;
+ std::unique_ptr<EnsureMediaDirectoriesExists>
+ ensure_media_directories_exists_;
};
#if !defined(DISABLE_NACL)
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc
index af7306f..0a20950 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc
@@ -172,7 +172,8 @@
EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
}
- scoped_ptr<EnsureMediaDirectoriesExists> ensure_media_directories_exists_;
+ std::unique_ptr<EnsureMediaDirectoriesExists>
+ ensure_media_directories_exists_;
base::ScopedTempDir test_gallery_;
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.cc b/chrome/browser/extensions/api/messaging/extension_message_port.cc
index b517f9e..3225143 100644
--- a/chrome/browser/extensions/api/messaging/extension_message_port.cc
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/messaging/extension_message_port.h"
+#include "base/memory/ptr_util.h"
#include "base/scoped_observer.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/interstitial_page.h"
@@ -180,7 +181,7 @@
void ExtensionMessagePort::DispatchOnConnect(
const std::string& channel_name,
- scoped_ptr<base::DictionaryValue> source_tab,
+ std::unique_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
int guest_process_id,
int guest_render_frame_routing_id,
@@ -200,19 +201,19 @@
info.guest_process_id = guest_process_id;
info.guest_render_frame_routing_id = guest_render_frame_routing_id;
- SendToPort(make_scoped_ptr(new ExtensionMsg_DispatchOnConnect(
+ SendToPort(base::WrapUnique(new ExtensionMsg_DispatchOnConnect(
MSG_ROUTING_NONE, port_id_, channel_name, source, info, tls_channel_id)));
}
void ExtensionMessagePort::DispatchOnDisconnect(
const std::string& error_message) {
- SendToPort(make_scoped_ptr(new ExtensionMsg_DispatchOnDisconnect(
+ SendToPort(base::WrapUnique(new ExtensionMsg_DispatchOnDisconnect(
MSG_ROUTING_NONE, port_id_, error_message)));
}
void ExtensionMessagePort::DispatchOnMessage(const Message& message) {
- SendToPort(make_scoped_ptr(new ExtensionMsg_DeliverMessage(
- MSG_ROUTING_NONE, port_id_, message)));
+ SendToPort(base::WrapUnique(
+ new ExtensionMsg_DeliverMessage(MSG_ROUTING_NONE, port_id_, message)));
}
void ExtensionMessagePort::IncrementLazyKeepaliveCount() {
@@ -276,7 +277,7 @@
CloseChannel();
}
-void ExtensionMessagePort::SendToPort(scoped_ptr<IPC::Message> msg) {
+void ExtensionMessagePort::SendToPort(std::unique_ptr<IPC::Message> msg) {
DCHECK_GT(frames_.size(), 0UL);
if (extension_process_) {
// All extension frames reside in the same process, so we can just send a
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.h b/chrome/browser/extensions/api/messaging/extension_message_port.h
index ac98851..dd6e584 100644
--- a/chrome/browser/extensions/api/messaging/extension_message_port.h
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.h
@@ -46,7 +46,7 @@
bool HasFrame(content::RenderFrameHost* rfh) const override;
bool IsValidPort() override;
void DispatchOnConnect(const std::string& channel_name,
- scoped_ptr<base::DictionaryValue> source_tab,
+ std::unique_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
int guest_process_id,
int guest_render_frame_routing_id,
@@ -75,7 +75,7 @@
void CloseChannel();
// Send a IPC message to the renderer for all registered frames.
- void SendToPort(scoped_ptr<IPC::Message> msg);
+ void SendToPort(std::unique_ptr<IPC::Message> msg);
base::WeakPtr<MessageService> weak_message_service_;
@@ -98,7 +98,7 @@
bool did_create_port_;
ExtensionHost* background_host_ptr_; // used in IncrementLazyKeepaliveCount
- scoped_ptr<FrameTracker> frame_tracker_;
+ std::unique_ptr<FrameTracker> frame_tracker_;
DISALLOW_COPY_AND_ASSIGN(ExtensionMessagePort);
};
diff --git a/chrome/browser/extensions/api/messaging/incognito_connectability.cc b/chrome/browser/extensions/api/messaging/incognito_connectability.cc
index 7c00d4a0..5fcf618 100644
--- a/chrome/browser/extensions/api/messaging/incognito_connectability.cc
+++ b/chrome/browser/extensions/api/messaging/incognito_connectability.cc
@@ -67,7 +67,7 @@
const base::string16& message,
const IncognitoConnectabilityInfoBarDelegate::InfoBarCallback& callback) {
return infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar(
- scoped_ptr<ConfirmInfoBarDelegate>(
+ std::unique_ptr<ConfirmInfoBarDelegate>(
new IncognitoConnectabilityInfoBarDelegate(message, callback))));
}
diff --git a/chrome/browser/extensions/api/messaging/message_property_provider.cc b/chrome/browser/extensions/api/messaging/message_property_provider.cc
index 993b3f5c..078f2f0e 100644
--- a/chrome/browser/extensions/api/messaging/message_property_provider.cc
+++ b/chrome/browser/extensions/api/messaging/message_property_provider.cc
@@ -49,7 +49,7 @@
// ChannelIDService::GetChannelID to the callback provided to
// MessagePropertyProvider::GetChannelID.
struct MessagePropertyProvider::GetChannelIDOutput {
- scoped_ptr<crypto::ECPrivateKey> channel_id_key;
+ std::unique_ptr<crypto::ECPrivateKey> channel_id_key;
net::ChannelIDService::Request request;
};
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc
index e19fc94..507b7ef 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -127,16 +127,16 @@
#endif
struct MessageService::MessageChannel {
- scoped_ptr<MessagePort> opener;
- scoped_ptr<MessagePort> receiver;
+ std::unique_ptr<MessagePort> opener;
+ std::unique_ptr<MessagePort> receiver;
};
struct MessageService::OpenChannelParams {
int source_process_id;
int source_routing_id;
- scoped_ptr<base::DictionaryValue> source_tab;
+ std::unique_ptr<base::DictionaryValue> source_tab;
int source_frame_id;
- scoped_ptr<MessagePort> receiver;
+ std::unique_ptr<MessagePort> receiver;
int receiver_port_id;
std::string source_extension_id;
std::string target_extension_id;
@@ -149,7 +149,7 @@
// Takes ownership of receiver.
OpenChannelParams(int source_process_id,
int source_routing_id,
- scoped_ptr<base::DictionaryValue> source_tab,
+ std::unique_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
MessagePort* receiver,
int receiver_port_id,
@@ -324,7 +324,7 @@
bool include_guest_process_info = false;
// Include info about the opener's tab (if it was a tab).
- scoped_ptr<base::DictionaryValue> source_tab;
+ std::unique_ptr<base::DictionaryValue> source_tab;
int source_frame_id = -1;
if (source_contents && ExtensionTabUtil::GetTabId(source_contents) >= 0) {
// Only the tab id is useful to platform apps for internal use. The
@@ -349,7 +349,7 @@
}
}
- scoped_ptr<OpenChannelParams> params(new OpenChannelParams(
+ std::unique_ptr<OpenChannelParams> params(new OpenChannelParams(
source_process_id, source_routing_id, std::move(source_tab),
source_frame_id, nullptr, receiver_port_id, source_extension_id,
target_extension_id, source_url, channel_name, include_tls_channel_id,
@@ -444,7 +444,7 @@
return;
}
- scoped_ptr<MessageChannel> channel(new MessageChannel());
+ std::unique_ptr<MessageChannel> channel(new MessageChannel());
channel->opener.reset(
new ExtensionMessagePort(weak_factory_.GetWeakPtr(),
GET_OPPOSITE_PORT_ID(receiver_port_id),
@@ -457,12 +457,9 @@
gfx::NativeView native_view = source ? source->GetNativeView() : nullptr;
std::string error = kReceivingEndDoesntExistError;
- scoped_ptr<NativeMessageHost> native_host = NativeMessageHost::Create(
- native_view,
- source_extension_id,
- native_app_name,
- policy_permission == ALLOW_ALL,
- &error);
+ std::unique_ptr<NativeMessageHost> native_host = NativeMessageHost::Create(
+ native_view, source_extension_id, native_app_name,
+ policy_permission == ALLOW_ALL, &error);
// Abandon the channel.
if (!native_host.get()) {
@@ -503,7 +500,7 @@
Profile::FromBrowserContext(source->GetProcess()->GetBrowserContext());
WebContents* contents = NULL;
- scoped_ptr<MessagePort> receiver;
+ std::unique_ptr<MessagePort> receiver;
if (!ExtensionTabUtil::GetTabById(tab_id, profile, true, NULL, NULL,
&contents, NULL) ||
contents->GetController().NeedsReload()) {
@@ -538,11 +535,11 @@
DCHECK(extension);
}
- scoped_ptr<OpenChannelParams> params(new OpenChannelParams(
- source_process_id,
- source_routing_id,
- scoped_ptr<base::DictionaryValue>(), // Source tab doesn't make sense
- // for opening to tabs.
+ std::unique_ptr<OpenChannelParams> params(new OpenChannelParams(
+ source_process_id, source_routing_id,
+ std::unique_ptr<base::DictionaryValue>(), // Source tab doesn't make
+ // sense
+ // for opening to tabs.
-1, // If there is no tab, then there is no frame either.
receiver.release(), receiver_port_id, extension_id, extension_id,
GURL(), // Source URL doesn't make sense for opening to tabs.
@@ -554,7 +551,7 @@
}
void MessageService::OpenChannelImpl(BrowserContext* browser_context,
- scoped_ptr<OpenChannelParams> params,
+ std::unique_ptr<OpenChannelParams> params,
const Extension* target_extension,
bool did_enqueue) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -572,7 +569,7 @@
return;
}
- scoped_ptr<MessagePort> opener(
+ std::unique_ptr<MessagePort> opener(
new ExtensionMessagePort(weak_factory_.GetWeakPtr(),
GET_OPPOSITE_PORT_ID(params->receiver_port_id),
params->source_extension_id, source, false));
@@ -821,7 +818,7 @@
bool MessageService::MaybeAddPendingLazyBackgroundPageOpenChannelTask(
BrowserContext* context,
const Extension* extension,
- scoped_ptr<OpenChannelParams>* params,
+ std::unique_ptr<OpenChannelParams>* params,
const PendingMessagesQueue& pending_messages) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -853,8 +850,9 @@
return true;
}
-void MessageService::OnOpenChannelAllowed(scoped_ptr<OpenChannelParams> params,
- bool allowed) {
+void MessageService::OnOpenChannelAllowed(
+ std::unique_ptr<OpenChannelParams> params,
+ bool allowed) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
int channel_id = GET_CHANNEL_ID(params->receiver_port_id);
@@ -934,7 +932,7 @@
}
}
-void MessageService::GotChannelID(scoped_ptr<OpenChannelParams> params,
+void MessageService::GotChannelID(std::unique_ptr<OpenChannelParams> params,
const std::string& tls_channel_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -978,7 +976,7 @@
}
void MessageService::PendingLazyBackgroundPageOpenChannel(
- scoped_ptr<OpenChannelParams> params,
+ std::unique_ptr<OpenChannelParams> params,
int source_process_id,
ExtensionHost* host) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
diff --git a/chrome/browser/extensions/api/messaging/message_service.h b/chrome/browser/extensions/api/messaging/message_service.h
index 28a0d15..df39bad 100644
--- a/chrome/browser/extensions/api/messaging/message_service.h
+++ b/chrome/browser/extensions/api/messaging/message_service.h
@@ -6,13 +6,13 @@
#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/messaging/message_property_provider.h"
@@ -76,15 +76,16 @@
virtual bool IsValidPort() = 0;
// Notify the port that the channel has been opened.
- virtual void DispatchOnConnect(const std::string& channel_name,
- scoped_ptr<base::DictionaryValue> source_tab,
- int source_frame_id,
- int guest_process_id,
- int guest_render_frame_routing_id,
- const std::string& source_extension_id,
- const std::string& target_extension_id,
- const GURL& source_url,
- const std::string& tls_channel_id) {}
+ virtual void DispatchOnConnect(
+ const std::string& channel_name,
+ std::unique_ptr<base::DictionaryValue> source_tab,
+ int source_frame_id,
+ int guest_process_id,
+ int guest_render_frame_routing_id,
+ const std::string& source_extension_id,
+ const std::string& target_extension_id,
+ const GURL& source_url,
+ const std::string& tls_channel_id) {}
// Notify the port that the channel has been closed. If |error_message| is
// non-empty, it indicates an error occurred while opening the connection.
@@ -209,7 +210,7 @@
// |did_enqueue| will be true if the channel opening was delayed while
// waiting for an event page to start, false otherwise.
void OpenChannelImpl(content::BrowserContext* browser_context,
- scoped_ptr<OpenChannelParams> params,
+ std::unique_ptr<OpenChannelParams> params,
const Extension* target_extension,
bool did_enqueue);
@@ -230,8 +231,9 @@
// If the channel is being opened from an incognito tab the user must allow
// the connection.
- void OnOpenChannelAllowed(scoped_ptr<OpenChannelParams> params, bool allowed);
- void GotChannelID(scoped_ptr<OpenChannelParams> params,
+ void OnOpenChannelAllowed(std::unique_ptr<OpenChannelParams> params,
+ bool allowed);
+ void GotChannelID(std::unique_ptr<OpenChannelParams> params,
const std::string& tls_channel_id);
// Enqueues a message on a pending channel.
@@ -253,14 +255,14 @@
bool MaybeAddPendingLazyBackgroundPageOpenChannelTask(
content::BrowserContext* context,
const Extension* extension,
- scoped_ptr<OpenChannelParams>* params,
+ std::unique_ptr<OpenChannelParams>* params,
const PendingMessagesQueue& pending_messages);
// Callbacks for LazyBackgroundTaskQueue tasks. The queue passes in an
// ExtensionHost to its task callbacks, though some of our callbacks don't
// use that argument.
void PendingLazyBackgroundPageOpenChannel(
- scoped_ptr<OpenChannelParams> params,
+ std::unique_ptr<OpenChannelParams> params,
int source_process_id,
extensions::ExtensionHost* host);
void PendingLazyBackgroundPageClosePort(int port_id,
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
index 3164c8e..e2824c4 100644
--- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/api/messaging/native_message_host.h"
+#include <memory>
#include <string>
#include <utility>
@@ -13,7 +14,6 @@
#include "base/json/json_writer.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/thread_task_runner_handle.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
@@ -44,8 +44,8 @@
class EchoHost : public NativeMessageHost {
public:
- static scoped_ptr<NativeMessageHost> Create() {
- return scoped_ptr<NativeMessageHost>(new EchoHost());
+ static std::unique_ptr<NativeMessageHost> Create() {
+ return std::unique_ptr<NativeMessageHost>(new EchoHost());
}
EchoHost() : message_number_(0), client_(NULL) {}
@@ -53,10 +53,10 @@
void Start(Client* client) override { client_ = client; }
void OnMessage(const std::string& request_string) override {
- scoped_ptr<base::Value> request_value =
+ std::unique_ptr<base::Value> request_value =
base::JSONReader::Read(request_string);
- scoped_ptr<base::DictionaryValue> request(
- static_cast<base::DictionaryValue*>(request_value.release()));
+ std::unique_ptr<base::DictionaryValue> request(
+ static_cast<base::DictionaryValue*>(request_value.release()));
if (request_string.find("stopHostTest") != std::string::npos) {
client_->CloseChannel(kNativeHostExited);
} else if (request_string.find("bigMessageTest") != std::string::npos) {
@@ -91,14 +91,14 @@
const char* const name;
const char* const* const allowed_origins;
int allowed_origins_count;
- scoped_ptr<NativeMessageHost>(*create_function)();
+ std::unique_ptr<NativeMessageHost> (*create_function)();
};
-scoped_ptr<NativeMessageHost> CreateIt2MeHost() {
- scoped_ptr<remoting::It2MeHostFactory> host_factory(
+std::unique_ptr<NativeMessageHost> CreateIt2MeHost() {
+ std::unique_ptr<remoting::It2MeHostFactory> host_factory(
new remoting::It2MeHostFactory());
host_factory->set_policy_service(g_browser_process->policy_service());
- scoped_ptr<remoting::ChromotingHostContext> context =
+ std::unique_ptr<remoting::ChromotingHostContext> context =
remoting::ChromotingHostContext::CreateForChromeOS(
make_scoped_refptr(g_browser_process->system_request_context()),
content::BrowserThread::GetMessageLoopProxyForThread(
@@ -107,8 +107,9 @@
content::BrowserThread::UI),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::FILE));
- scoped_ptr<NativeMessageHost> host(new remoting::It2MeNativeMessagingHost(
- std::move(context), std::move(host_factory)));
+ std::unique_ptr<NativeMessageHost> host(
+ new remoting::It2MeNativeMessagingHost(std::move(context),
+ std::move(host_factory)));
return host;
}
@@ -156,7 +157,7 @@
} // namespace
-scoped_ptr<NativeMessageHost> NativeMessageHost::Create(
+std::unique_ptr<NativeMessageHost> NativeMessageHost::Create(
gfx::NativeView native_view,
const std::string& source_extension_id,
const std::string& native_host_name,
diff --git a/chrome/browser/extensions/api/messaging/native_message_port.cc b/chrome/browser/extensions/api/messaging/native_message_port.cc
index dc97cf8..7ed697e 100644
--- a/chrome/browser/extensions/api/messaging/native_message_port.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_port.cc
@@ -22,7 +22,7 @@
class NativeMessagePort::Core : public NativeMessageHost::Client {
public:
Core(
- scoped_ptr<NativeMessageHost> host,
+ std::unique_ptr<NativeMessageHost> host,
base::WeakPtr<NativeMessagePort> port,
scoped_refptr<base::SingleThreadTaskRunner> message_service_task_runner_);
~Core() override;
@@ -34,7 +34,7 @@
void CloseChannel(const std::string& error_message) override;
private:
- scoped_ptr<NativeMessageHost> host_;
+ std::unique_ptr<NativeMessageHost> host_;
base::WeakPtr<NativeMessagePort> port_;
scoped_refptr<base::SingleThreadTaskRunner> message_service_task_runner_;
@@ -42,7 +42,7 @@
};
NativeMessagePort::Core::Core(
- scoped_ptr<NativeMessageHost> host,
+ std::unique_ptr<NativeMessageHost> host,
base::WeakPtr<NativeMessagePort> port,
scoped_refptr<base::SingleThreadTaskRunner> message_service_task_runner)
: host_(std::move(host)),
@@ -87,7 +87,7 @@
NativeMessagePort::NativeMessagePort(
base::WeakPtr<MessageService> message_service,
int port_id,
- scoped_ptr<NativeMessageHost> native_message_host)
+ std::unique_ptr<NativeMessageHost> native_message_host)
: weak_message_service_(message_service),
host_task_runner_(native_message_host->task_runner()),
port_id_(port_id),
diff --git a/chrome/browser/extensions/api/messaging/native_message_port.h b/chrome/browser/extensions/api/messaging/native_message_port.h
index a19485f..9437d35b 100644
--- a/chrome/browser/extensions/api/messaging/native_message_port.h
+++ b/chrome/browser/extensions/api/messaging/native_message_port.h
@@ -17,7 +17,7 @@
public:
NativeMessagePort(base::WeakPtr<MessageService> message_service,
int port_id,
- scoped_ptr<NativeMessageHost> native_message_host);
+ std::unique_ptr<NativeMessageHost> native_message_host);
~NativeMessagePort() override;
// MessageService::MessagePort implementation.
@@ -33,7 +33,7 @@
base::WeakPtr<MessageService> weak_message_service_;
scoped_refptr<base::SingleThreadTaskRunner> host_task_runner_;
int port_id_;
- scoped_ptr<Core> core_;
+ std::unique_ptr<Core> core_;
base::WeakPtrFactory<NativeMessagePort> weak_factory_;
};
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
index a26df3e..681ec348 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -44,7 +44,7 @@
NativeMessageProcessHost::NativeMessageProcessHost(
const std::string& source_extension_id,
const std::string& native_host_name,
- scoped_ptr<NativeProcessLauncher> launcher)
+ std::unique_ptr<NativeProcessLauncher> launcher)
: client_(NULL),
source_extension_id_(source_extension_id),
native_host_name_(native_host_name),
@@ -80,7 +80,7 @@
}
// static
-scoped_ptr<NativeMessageHost> NativeMessageHost::Create(
+std::unique_ptr<NativeMessageHost> NativeMessageHost::Create(
gfx::NativeView native_view,
const std::string& source_extension_id,
const std::string& native_host_name,
@@ -93,13 +93,13 @@
}
// static
-scoped_ptr<NativeMessageHost> NativeMessageProcessHost::CreateWithLauncher(
+std::unique_ptr<NativeMessageHost> NativeMessageProcessHost::CreateWithLauncher(
const std::string& source_extension_id,
const std::string& native_host_name,
- scoped_ptr<NativeProcessLauncher> launcher) {
+ std::unique_ptr<NativeProcessLauncher> launcher) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<NativeMessageHost> process(new NativeMessageProcessHost(
+ std::unique_ptr<NativeMessageHost> process(new NativeMessageProcessHost(
source_extension_id, native_host_name, std::move(launcher)));
return process;
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.h b/chrome/browser/extensions/api/messaging/native_message_process_host.h
index e667cbd..cefb070 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.h
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H_
#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H_
+#include <memory>
#include <queue>
#include <string>
#include "base/files/file.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/process/process.h"
#include "build/build_config.h"
@@ -44,10 +44,10 @@
~NativeMessageProcessHost() override;
// Create using specified |launcher|. Used in tests.
- static scoped_ptr<NativeMessageHost> CreateWithLauncher(
+ static std::unique_ptr<NativeMessageHost> CreateWithLauncher(
const std::string& source_extension_id,
const std::string& native_host_name,
- scoped_ptr<NativeProcessLauncher> launcher);
+ std::unique_ptr<NativeProcessLauncher> launcher);
// extensions::NativeMessageHost implementation.
void OnMessage(const std::string& message) override;
@@ -67,7 +67,7 @@
private:
NativeMessageProcessHost(const std::string& source_extension_id,
const std::string& native_host_name,
- scoped_ptr<NativeProcessLauncher> launcher);
+ std::unique_ptr<NativeProcessLauncher> launcher);
// Starts the host process.
void LaunchHostProcess();
@@ -104,7 +104,7 @@
std::string native_host_name_;
// Launcher used to launch the native process.
- scoped_ptr<NativeProcessLauncher> launcher_;
+ std::unique_ptr<NativeProcessLauncher> launcher_;
// Set to true after the native messaging connection has been stopped, e.g.
// due to an error.
@@ -113,7 +113,7 @@
base::Process process_;
// Input stream reader.
- scoped_ptr<net::FileStream> read_stream_;
+ std::unique_ptr<net::FileStream> read_stream_;
#if defined(OS_POSIX)
base::PlatformFile read_file_;
@@ -121,7 +121,7 @@
#endif // !defined(OS_POSIX)
// Write stream.
- scoped_ptr<net::FileStream> write_stream_;
+ std::unique_ptr<net::FileStream> write_stream_;
// Read buffer passed to FileStream::Read().
scoped_refptr<net::IOBuffer> read_buffer_;
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
index 3dd4d8a4..15e9495 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
@@ -6,6 +6,8 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -15,7 +17,6 @@
#include "base/files/scoped_file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
@@ -56,20 +57,21 @@
FakeLauncher(base::File read_file, base::File write_file)
: read_file_(std::move(read_file)), write_file_(std::move(write_file)) {}
- static scoped_ptr<NativeProcessLauncher> Create(base::FilePath read_file,
- base::FilePath write_file) {
+ static std::unique_ptr<NativeProcessLauncher> Create(
+ base::FilePath read_file,
+ base::FilePath write_file) {
int read_flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
int write_flags = base::File::FLAG_CREATE | base::File::FLAG_WRITE;
#if !defined(OS_POSIX)
read_flags |= base::File::FLAG_ASYNC;
write_flags |= base::File::FLAG_ASYNC;
#endif
- return scoped_ptr<NativeProcessLauncher>(new FakeLauncher(
- base::File(read_file, read_flags),
- base::File(write_file, write_flags)));
+ return std::unique_ptr<NativeProcessLauncher>(
+ new FakeLauncher(base::File(read_file, read_flags),
+ base::File(write_file, write_flags)));
}
- static scoped_ptr<NativeProcessLauncher> CreateWithPipeInput(
+ static std::unique_ptr<NativeProcessLauncher> CreateWithPipeInput(
base::File read_pipe,
base::FilePath write_file) {
int write_flags = base::File::FLAG_CREATE | base::File::FLAG_WRITE;
@@ -77,7 +79,7 @@
write_flags |= base::File::FLAG_ASYNC;
#endif
- return scoped_ptr<NativeProcessLauncher>(new FakeLauncher(
+ return std::unique_ptr<NativeProcessLauncher>(new FakeLauncher(
std::move(read_pipe), base::File(write_file, write_flags)));
}
@@ -116,7 +118,7 @@
last_message_ = message;
// Parse the message.
- scoped_ptr<base::DictionaryValue> dict_value =
+ std::unique_ptr<base::DictionaryValue> dict_value =
base::DictionaryValue::From(base::JSONReader::Read(message));
if (dict_value) {
last_message_parsed_ = std::move(dict_value);
@@ -159,11 +161,11 @@
base::ScopedTempDir temp_dir_;
// Force the channel to be dev.
ScopedCurrentChannel current_channel_;
- scoped_ptr<NativeMessageHost> native_message_host_;
- scoped_ptr<base::RunLoop> run_loop_;
+ std::unique_ptr<NativeMessageHost> native_message_host_;
+ std::unique_ptr<base::RunLoop> run_loop_;
content::TestBrowserThreadBundle thread_bundle_;
std::string last_message_;
- scoped_ptr<base::DictionaryValue> last_message_parsed_;
+ std::unique_ptr<base::DictionaryValue> last_message_parsed_;
bool channel_closed_;
};
@@ -173,7 +175,7 @@
base::FilePath temp_input_file = CreateTempFileWithMessage(kTestMessage);
ASSERT_FALSE(temp_input_file.empty());
- scoped_ptr<NativeProcessLauncher> launcher =
+ std::unique_ptr<NativeProcessLauncher> launcher =
FakeLauncher::Create(temp_input_file, temp_output_file);
native_message_host_ = NativeMessageProcessHost::CreateWithLauncher(
ScopedTestNativeMessagingHost::kExtensionId, "empty_app.py",
@@ -185,7 +187,7 @@
if (last_message_.empty()) {
run_loop_.reset(new base::RunLoop());
- scoped_ptr<NativeMessageProcessHost> native_message_process_host_(
+ std::unique_ptr<NativeMessageProcessHost> native_message_process_host_(
static_cast<NativeMessageProcessHost*>(native_message_host_.release()));
native_message_process_host_->ReadNowForTesting();
run_loop_->Run();
@@ -221,7 +223,7 @@
base::File write_file(pipe_handles[1]);
#endif // !defined(OS_WIN)
- scoped_ptr<NativeProcessLauncher> launcher =
+ std::unique_ptr<NativeProcessLauncher> launcher =
FakeLauncher::CreateWithPipeInput(std::move(read_file), temp_output_file);
native_message_host_ = NativeMessageProcessHost::CreateWithLauncher(
ScopedTestNativeMessagingHost::kExtensionId, "empty_app.py",
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.cc b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.cc
index 34e87c2c..27a6f99 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.cc
+++ b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.cc
@@ -40,28 +40,28 @@
}
// static
-scoped_ptr<NativeMessagingHostManifest> NativeMessagingHostManifest::Load(
+std::unique_ptr<NativeMessagingHostManifest> NativeMessagingHostManifest::Load(
const base::FilePath& file_path,
std::string* error_message) {
DCHECK(error_message);
JSONFileValueDeserializer deserializer(file_path);
- scoped_ptr<base::Value> parsed =
+ std::unique_ptr<base::Value> parsed =
deserializer.Deserialize(NULL, error_message);
if (!parsed) {
- return scoped_ptr<NativeMessagingHostManifest>();
+ return std::unique_ptr<NativeMessagingHostManifest>();
}
base::DictionaryValue* dictionary;
if (!parsed->GetAsDictionary(&dictionary)) {
*error_message = "Invalid manifest file.";
- return scoped_ptr<NativeMessagingHostManifest>();
+ return std::unique_ptr<NativeMessagingHostManifest>();
}
- scoped_ptr<NativeMessagingHostManifest> result(
+ std::unique_ptr<NativeMessagingHostManifest> result(
new NativeMessagingHostManifest());
if (!result->Parse(dictionary, error_message)) {
- return scoped_ptr<NativeMessagingHostManifest>();
+ return std::unique_ptr<NativeMessagingHostManifest>();
}
return result;
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h
index a3d3d2d..6f52823263 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h
+++ b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H_
#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_HOST_MANIFEST_H_
+#include <memory>
#include <string>
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/common/url_pattern_set.h"
namespace base {
@@ -31,7 +31,7 @@
static bool IsValidName(const std::string& name);
// Load manifest file from |file_path|.
- static scoped_ptr<NativeMessagingHostManifest> Load(
+ static std::unique_ptr<NativeMessagingHostManifest> Load(
const base::FilePath& file_path,
std::string* error_message);
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
index bb49845..1600a20ee 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
@@ -74,7 +74,7 @@
ASSERT_TRUE(WriteManifest(kTestHostName, kTestHostPath, kTestOrigin));
std::string error_message;
- scoped_ptr<NativeMessagingHostManifest> manifest =
+ std::unique_ptr<NativeMessagingHostManifest> manifest =
NativeMessagingHostManifest::Load(manifest_path_, &error_message);
ASSERT_TRUE(manifest) << "Failed to load manifest: " << error_message;
EXPECT_TRUE(error_message.empty());
@@ -95,7 +95,7 @@
kTestHostPath, kTestOrigin));
std::string error_message;
- scoped_ptr<NativeMessagingHostManifest> manifest =
+ std::unique_ptr<NativeMessagingHostManifest> manifest =
NativeMessagingHostManifest::Load(manifest_path_, &error_message);
ASSERT_FALSE(manifest);
EXPECT_FALSE(error_message.empty());
@@ -107,7 +107,7 @@
"chrome-extension://*/"));
std::string error_message;
- scoped_ptr<NativeMessagingHostManifest> manifest =
+ std::unique_ptr<NativeMessagingHostManifest> manifest =
NativeMessagingHostManifest::Load(manifest_path_, &error_message);
ASSERT_FALSE(manifest);
EXPECT_FALSE(error_message.empty());
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.cc b/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.cc
index 91dc7c3..129798f 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.cc
+++ b/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.cc
@@ -36,7 +36,7 @@
void NativeMessagingHostListPolicyHandler::ApplyPolicySettings(
const policy::PolicyMap& policies,
PrefValueMap* prefs) {
- scoped_ptr<base::ListValue> list;
+ std::unique_ptr<base::ListValue> list;
policy::PolicyErrorMap errors;
if (CheckAndGetList(policies, &errors, &list) && list)
prefs->SetValue(pref_path(), std::move(list));
@@ -49,7 +49,7 @@
bool NativeMessagingHostListPolicyHandler::CheckAndGetList(
const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors,
- scoped_ptr<base::ListValue>* names) {
+ std::unique_ptr<base::ListValue>* names) {
const base::Value* value = NULL;
if (!CheckAndGetValue(policies, errors, &value))
return false;
@@ -64,7 +64,7 @@
}
// Filter the list, rejecting any invalid native messaging host names.
- scoped_ptr<base::ListValue> filtered_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> filtered_list(new base::ListValue());
for (base::ListValue::const_iterator entry(list_value->begin());
entry != list_value->end(); ++entry) {
std::string name;
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.h b/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.h
index b2b601b..5257812b 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.h
+++ b/chrome/browser/extensions/api/messaging/native_messaging_policy_handler.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_
#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/policy/core/browser/configuration_policy_handler.h"
@@ -39,7 +40,7 @@
// Runs sanity checks on the policy value and returns it in |extension_ids|.
bool CheckAndGetList(const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors,
- scoped_ptr<base::ListValue>* extension_ids);
+ std::unique_ptr<base::ListValue>* extension_ids);
private:
const char* pref_path_;
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc b/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc
index 9e70389..0c69447 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc
+++ b/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc
@@ -4,9 +4,10 @@
#include "chrome/browser/extensions/api/messaging/native_messaging_test_util.h"
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -27,13 +28,13 @@
const std::string& host_name,
const base::FilePath& host_path,
bool user_level) {
- scoped_ptr<base::DictionaryValue> manifest(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> manifest(new base::DictionaryValue());
manifest->SetString("name", host_name);
manifest->SetString("description", "Native Messaging Echo Test");
manifest->SetString("type", "stdio");
manifest->SetString("path", host_path.AsUTF8Unsafe());
- scoped_ptr<base::ListValue> origins(new base::ListValue());
+ std::unique_ptr<base::ListValue> origins(new base::ListValue());
origins->AppendString(base::StringPrintf(
"chrome-extension://%s/", ScopedTestNativeMessagingHost::kExtensionId));
manifest->Set("allowed_origins", origins.release());
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_test_util.h b/chrome/browser/extensions/api/messaging/native_messaging_test_util.h
index fb3798f..0757bf7 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_test_util.h
+++ b/chrome/browser/extensions/api/messaging/native_messaging_test_util.h
@@ -5,9 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_TEST_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_TEST_UTIL_H_
+#include <memory>
+
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#if defined(OS_WIN)
@@ -41,7 +42,7 @@
#if defined(OS_WIN)
registry_util::RegistryOverrideManager registry_override_;
#else
- scoped_ptr<base::ScopedPathOverride> path_override_;
+ std::unique_ptr<base::ScopedPathOverride> path_override_;
#endif
DISALLOW_COPY_AND_ASSIGN(ScopedTestNativeMessagingHost);
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.cc b/chrome/browser/extensions/api/messaging/native_process_launcher.cc
index 224664c..f297d989 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher.cc
@@ -140,7 +140,7 @@
return;
}
- scoped_ptr<NativeMessagingHostManifest> manifest =
+ std::unique_ptr<NativeMessagingHostManifest> manifest =
NativeMessagingHostManifest::Load(manifest_path, &error_message);
if (!manifest) {
@@ -266,7 +266,7 @@
} // namespace
// static
-scoped_ptr<NativeProcessLauncher> NativeProcessLauncher::CreateDefault(
+std::unique_ptr<NativeProcessLauncher> NativeProcessLauncher::CreateDefault(
bool allow_user_level_hosts,
gfx::NativeView native_view) {
intptr_t window_handle = 0;
@@ -274,7 +274,7 @@
window_handle = reinterpret_cast<intptr_t>(
views::HWNDForNativeView(native_view));
#endif
- return scoped_ptr<NativeProcessLauncher>(
+ return std::unique_ptr<NativeProcessLauncher>(
new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle));
}
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.h b/chrome/browser/extensions/api/messaging/native_process_launcher.h
index 6f6e653..8ebf09c 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher.h
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher.h
@@ -5,10 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_
#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_PROCESS_LAUNCHER_H_
+#include <memory>
+
#include "base/callback_forward.h"
#include "base/files/file.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/process/process.h"
#include "ui/gfx/native_widget_types.h"
@@ -42,7 +43,7 @@
// Creates default launcher for the current OS. |native_view| refers to the
// window that contains calling page. Can be nullptr, e.g. for background
// pages.
- static scoped_ptr<NativeProcessLauncher> CreateDefault(
+ static std::unique_ptr<NativeProcessLauncher> CreateDefault(
bool allow_user_level_hosts,
gfx::NativeView native_view);
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
index be443958..1d51922f 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
@@ -140,7 +140,7 @@
LOG(ERROR) << "COMSPEC is not set";
return false;
}
- scoped_ptr<wchar_t[]> comspec(new wchar_t[comspec_length]);
+ std::unique_ptr<wchar_t[]> comspec(new wchar_t[comspec_length]);
::GetEnvironmentVariable(L"COMSPEC", comspec.get(), comspec_length);
base::string16 command_line_string = command_line.GetCommandLineString();
diff --git a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
index 3160400..83b6a7f 100644
--- a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
@@ -107,7 +107,7 @@
for (j = 0; j < histograms.size(); ++j) {
base::HistogramBase* histogram(histograms[j]);
if (r.name == histogram->histogram_name()) {
- scoped_ptr<base::HistogramSamples> snapshot =
+ std::unique_ptr<base::HistogramSamples> snapshot =
histogram->SnapshotSamples();
base::HistogramBase::Count sample_count = snapshot->TotalCount();
EXPECT_EQ(r.count, sample_count);
diff --git a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
index 141e926e..4ba270d 100644
--- a/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
@@ -56,7 +56,7 @@
}
bool MetricsPrivateGetVariationParamsFunction::RunSync() {
- scoped_ptr<GetVariationParams::Params> params(
+ std::unique_ptr<GetVariationParams::Params> params(
GetVariationParams::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -69,7 +69,7 @@
}
bool MetricsPrivateRecordUserActionFunction::RunSync() {
- scoped_ptr<RecordUserAction::Params> params(
+ std::unique_ptr<RecordUserAction::Params> params(
RecordUserAction::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -114,7 +114,8 @@
}
bool MetricsPrivateRecordValueFunction::RunSync() {
- scoped_ptr<RecordValue::Params> params(RecordValue::Params::Create(*args_));
+ std::unique_ptr<RecordValue::Params> params(
+ RecordValue::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Get the histogram parameters from the metric type object.
@@ -128,7 +129,7 @@
}
bool MetricsPrivateRecordSparseValueFunction::RunSync() {
- scoped_ptr<RecordSparseValue::Params> params(
+ std::unique_ptr<RecordSparseValue::Params> params(
RecordSparseValue::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// This particular UMA_HISTOGRAM_ macro is okay for
@@ -138,7 +139,7 @@
}
bool MetricsPrivateRecordPercentageFunction::RunSync() {
- scoped_ptr<RecordPercentage::Params> params(
+ std::unique_ptr<RecordPercentage::Params> params(
RecordPercentage::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
return RecordValue(params->metric_name, base::LINEAR_HISTOGRAM,
@@ -146,14 +147,15 @@
}
bool MetricsPrivateRecordCountFunction::RunSync() {
- scoped_ptr<RecordCount::Params> params(RecordCount::Params::Create(*args_));
+ std::unique_ptr<RecordCount::Params> params(
+ RecordCount::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
return RecordValue(params->metric_name, base::HISTOGRAM,
1, 1000000, 50, params->value);
}
bool MetricsPrivateRecordSmallCountFunction::RunSync() {
- scoped_ptr<RecordSmallCount::Params> params(
+ std::unique_ptr<RecordSmallCount::Params> params(
RecordSmallCount::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
return RecordValue(params->metric_name, base::HISTOGRAM,
@@ -161,7 +163,7 @@
}
bool MetricsPrivateRecordMediumCountFunction::RunSync() {
- scoped_ptr<RecordMediumCount::Params> params(
+ std::unique_ptr<RecordMediumCount::Params> params(
RecordMediumCount::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
return RecordValue(params->metric_name, base::HISTOGRAM,
@@ -169,7 +171,8 @@
}
bool MetricsPrivateRecordTimeFunction::RunSync() {
- scoped_ptr<RecordTime::Params> params(RecordTime::Params::Create(*args_));
+ std::unique_ptr<RecordTime::Params> params(
+ RecordTime::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
static const int kTenSecMs = 10 * 1000;
return RecordValue(params->metric_name, base::HISTOGRAM,
@@ -177,7 +180,7 @@
}
bool MetricsPrivateRecordMediumTimeFunction::RunSync() {
- scoped_ptr<RecordMediumTime::Params> params(
+ std::unique_ptr<RecordMediumTime::Params> params(
RecordMediumTime::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
static const int kThreeMinMs = 3 * 60 * 1000;
@@ -186,7 +189,7 @@
}
bool MetricsPrivateRecordLongTimeFunction::RunSync() {
- scoped_ptr<RecordLongTime::Params> params(
+ std::unique_ptr<RecordLongTime::Params> params(
RecordLongTime::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
static const int kOneHourMs = 60 * 60 * 1000;
diff --git a/chrome/browser/extensions/api/networking_private/crypto_verify_impl.cc b/chrome/browser/extensions/api/networking_private/crypto_verify_impl.cc
index 3a08745..bc51164 100644
--- a/chrome/browser/extensions/api/networking_private/crypto_verify_impl.cc
+++ b/chrome/browser/extensions/api/networking_private/crypto_verify_impl.cc
@@ -138,7 +138,7 @@
// Start getting credentials. CredentialsGetterCompleted will be called on
// completion. On Windows it will be called from a different thread after
// |credentials_getter| is deleted.
- scoped_ptr<NetworkingPrivateCredentialsGetter> credentials_getter(
+ std::unique_ptr<NetworkingPrivateCredentialsGetter> credentials_getter(
NetworkingPrivateCredentialsGetter::Create());
credentials_getter->Start(guid, decoded_public_key,
base::Bind(&CredentialsGetterCompleted,
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
index 85b1c50..be74629c 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
@@ -3,14 +3,16 @@
// found in the LICENSE file.
#include <stddef.h>
+
#include <map>
+#include <memory>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -38,7 +40,7 @@
class TestDelegate : public NetworkingPrivateDelegate {
public:
- explicit TestDelegate(scoped_ptr<VerifyDelegate> verify_delegate)
+ explicit TestDelegate(std::unique_ptr<VerifyDelegate> verify_delegate)
: NetworkingPrivateDelegate(std::move(verify_delegate)), fail_(false) {}
~TestDelegate() override {}
@@ -63,14 +65,14 @@
}
void SetProperties(const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override {
VoidResult(success_callback, failure_callback);
}
void CreateNetwork(bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) override {
StringResult(success_callback, failure_callback);
@@ -91,8 +93,8 @@
if (fail_) {
failure_callback.Run(kFailure);
} else {
- scoped_ptr<base::ListValue> result(new base::ListValue);
- scoped_ptr<base::DictionaryValue> network(new base::DictionaryValue);
+ std::unique_ptr<base::ListValue> result(new base::ListValue);
+ std::unique_ptr<base::DictionaryValue> network(new base::DictionaryValue);
network->SetString(::onc::network_config::kType,
::onc::network_config::kEthernet);
network->SetString(::onc::network_config::kGUID, kGuid);
@@ -159,8 +161,8 @@
}
// Synchronous methods
- scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override {
- scoped_ptr<base::ListValue> result;
+ std::unique_ptr<base::ListValue> GetEnabledNetworkTypes() override {
+ std::unique_ptr<base::ListValue> result;
if (!fail_) {
result.reset(new base::ListValue);
result->AppendString(::onc::network_config::kEthernet);
@@ -168,12 +170,12 @@
return result;
}
- scoped_ptr<DeviceStateList> GetDeviceStateList() override {
- scoped_ptr<DeviceStateList> result;
+ std::unique_ptr<DeviceStateList> GetDeviceStateList() override {
+ std::unique_ptr<DeviceStateList> result;
if (fail_)
return result;
result.reset(new DeviceStateList);
- scoped_ptr<api::networking_private::DeviceStateProperties> properties(
+ std::unique_ptr<api::networking_private::DeviceStateProperties> properties(
new api::networking_private::DeviceStateProperties);
properties->type = api::networking_private::NETWORK_TYPE_ETHERNET;
properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED;
@@ -207,7 +209,7 @@
if (fail_) {
failure_callback.Run(kFailure);
} else {
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->SetString(::onc::network_config::kGUID, guid);
result->SetString(::onc::network_config::kType,
::onc::network_config::kWiFi);
@@ -291,17 +293,17 @@
NetworkingPrivateApiTest() {
if (!s_test_delegate_) {
TestVerifyDelegate* verify_delegate = new TestVerifyDelegate;
- scoped_ptr<NetworkingPrivateDelegate::VerifyDelegate> verify_delegate_ptr(
- verify_delegate);
+ std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate>
+ verify_delegate_ptr(verify_delegate);
s_test_delegate_ = new TestDelegate(std::move(verify_delegate_ptr));
verify_delegate->set_owner(s_test_delegate_);
}
}
- static scoped_ptr<KeyedService> GetNetworkingPrivateDelegate(
+ static std::unique_ptr<KeyedService> GetNetworkingPrivateDelegate(
content::BrowserContext* profile) {
CHECK(s_test_delegate_);
- return make_scoped_ptr(s_test_delegate_);
+ return base::WrapUnique(s_test_delegate_);
}
void SetUpCommandLine(base::CommandLine* command_line) override {
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
index 32709b6..1b1e04a 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
@@ -267,12 +267,12 @@
state, true /* add_to_visible */);
}
- static scoped_ptr<KeyedService> CreateNetworkingPrivateServiceClient(
+ static std::unique_ptr<KeyedService> CreateNetworkingPrivateServiceClient(
content::BrowserContext* context) {
- scoped_ptr<CryptoVerifyStub> crypto_verify(new CryptoVerifyStub);
- scoped_ptr<NetworkingPrivateDelegate> result(
+ std::unique_ptr<CryptoVerifyStub> crypto_verify(new CryptoVerifyStub);
+ std::unique_ptr<NetworkingPrivateDelegate> result(
new NetworkingPrivateChromeOS(context, std::move(crypto_verify)));
- scoped_ptr<NetworkingPrivateDelegate::UIDelegate> ui_delegate(
+ std::unique_ptr<NetworkingPrivateDelegate::UIDelegate> ui_delegate(
new UIDelegateStub);
result->set_ui_delegate(std::move(ui_delegate));
return std::move(result);
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_credentials_getter_mac.cc b/chrome/browser/extensions/api/networking_private/networking_private_credentials_getter_mac.cc
index d997fd7..15176cc7 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_credentials_getter_mac.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_credentials_getter_mac.cc
@@ -7,10 +7,11 @@
#include <Security/Security.h>
#include <stdint.h>
+#include <memory>
+
#include "base/base64.h"
#include "base/bind.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/api/networking_private/networking_private_crypto.h"
#include "components/wifi/wifi_service.h"
#include "content/public/browser/browser_thread.h"
@@ -46,7 +47,7 @@
const std::string& network_guid,
const std::string& public_key,
const CredentialsCallback& callback) {
- scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
+ std::unique_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
wifi_service->Initialize(NULL);
std::string key_data;
std::string error;
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc
index ecb8d09..574cd83 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/networking_private/networking_private_credentials_getter.h"
#include "chrome/browser/extensions/extension_apitest.h"
@@ -86,11 +86,12 @@
"epcifkihnkjgphfkloaaleeakhpmgdmn");
}
- static scoped_ptr<KeyedService> CreateNetworkingPrivateServiceClient(
+ static std::unique_ptr<KeyedService> CreateNetworkingPrivateServiceClient(
content::BrowserContext* context) {
- scoped_ptr<wifi::FakeWiFiService> wifi_service(new wifi::FakeWiFiService());
- scoped_ptr<CryptoVerifyStub> crypto_verify(new CryptoVerifyStub);
- return scoped_ptr<KeyedService>(new NetworkingPrivateServiceClient(
+ std::unique_ptr<wifi::FakeWiFiService> wifi_service(
+ new wifi::FakeWiFiService());
+ std::unique_ptr<CryptoVerifyStub> crypto_verify(new CryptoVerifyStub);
+ return std::unique_ptr<KeyedService>(new NetworkingPrivateServiceClient(
std::move(wifi_service), std::move(crypto_verify)));
}
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.cc b/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.cc
index 803ef91..e97cd3c 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#if defined(OS_CHROMEOS)
@@ -18,10 +19,10 @@
NetworkingPrivateUIDelegateFactoryImpl::
~NetworkingPrivateUIDelegateFactoryImpl() {}
-scoped_ptr<NetworkingPrivateDelegate::UIDelegate>
+std::unique_ptr<NetworkingPrivateDelegate::UIDelegate>
NetworkingPrivateUIDelegateFactoryImpl::CreateDelegate() {
#if defined(OS_CHROMEOS)
- return make_scoped_ptr(
+ return base::WrapUnique(
new chromeos::extensions::NetworkingPrivateUIDelegateChromeOS());
#else
return nullptr;
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h b/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h
index de0a25de..d2b04c5 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h
+++ b/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_impl.h
@@ -16,7 +16,8 @@
NetworkingPrivateUIDelegateFactoryImpl();
~NetworkingPrivateUIDelegateFactoryImpl() override;
- scoped_ptr<NetworkingPrivateDelegate::UIDelegate> CreateDelegate() override;
+ std::unique_ptr<NetworkingPrivateDelegate::UIDelegate> CreateDelegate()
+ override;
private:
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateUIDelegateFactoryImpl);
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.cc b/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.cc
index 9112f8c..eb8bd3d 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h"
+#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/networking_private/crypto_verify_impl.h"
@@ -17,10 +18,10 @@
~NetworkingPrivateVerifyDelegateFactoryImpl() {
}
-scoped_ptr<NetworkingPrivateDelegate::VerifyDelegate>
+std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate>
NetworkingPrivateVerifyDelegateFactoryImpl::CreateDelegate() {
#if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_MACOSX)
- return make_scoped_ptr(new CryptoVerifyImpl());
+ return base::WrapUnique(new CryptoVerifyImpl());
#else
return nullptr;
#endif
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h b/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h
index ca930f8..78029bf5 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h
+++ b/chrome/browser/extensions/api/networking_private/networking_private_verify_delegate_factory_impl.h
@@ -16,7 +16,7 @@
NetworkingPrivateVerifyDelegateFactoryImpl();
~NetworkingPrivateVerifyDelegateFactoryImpl() override;
- scoped_ptr<NetworkingPrivateDelegate::VerifyDelegate> CreateDelegate()
+ std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate> CreateDelegate()
override;
private:
diff --git a/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc b/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc
index 4b30b904..01de904 100644
--- a/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc
+++ b/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc
@@ -61,11 +61,11 @@
const std::string& sender_id,
const std::string& notification_id,
const api::notifications::NotificationOptions& options) {
- scoped_ptr<base::ListValue> args =
- api::notification_provider::OnCreated::Create(
- sender_id, notification_id, options);
+ std::unique_ptr<base::ListValue> args =
+ api::notification_provider::OnCreated::Create(sender_id, notification_id,
+ options);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::NOTIFICATION_PROVIDER_ON_CREATED,
api::notification_provider::OnCreated::kEventName, std::move(args)));
@@ -78,11 +78,11 @@
const std::string& sender_id,
const std::string& notification_id,
const api::notifications::NotificationOptions& options) {
- scoped_ptr<base::ListValue> args =
- api::notification_provider::OnUpdated::Create(
- sender_id, notification_id, options);
+ std::unique_ptr<base::ListValue> args =
+ api::notification_provider::OnUpdated::Create(sender_id, notification_id,
+ options);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::NOTIFICATION_PROVIDER_ON_UPDATED,
api::notification_provider::OnUpdated::kEventName, std::move(args)));
@@ -94,10 +94,10 @@
const std::string& notification_provider_id,
const std::string& sender_id,
const std::string& notification_id) {
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
api::notification_provider::OnCleared::Create(sender_id, notification_id);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::NOTIFICATION_PROVIDER_ON_CLEARED,
api::notification_provider::OnCleared::kEventName, std::move(args)));
@@ -115,7 +115,7 @@
ExtensionFunction::ResponseAction
NotificationProviderNotifyOnClearedFunction::Run() {
- scoped_ptr<api::notification_provider::NotifyOnCleared::Params> params =
+ std::unique_ptr<api::notification_provider::NotifyOnCleared::Params> params =
api::notification_provider::NotifyOnCleared::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -143,7 +143,7 @@
ExtensionFunction::ResponseAction
NotificationProviderNotifyOnClickedFunction::Run() {
- scoped_ptr<api::notification_provider::NotifyOnClicked::Params> params =
+ std::unique_ptr<api::notification_provider::NotifyOnClicked::Params> params =
api::notification_provider::NotifyOnClicked::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -171,8 +171,10 @@
ExtensionFunction::ResponseAction
NotificationProviderNotifyOnButtonClickedFunction::Run() {
- scoped_ptr<api::notification_provider::NotifyOnButtonClicked::Params> params =
- api::notification_provider::NotifyOnButtonClicked::Params::Create(*args_);
+ std::unique_ptr<api::notification_provider::NotifyOnButtonClicked::Params>
+ params =
+ api::notification_provider::NotifyOnButtonClicked::Params::Create(
+ *args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
const Notification* notification =
@@ -199,7 +201,8 @@
ExtensionFunction::ResponseAction
NotificationProviderNotifyOnPermissionLevelChangedFunction::Run() {
- scoped_ptr<api::notification_provider::NotifyOnPermissionLevelChanged::Params>
+ std::unique_ptr<
+ api::notification_provider::NotifyOnPermissionLevelChanged::Params>
params = api::notification_provider::NotifyOnPermissionLevelChanged::
Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -241,8 +244,9 @@
ExtensionFunction::ResponseAction
NotificationProviderNotifyOnShowSettingsFunction::Run() {
- scoped_ptr<api::notification_provider::NotifyOnShowSettings::Params> params =
- api::notification_provider::NotifyOnShowSettings::Params::Create(*args_);
+ std::unique_ptr<api::notification_provider::NotifyOnShowSettings::Params>
+ params = api::notification_provider::NotifyOnShowSettings::Params::Create(
+ *args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
bool has_advanced_settings;
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc
index fa3e2f4..5e172bc 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_api.cc
@@ -156,14 +156,14 @@
EventRouter::UserGestureState gesture =
by_user ? EventRouter::USER_GESTURE_ENABLED
: EventRouter::USER_GESTURE_NOT_ENABLED;
- scoped_ptr<base::ListValue> args(CreateBaseEventArgs());
+ std::unique_ptr<base::ListValue> args(CreateBaseEventArgs());
args->Append(new base::FundamentalValue(by_user));
SendEvent(events::NOTIFICATIONS_ON_CLOSED,
notifications::OnClosed::kEventName, gesture, std::move(args));
}
void Click() override {
- scoped_ptr<base::ListValue> args(CreateBaseEventArgs());
+ std::unique_ptr<base::ListValue> args(CreateBaseEventArgs());
SendEvent(events::NOTIFICATIONS_ON_CLICKED,
notifications::OnClicked::kEventName,
EventRouter::USER_GESTURE_ENABLED, std::move(args));
@@ -178,7 +178,7 @@
}
void ButtonClick(int index) override {
- scoped_ptr<base::ListValue> args(CreateBaseEventArgs());
+ std::unique_ptr<base::ListValue> args(CreateBaseEventArgs());
args->Append(new base::FundamentalValue(index));
SendEvent(events::NOTIFICATIONS_ON_BUTTON_CLICKED,
notifications::OnButtonClicked::kEventName,
@@ -193,11 +193,12 @@
void SendEvent(events::HistogramValue histogram_value,
const std::string& name,
EventRouter::UserGestureState user_gesture,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
if (!event_router_)
return;
- scoped_ptr<Event> event(new Event(histogram_value, name, std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(histogram_value, name, std::move(args)));
event->user_gesture = user_gesture;
event_router_->DispatchEventToExtension(extension_id_, std::move(event));
}
@@ -207,8 +208,8 @@
shutdown_notifier_subscription_.reset();
}
- scoped_ptr<base::ListValue> CreateBaseEventArgs() {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> CreateBaseEventArgs() {
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(new base::StringValue(id_));
return args;
}
@@ -224,7 +225,7 @@
const std::string id_;
const std::string scoped_id_;
- scoped_ptr<KeyedServiceShutdownNotifier::Subscription>
+ std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
shutdown_notifier_subscription_;
DISALLOW_COPY_AND_ASSIGN(NotificationsApiDelegate);
@@ -688,7 +689,7 @@
notification_ui_manager->GetAllIdsByProfileAndSourceOrigin(
NotificationUIManager::GetProfileID(GetProfile()), extension_->url());
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
for (std::set<std::string>::iterator iter = notification_ids.begin();
iter != notification_ids.end(); iter++) {
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.h b/chrome/browser/extensions/api/notifications/notifications_api.h
index b3ef00b..fd85025 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.h
+++ b/chrome/browser/extensions/api/notifications/notifications_api.h
@@ -62,7 +62,7 @@
~NotificationsCreateFunction() override;
private:
- scoped_ptr<api::notifications::Create::Params> params_;
+ std::unique_ptr<api::notifications::Create::Params> params_;
DECLARE_EXTENSION_FUNCTION("notifications.create", NOTIFICATIONS_CREATE)
};
@@ -78,7 +78,7 @@
~NotificationsUpdateFunction() override;
private:
- scoped_ptr<api::notifications::Update::Params> params_;
+ std::unique_ptr<api::notifications::Update::Params> params_;
DECLARE_EXTENSION_FUNCTION("notifications.update", NOTIFICATIONS_UPDATE)
};
@@ -94,7 +94,7 @@
~NotificationsClearFunction() override;
private:
- scoped_ptr<api::notifications::Clear::Params> params_;
+ std::unique_ptr<api::notifications::Clear::Params> params_;
DECLARE_EXTENSION_FUNCTION("notifications.clear", NOTIFICATIONS_CLEAR)
};
diff --git a/chrome/browser/extensions/api/notifications/notifications_apitest.cc b/chrome/browser/extensions/api/notifications/notifications_apitest.cc
index ee6eef5..426eea9a 100644
--- a/chrome/browser/extensions/api/notifications/notifications_apitest.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_apitest.cc
@@ -196,11 +196,8 @@
notification_function->set_extension(empty_extension.get());
notification_function->set_has_callback(true);
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
- notification_function.get(),
- "[]",
- browser(),
- utils::NONE));
+ std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ notification_function.get(), "[]", browser(), utils::NONE));
EXPECT_EQ(base::Value::TYPE_STRING, result->GetType());
std::string permission_level;
@@ -224,11 +221,8 @@
g_browser_process->message_center()->GetNotifierSettingsProvider()->
SetNotifierEnabled(notifier, false);
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
- notification_function.get(),
- "[]",
- browser(),
- utils::NONE));
+ std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ notification_function.get(), "[]", browser(), utils::NONE));
EXPECT_EQ(base::Value::TYPE_STRING, result->GetType());
std::string permission_level;
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index 2349156..04ab949 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -5,9 +5,11 @@
#include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
#include <stddef.h>
+
#include <utility>
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -54,12 +56,12 @@
static const int kOmniboxIconPaddingRight = 0;
#endif
-scoped_ptr<omnibox::SuggestResult> GetOmniboxDefaultSuggestion(
+std::unique_ptr<omnibox::SuggestResult> GetOmniboxDefaultSuggestion(
Profile* profile,
const std::string& extension_id) {
ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
- scoped_ptr<omnibox::SuggestResult> suggestion;
+ std::unique_ptr<omnibox::SuggestResult> suggestion;
const base::DictionaryValue* dict = NULL;
if (prefs && prefs->ReadPrefAsDictionary(extension_id,
kOmniboxDefaultSuggestion,
@@ -80,7 +82,7 @@
if (!prefs)
return false;
- scoped_ptr<base::DictionaryValue> dict = suggestion.ToValue();
+ std::unique_ptr<base::DictionaryValue> dict = suggestion.ToValue();
// Add the content field so that the dictionary can be used to populate an
// omnibox::SuggestResult.
dict->SetWithoutPathExpansion(kSuggestionContent, new base::StringValue(""));
@@ -103,9 +105,9 @@
// static
void ExtensionOmniboxEventRouter::OnInputStarted(
Profile* profile, const std::string& extension_id) {
- scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_STARTED,
- omnibox::OnInputStarted::kEventName,
- make_scoped_ptr(new base::ListValue())));
+ std::unique_ptr<Event> event(new Event(
+ events::OMNIBOX_ON_INPUT_STARTED, omnibox::OnInputStarted::kEventName,
+ base::WrapUnique(new base::ListValue())));
event->restrict_to_browser_context = profile;
EventRouter::Get(profile)
->DispatchEventToExtension(extension_id, std::move(event));
@@ -120,13 +122,13 @@
extension_id, omnibox::OnInputChanged::kEventName))
return false;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue(input));
args->Set(1, new base::FundamentalValue(suggest_id));
- scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CHANGED,
- omnibox::OnInputChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CHANGED,
+ omnibox::OnInputChanged::kEventName,
+ std::move(args)));
event->restrict_to_browser_context = profile;
event_router->DispatchEventToExtension(extension_id, std::move(event));
return true;
@@ -148,7 +150,7 @@
extensions::TabHelper::FromWebContents(web_contents)->
active_tab_permission_granter()->GrantIfRequested(extension);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue(input));
if (disposition == NEW_FOREGROUND_TAB)
args->Set(1, new base::StringValue(kForegroundTabDisposition));
@@ -157,9 +159,9 @@
else
args->Set(1, new base::StringValue(kCurrentTabDisposition));
- scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_ENTERED,
- omnibox::OnInputEntered::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_ENTERED,
+ omnibox::OnInputEntered::kEventName,
+ std::move(args)));
event->restrict_to_browser_context = profile;
EventRouter::Get(profile)
->DispatchEventToExtension(extension_id, std::move(event));
@@ -173,9 +175,9 @@
// static
void ExtensionOmniboxEventRouter::OnInputCancelled(
Profile* profile, const std::string& extension_id) {
- scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CANCELLED,
- omnibox::OnInputCancelled::kEventName,
- make_scoped_ptr(new base::ListValue())));
+ std::unique_ptr<Event> event(new Event(
+ events::OMNIBOX_ON_INPUT_CANCELLED, omnibox::OnInputCancelled::kEventName,
+ base::WrapUnique(new base::ListValue())));
event->restrict_to_browser_context = profile;
EventRouter::Get(profile)
->DispatchEventToExtension(extension_id, std::move(event));
@@ -283,7 +285,7 @@
}
bool OmniboxSendSuggestionsFunction::RunSync() {
- scoped_ptr<SendSuggestions::Params> params(
+ std::unique_ptr<SendSuggestions::Params> params(
SendSuggestions::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -296,7 +298,7 @@
}
bool OmniboxSetDefaultSuggestionFunction::RunSync() {
- scoped_ptr<SetDefaultSuggestion::Params> params(
+ std::unique_ptr<SetDefaultSuggestion::Params> params(
SetDefaultSuggestion::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -368,7 +370,7 @@
AutocompleteMatch* match) {
DCHECK(keyword->GetType() == TemplateURL::OMNIBOX_API_EXTENSION);
- scoped_ptr<omnibox::SuggestResult> suggestion(
+ std::unique_ptr<omnibox::SuggestResult> suggestion(
GetOmniboxDefaultSuggestion(profile, keyword->GetExtensionId()));
if (!suggestion || suggestion->description.empty())
return; // fall back to the universal default
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.h b/chrome/browser/extensions/api/omnibox/omnibox_api.h
index 9c36a7c1..d49ecc1f2 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.h
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
@@ -142,7 +142,7 @@
ExtensionIconManager omnibox_icon_manager_;
ExtensionIconManager omnibox_popup_icon_manager_;
- scoped_ptr<TemplateURLService::Subscription> template_url_sub_;
+ std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
DISALLOW_COPY_AND_ASSIGN(OmniboxAPI);
};
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
index 4780236..c4cf4d1f 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
@@ -45,7 +45,7 @@
// + ddd
// = nmmmmndddn
TEST(ExtensionOmniboxTest, DescriptionStylesSimple) {
- scoped_ptr<base::ListValue> list =
+ std::unique_ptr<base::ListValue> list =
ListBuilder()
.Append(42)
.Append(ListBuilder()
@@ -76,7 +76,7 @@
styles_expected.push_back(ACMatchClassification(6, kDim));
styles_expected.push_back(ACMatchClassification(9, kNone));
- scoped_ptr<SendSuggestions::Params> params(
+ std::unique_ptr<SendSuggestions::Params> params(
SendSuggestions::Params::Create(*list));
EXPECT_TRUE(params);
ASSERT_FALSE(params->suggest_results.empty());
@@ -84,7 +84,7 @@
params->suggest_results[0]));
// Same input, but swap the order. Ensure it still works.
- scoped_ptr<base::ListValue> swap_list =
+ std::unique_ptr<base::ListValue> swap_list =
ListBuilder()
.Append(42)
.Append(ListBuilder()
@@ -108,7 +108,7 @@
.Build())
.Build();
- scoped_ptr<SendSuggestions::Params> swapped_params(
+ std::unique_ptr<SendSuggestions::Params> swapped_params(
SendSuggestions::Params::Create(*swap_list));
EXPECT_TRUE(swapped_params);
ASSERT_FALSE(swapped_params->suggest_results.empty());
@@ -125,7 +125,7 @@
// + dd
// = 3773unnnn66
TEST(ExtensionOmniboxTest, DescriptionStylesCombine) {
- scoped_ptr<base::ListValue> list =
+ std::unique_ptr<base::ListValue> list =
ListBuilder()
.Append(42)
.Append(ListBuilder()
@@ -172,7 +172,7 @@
styles_expected.push_back(ACMatchClassification(5, kNone));
styles_expected.push_back(ACMatchClassification(9, kMatch | kDim));
- scoped_ptr<SendSuggestions::Params> params(
+ std::unique_ptr<SendSuggestions::Params> params(
SendSuggestions::Params::Create(*list));
EXPECT_TRUE(params);
ASSERT_FALSE(params->suggest_results.empty());
@@ -181,7 +181,7 @@
// Try moving the "dim/match" style pair at offset 9. Output should be the
// same.
- scoped_ptr<base::ListValue> moved_list =
+ std::unique_ptr<base::ListValue> moved_list =
ListBuilder()
.Append(42)
.Append(ListBuilder()
@@ -220,7 +220,7 @@
.Build())
.Build();
- scoped_ptr<SendSuggestions::Params> moved_params(
+ std::unique_ptr<SendSuggestions::Params> moved_params(
SendSuggestions::Params::Create(*moved_list));
EXPECT_TRUE(moved_params);
ASSERT_FALSE(moved_params->suggest_results.empty());
@@ -236,7 +236,7 @@
// + ddd
// = 77777nnnnn
TEST(ExtensionOmniboxTest, DescriptionStylesCombine2) {
- scoped_ptr<base::ListValue> list =
+ std::unique_ptr<base::ListValue> list =
ListBuilder()
.Append(42)
.Append(ListBuilder()
@@ -279,7 +279,7 @@
styles_expected.push_back(ACMatchClassification(0, kUrl | kMatch | kDim));
styles_expected.push_back(ACMatchClassification(5, kNone));
- scoped_ptr<SendSuggestions::Params> params(
+ std::unique_ptr<SendSuggestions::Params> params(
SendSuggestions::Params::Create(*list));
EXPECT_TRUE(params);
ASSERT_FALSE(params->suggest_results.empty());
@@ -296,7 +296,7 @@
// = 77777nnnnn
TEST(ExtensionOmniboxTest, DefaultSuggestResult) {
// Default suggestions should not have a content parameter.
- scoped_ptr<base::ListValue> list =
+ std::unique_ptr<base::ListValue> list =
ListBuilder()
.Append(DictionaryBuilder()
.Set("description", "description")
@@ -331,7 +331,7 @@
.Build())
.Build();
- scoped_ptr<SetDefaultSuggestion::Params> params(
+ std::unique_ptr<SetDefaultSuggestion::Params> params(
SetDefaultSuggestion::Params::Create(*list));
EXPECT_TRUE(params);
}
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.h b/chrome/browser/extensions/api/page_capture/page_capture_api.h
index 0b84584..f72ea84 100644
--- a/chrome/browser/extensions/api/page_capture/page_capture_api.h
+++ b/chrome/browser/extensions/api/page_capture/page_capture_api.h
@@ -56,7 +56,7 @@
// Returns the WebContents we are associated with, NULL if it's been closed.
content::WebContents* GetWebContents();
- scoped_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_;
+ std::unique_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_;
// The path to the temporary file containing the MHTML data.
base::FilePath mhtml_path_;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
index 8b40334..a74dc02 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
@@ -21,9 +21,9 @@
ExtensionFunction::ResponseAction
PasswordsPrivateRemoveSavedPasswordFunction::Run() {
- scoped_ptr<api::passwords_private::RemoveSavedPassword::Params>
- parameters = api::passwords_private::RemoveSavedPassword::Params::
- Create(*args_);
+ std::unique_ptr<api::passwords_private::RemoveSavedPassword::Params>
+ parameters =
+ api::passwords_private::RemoveSavedPassword::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
PasswordsPrivateDelegate* delegate =
@@ -44,9 +44,10 @@
ExtensionFunction::ResponseAction
PasswordsPrivateRemovePasswordExceptionFunction::Run() {
- scoped_ptr<api::passwords_private::RemovePasswordException::Params>
- parameters = api::passwords_private::RemovePasswordException::
- Params::Create(*args_);
+ std::unique_ptr<api::passwords_private::RemovePasswordException::Params>
+ parameters =
+ api::passwords_private::RemovePasswordException::Params::Create(
+ *args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
PasswordsPrivateDelegate* delegate =
@@ -65,9 +66,10 @@
ExtensionFunction::ResponseAction
PasswordsPrivateRequestPlaintextPasswordFunction::Run() {
- scoped_ptr<api::passwords_private::RequestPlaintextPassword::Params>
- parameters = api::passwords_private::RequestPlaintextPassword::Params::
- Create(*args_);
+ std::unique_ptr<api::passwords_private::RequestPlaintextPassword::Params>
+ parameters =
+ api::passwords_private::RequestPlaintextPassword::Params::Create(
+ *args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
PasswordsPrivateDelegate* delegate =
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
index b49e886..37b6267e 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/observer_list.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -133,10 +134,10 @@
}
~PasswordsPrivateApiTest() override {}
- static scoped_ptr<KeyedService> GetPasswordsPrivateDelegate(
+ static std::unique_ptr<KeyedService> GetPasswordsPrivateDelegate(
content::BrowserContext* profile) {
CHECK(s_test_delegate_);
- return make_scoped_ptr(s_test_delegate_);
+ return base::WrapUnique(s_test_delegate_);
}
void SetUpCommandLine(base::CommandLine* command_line) override {
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
index df18ead..9c1ad66 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGATE_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list_threadsafe.h"
#include "chrome/browser/ui/passwords/password_manager_presenter.h"
#include "chrome/browser/ui/passwords/password_ui_view.h"
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index aa49838..a0a9299c 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -145,7 +145,7 @@
}
void PasswordsPrivateDelegateImpl::SetPasswordList(
- const std::vector<scoped_ptr<autofill::PasswordForm>>& password_list) {
+ const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_list) {
// Rebuild |login_pair_to_index_map_| so that it reflects the contents of the
// new list.
login_pair_to_index_map_.clear();
@@ -186,7 +186,7 @@
}
void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
- const std::vector<scoped_ptr<autofill::PasswordForm>>&
+ const std::vector<std::unique_ptr<autofill::PasswordForm>>&
password_exception_list) {
// Rebuild |exception_url_to_index_map_| so that it reflects the contents of
// the new list.
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
index d697a849..707db48 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
@@ -8,12 +8,12 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h"
@@ -55,10 +55,11 @@
const std::string& origin_url,
const std::string& username,
const base::string16& plaintext_password) override;
- void SetPasswordList(const std::vector<scoped_ptr<autofill::PasswordForm>>&
- password_list) override;
+ void SetPasswordList(
+ const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_list)
+ override;
void SetPasswordExceptionList(
- const std::vector<scoped_ptr<autofill::PasswordForm>>&
+ const std::vector<std::unique_ptr<autofill::PasswordForm>>&
password_exception_list) override;
#if !defined(OS_ANDROID)
gfx::NativeWindow GetNativeWindow() const override;
@@ -90,7 +91,7 @@
Profile* profile_;
// Used to communicate with the password store.
- scoped_ptr<PasswordManagerPresenter> password_manager_presenter_;
+ std::unique_ptr<PasswordManagerPresenter> password_manager_presenter_;
// The current list of entries/exceptions. Cached here so that when new
// observers are added, this delegate can send the current lists without
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
index a8c09526..e9fb4d5 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
@@ -90,7 +90,7 @@
// If there is nothing to send, return early.
return;
- scoped_ptr<Event> extension_event(
+ std::unique_ptr<Event> extension_event(
new Event(events::PASSWORDS_PRIVATE_ON_SAVED_PASSWORDS_LIST_CHANGED,
api::passwords_private::OnSavedPasswordsListChanged::kEventName,
cached_saved_password_parameters_->CreateDeepCopy()));
@@ -110,7 +110,7 @@
// If there is nothing to send, return early.
return;
- scoped_ptr<Event> extension_event(new Event(
+ std::unique_ptr<Event> extension_event(new Event(
events::PASSWORDS_PRIVATE_ON_PASSWORD_EXCEPTIONS_LIST_CHANGED,
api::passwords_private::OnPasswordExceptionsListChanged::kEventName,
cached_password_exception_parameters_->CreateDeepCopy()));
@@ -126,10 +126,10 @@
params.login_pair.username = username;
params.plaintext_password = plaintext_password;
- scoped_ptr<base::ListValue> event_value(new base::ListValue);
+ std::unique_ptr<base::ListValue> event_value(new base::ListValue);
event_value->Append(params.ToValue());
- scoped_ptr<Event> extension_event(new Event(
+ std::unique_ptr<Event> extension_event(new Event(
events::PASSWORDS_PRIVATE_ON_PLAINTEXT_PASSWORD_RETRIEVED,
api::passwords_private::OnPlaintextPasswordRetrieved::kEventName,
std::move(event_value)));
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h
index 4923470a..a91216e 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h
@@ -64,8 +64,8 @@
// Cached parameters which are saved so that when new listeners are added, the
// most up-to-date lists can be sent to them immediately.
- scoped_ptr<base::ListValue> cached_saved_password_parameters_;
- scoped_ptr<base::ListValue> cached_password_exception_parameters_;
+ std::unique_ptr<base::ListValue> cached_saved_password_parameters_;
+ std::unique_ptr<base::ListValue> cached_password_exception_parameters_;
// Whether this class is currently listening for changes to password changes.
bool listening_;
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.cc b/chrome/browser/extensions/api/permissions/permissions_api.cc
index 464b0f6..d360d22 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api.cc
+++ b/chrome/browser/extensions/api/permissions/permissions_api.cc
@@ -4,7 +4,9 @@
#include "chrome/browser/extensions/api/permissions/permissions_api.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
#include "chrome/browser/extensions/extension_management.h"
@@ -53,13 +55,14 @@
} // namespace
bool PermissionsContainsFunction::RunSync() {
- scoped_ptr<Contains::Params> params(Contains::Params::Create(*args_));
+ std::unique_ptr<Contains::Params> params(Contains::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- scoped_ptr<const PermissionSet> permissions = helpers::UnpackPermissionSet(
- params->permissions,
- ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
- &error_);
+ std::unique_ptr<const PermissionSet> permissions =
+ helpers::UnpackPermissionSet(
+ params->permissions,
+ ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
+ &error_);
if (!permissions.get())
return false;
@@ -70,20 +73,21 @@
}
bool PermissionsGetAllFunction::RunSync() {
- scoped_ptr<Permissions> permissions = helpers::PackPermissionSet(
+ std::unique_ptr<Permissions> permissions = helpers::PackPermissionSet(
extension()->permissions_data()->active_permissions());
results_ = GetAll::Results::Create(*permissions);
return true;
}
bool PermissionsRemoveFunction::RunSync() {
- scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_));
+ std::unique_ptr<Remove::Params> params(Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- scoped_ptr<const PermissionSet> permissions = helpers::UnpackPermissionSet(
- params->permissions,
- ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
- &error_);
+ std::unique_ptr<const PermissionSet> permissions =
+ helpers::UnpackPermissionSet(
+ params->permissions,
+ ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
+ &error_);
if (!permissions.get())
return false;
@@ -108,7 +112,7 @@
const PermissionSet& required =
PermissionsParser::GetRequiredPermissions(extension());
if (!optional.Contains(*permissions) ||
- !scoped_ptr<const PermissionSet>(
+ !std::unique_ptr<const PermissionSet>(
PermissionSet::CreateIntersection(*permissions, required))
->IsEmpty()) {
error_ = kCantRemoveRequiredPermissionsError;
@@ -153,7 +157,7 @@
return false;
}
- scoped_ptr<Request::Params> params(Request::Params::Create(*args_));
+ std::unique_ptr<Request::Params> params(Request::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
requested_permissions_ = helpers::UnpackPermissionSet(
@@ -191,7 +195,7 @@
// We don't need to prompt the user if the requested permissions are a subset
// of the granted permissions set.
- scoped_ptr<const PermissionSet> granted =
+ std::unique_ptr<const PermissionSet> granted =
ExtensionPrefs::Get(GetProfile())
->GetGrantedPermissions(extension()->id());
if (granted.get() && granted->Contains(*requested_permissions_)) {
@@ -235,7 +239,7 @@
install_ui_->ShowDialog(
base::Bind(&PermissionsRequestFunction::OnInstallPromptDone, this),
extension(), nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::PERMISSIONS_PROMPT)),
requested_permissions_->Clone(),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.h b/chrome/browser/extensions/api/permissions/permissions_api.h
index 47884da..e29074b 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api.h
+++ b/chrome/browser/extensions/api/permissions/permissions_api.h
@@ -71,8 +71,8 @@
private:
void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
- scoped_ptr<ExtensionInstallPrompt> install_ui_;
- scoped_ptr<const PermissionSet> requested_permissions_;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui_;
+ std::unique_ptr<const PermissionSet> requested_permissions_;
DISALLOW_COPY_AND_ASSIGN(PermissionsRequestFunction);
};
diff --git a/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc b/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc
index 22c3b41c..8d6af87 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc
+++ b/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc
@@ -8,6 +8,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/common/extensions/api/permissions.h"
#include "extensions/common/error_utils.h"
@@ -37,12 +38,12 @@
} // namespace
-scoped_ptr<Permissions> PackPermissionSet(const PermissionSet& set) {
- scoped_ptr<Permissions> permissions(new Permissions());
+std::unique_ptr<Permissions> PackPermissionSet(const PermissionSet& set) {
+ std::unique_ptr<Permissions> permissions(new Permissions());
permissions->permissions.reset(new std::vector<std::string>());
for (const APIPermission* api : set.apis()) {
- scoped_ptr<base::Value> value(api->ToValue());
+ std::unique_ptr<base::Value> value(api->ToValue());
if (!value) {
permissions->permissions->push_back(api->name());
} else {
@@ -63,7 +64,7 @@
return permissions;
}
-scoped_ptr<const PermissionSet> UnpackPermissionSet(
+std::unique_ptr<const PermissionSet> UnpackPermissionSet(
const Permissions& permissions,
bool allow_file_access,
std::string* error) {
@@ -83,7 +84,7 @@
std::string permission_name = it->substr(0, delimiter);
std::string permission_arg = it->substr(delimiter + 1);
- scoped_ptr<base::Value> permission_json =
+ std::unique_ptr<base::Value> permission_json =
base::JSONReader::Read(permission_arg);
if (!permission_json.get()) {
*error = ErrorUtils::FormatErrorMessage(kInvalidParameter, *it);
@@ -145,7 +146,7 @@
}
}
- return make_scoped_ptr(
+ return base::WrapUnique(
new PermissionSet(apis, manifest_permissions, origins, URLPatternSet()));
}
diff --git a/chrome/browser/extensions/api/permissions/permissions_api_helpers.h b/chrome/browser/extensions/api/permissions/permissions_api_helpers.h
index 89e866a..4e06564 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api_helpers.h
+++ b/chrome/browser/extensions/api/permissions/permissions_api_helpers.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_HELPERS_H_
#define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_HELPERS_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
+
#include "base/memory/ref_counted.h"
namespace base {
@@ -26,12 +27,12 @@
namespace permissions_api_helpers {
// Converts the permission |set| to a permissions object.
-scoped_ptr<api::permissions::Permissions> PackPermissionSet(
+std::unique_ptr<api::permissions::Permissions> PackPermissionSet(
const PermissionSet& set);
// Creates a permission set from |permissions|. Returns NULL if the permissions
// cannot be converted to a permission set, in which case |error| will be set.
-scoped_ptr<const PermissionSet> UnpackPermissionSet(
+std::unique_ptr<const PermissionSet> UnpackPermissionSet(
const api::permissions::Permissions& permissions,
bool allow_file_access,
std::string* error);
diff --git a/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc b/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc
index 17d9f03f..c92ef309a 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc
+++ b/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc
@@ -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/browser/extensions/api/permissions/permissions_api_helpers.h"
+
#include <stddef.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
#include "chrome/common/extensions/api/permissions.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/url_pattern_set.h"
@@ -43,8 +45,8 @@
URLPatternSet());
// Pack the permission set to value and verify its contents.
- scoped_ptr<Permissions> permissions(PackPermissionSet(permission_set));
- scoped_ptr<base::DictionaryValue> value(permissions->ToValue());
+ std::unique_ptr<Permissions> permissions(PackPermissionSet(permission_set));
+ std::unique_ptr<base::DictionaryValue> value(permissions->ToValue());
base::ListValue* api_list = NULL;
base::ListValue* origin_list = NULL;
EXPECT_TRUE(value->GetList("permissions", &api_list));
@@ -56,13 +58,14 @@
std::string expected_apis[] = {"tabs", "fileBrowserHandler",
"fileBrowserHandlerInternal"};
for (size_t i = 0; i < arraysize(expected_apis); ++i) {
- scoped_ptr<base::Value> value(new base::StringValue(expected_apis[i]));
+ std::unique_ptr<base::Value> value(new base::StringValue(expected_apis[i]));
EXPECT_NE(api_list->end(), api_list->Find(*value));
}
std::string expected_origins[] = { "http://a.com/*", "http://b.com/*" };
for (size_t i = 0; i < arraysize(expected_origins); ++i) {
- scoped_ptr<base::Value> value(new base::StringValue(expected_origins[i]));
+ std::unique_ptr<base::Value> value(
+ new base::StringValue(expected_origins[i]));
EXPECT_NE(origin_list->end(), origin_list->Find(*value));
}
@@ -71,7 +74,7 @@
std::string error;
Permissions permissions_object;
EXPECT_TRUE(Permissions::Populate(*value, &permissions_object));
- scoped_ptr<const PermissionSet> from_value =
+ std::unique_ptr<const PermissionSet> from_value =
UnpackPermissionSet(permissions_object, true, &error);
EXPECT_TRUE(error.empty());
@@ -81,13 +84,13 @@
// Tests various error conditions and edge cases when unpacking values
// into PermissionSets.
TEST(ExtensionPermissionsAPIHelpers, Unpack) {
- scoped_ptr<base::ListValue> apis(new base::ListValue());
+ std::unique_ptr<base::ListValue> apis(new base::ListValue());
apis->Append(new base::StringValue("tabs"));
- scoped_ptr<base::ListValue> origins(new base::ListValue());
+ std::unique_ptr<base::ListValue> origins(new base::ListValue());
origins->Append(new base::StringValue("http://a.com/*"));
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- scoped_ptr<const PermissionSet> permissions;
+ std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
+ std::unique_ptr<const PermissionSet> permissions;
std::string error;
// Origins shouldn't have to be present.
@@ -117,7 +120,7 @@
{
Permissions permissions_object;
value->Clear();
- scoped_ptr<base::ListValue> invalid_apis(apis->DeepCopy());
+ std::unique_ptr<base::ListValue> invalid_apis(apis->DeepCopy());
invalid_apis->Append(new base::FundamentalValue(3));
value->Set("permissions", invalid_apis->DeepCopy());
EXPECT_FALSE(Permissions::Populate(*value, &permissions_object));
@@ -127,7 +130,7 @@
{
Permissions permissions_object;
value->Clear();
- scoped_ptr<base::ListValue> invalid_origins(origins->DeepCopy());
+ std::unique_ptr<base::ListValue> invalid_origins(origins->DeepCopy());
invalid_origins->Append(new base::FundamentalValue(3));
value->Set("origins", invalid_origins->DeepCopy());
EXPECT_FALSE(Permissions::Populate(*value, &permissions_object));
@@ -165,7 +168,7 @@
{
Permissions permissions_object;
value->Clear();
- scoped_ptr<base::ListValue> invalid_apis(apis->DeepCopy());
+ std::unique_ptr<base::ListValue> invalid_apis(apis->DeepCopy());
invalid_apis->Append(new base::StringValue("unknown_permission"));
value->Set("permissions", invalid_apis->DeepCopy());
EXPECT_TRUE(Permissions::Populate(*value, &permissions_object));
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
index b2b80ad..cd818aef 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
@@ -124,7 +124,7 @@
ExtensionFunction::ResponseAction
PlatformKeysInternalGetPublicKeyFunction::Run() {
- scoped_ptr<api_pki::GetPublicKey::Params> params(
+ std::unique_ptr<api_pki::GetPublicKey::Params> params(
api_pki::GetPublicKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -168,7 +168,7 @@
ExtensionFunction::ResponseAction
PlatformKeysInternalSelectClientCertificatesFunction::Run() {
- scoped_ptr<api_pki::SelectClientCertificates::Params> params(
+ std::unique_ptr<api_pki::SelectClientCertificates::Params> params(
api_pki::SelectClientCertificates::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -199,7 +199,7 @@
}
}
- scoped_ptr<net::CertificateList> client_certs;
+ std::unique_ptr<net::CertificateList> client_certs;
if (params->details.client_certs) {
client_certs.reset(new net::CertificateList);
for (const std::vector<char>& client_cert_der :
@@ -239,7 +239,7 @@
}
void PlatformKeysInternalSelectClientCertificatesFunction::
- OnSelectedCertificates(scoped_ptr<net::CertificateList> matches,
+ OnSelectedCertificates(std::unique_ptr<net::CertificateList> matches,
const std::string& error_message) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -282,7 +282,7 @@
}
ExtensionFunction::ResponseAction PlatformKeysInternalSignFunction::Run() {
- scoped_ptr<api_pki::Sign::Params> params(
+ std::unique_ptr<api_pki::Sign::Params> params(
api_pki::Sign::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
std::string platform_keys_token_id;
@@ -348,7 +348,7 @@
PlatformKeysVerifyTLSServerCertificateFunction::Run() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<api_pk::VerifyTLSServerCertificate::Params> params(
+ std::unique_ptr<api_pk::VerifyTLSServerCertificate::Params> params(
api_pk::VerifyTLSServerCertificate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api.h b/chrome/browser/extensions/api/platform_keys/platform_keys_api.h
index 7f6a99c..233e264a 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_api.h
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api.h
@@ -40,7 +40,7 @@
// Called when the certificates were selected. If an error occurred, |certs|
// will be null and instead |error_message| be set.
- void OnSelectedCertificates(scoped_ptr<net::CertificateList> matches,
+ void OnSelectedCertificates(std::unique_ptr<net::CertificateList> matches,
const std::string& error_message);
DECLARE_EXTENSION_FUNCTION("platformKeysInternal.selectClientCertificates",
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
index c2a912e..d058cd0 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_apitest_nss.cc
@@ -4,9 +4,11 @@
#include <cryptohi.h>
+#include <memory>
+
#include "base/json/json_writer.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h"
@@ -190,7 +192,7 @@
// corporate keys.
base::DictionaryValue key_permissions_policy;
{
- scoped_ptr<base::DictionaryValue> cert1_key_permission(
+ std::unique_ptr<base::DictionaryValue> cert1_key_permission(
new base::DictionaryValue);
cert1_key_permission->SetBooleanWithoutPathExpansion(
"allowCorporateKeyUsage", true);
@@ -214,7 +216,7 @@
void GotPermissionsForExtension(
const base::Closure& done_callback,
- scoped_ptr<chromeos::KeyPermissions::PermissionsForExtension>
+ std::unique_ptr<chromeos::KeyPermissions::PermissionsForExtension>
permissions_for_ext) {
std::string client_cert1_spki =
chromeos::platform_keys::GetSubjectPublicKeyInfo(client_cert1_);
@@ -271,9 +273,9 @@
}
const bool key_permission_policy_;
- scoped_ptr<policy::UserPolicyTestHelper> policy_helper_;
+ std::unique_ptr<policy::UserPolicyTestHelper> policy_helper_;
policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
- scoped_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_;
+ std::unique_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_;
};
class TestSelectDelegate
@@ -367,7 +369,7 @@
certs.push_back(client_cert1_);
GetPlatformKeysService()->SetSelectDelegate(
- make_scoped_ptr(new TestSelectDelegate(certs)));
+ base::WrapUnique(new TestSelectDelegate(certs)));
ASSERT_TRUE(RunExtensionTest("basicTests")) << message_;
}
@@ -379,7 +381,7 @@
certs.push_back(client_cert1_);
GetPlatformKeysService()->SetSelectDelegate(
- make_scoped_ptr(new TestSelectDelegate(certs)));
+ base::WrapUnique(new TestSelectDelegate(certs)));
ASSERT_TRUE(RunExtensionTest("permissionTests")) << message_;
}
@@ -394,7 +396,7 @@
// To verify that the user is not prompted for any certificate selection,
// set up a delegate that fails on any invocation.
GetPlatformKeysService()->SetSelectDelegate(
- make_scoped_ptr(new TestSelectDelegate(net::CertificateList())));
+ base::WrapUnique(new TestSelectDelegate(net::CertificateList())));
ASSERT_TRUE(RunExtensionTest("managedProfile")) << message_;
}
@@ -407,7 +409,7 @@
// To verify that the user is not prompted for any certificate selection,
// set up a delegate that fails on any invocation.
GetPlatformKeysService()->SetSelectDelegate(
- make_scoped_ptr(new TestSelectDelegate(net::CertificateList())));
+ base::WrapUnique(new TestSelectDelegate(net::CertificateList())));
ASSERT_TRUE(RunExtensionTest("corporateKeyWithoutPermissionTests"))
<< message_;
@@ -431,7 +433,7 @@
certs.push_back(client_cert1_);
GetPlatformKeysService()->SetSelectDelegate(
- make_scoped_ptr(new TestSelectDelegate(certs)));
+ base::WrapUnique(new TestSelectDelegate(certs)));
ASSERT_TRUE(RunExtensionTest("corporateKeyWithPermissionTests")) << message_;
}
@@ -442,7 +444,7 @@
// As the profile is managed, the user must not be able to grant any
// certificate permission. Set up a delegate that fails on any invocation.
GetPlatformKeysService()->SetSelectDelegate(
- make_scoped_ptr(new TestSelectDelegate(net::CertificateList())));
+ base::WrapUnique(new TestSelectDelegate(net::CertificateList())));
ASSERT_TRUE(RunExtensionTest("policyDoesGrantAccessToNonCorporateKey"))
<< message_;
diff --git a/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc b/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
index 08299e5b..951b787 100644
--- a/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
+++ b/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
@@ -43,7 +43,7 @@
// with the result (see the declaration of VerifyCallback).
// Will not call back after this object is destructed or the verifier for this
// extension is deleted (see OnExtensionUnloaded).
- void Verify(scoped_ptr<Params> params,
+ void Verify(std::unique_ptr<Params> params,
const std::string& extension_id,
const VerifyCallback& callback);
@@ -56,7 +56,7 @@
struct RequestState {
RequestState() {}
- scoped_ptr<net::CertVerifier::Request> request;
+ std::unique_ptr<net::CertVerifier::Request> request;
private:
DISALLOW_COPY_AND_ASSIGN(RequestState);
@@ -64,7 +64,7 @@
// Calls back |callback| with the result and no error.
void CallBackWithResult(const VerifyCallback& callback,
- scoped_ptr<net::CertVerifyResult> verify_result,
+ std::unique_ptr<net::CertVerifyResult> verify_result,
RequestState* request_state,
int return_value);
@@ -97,7 +97,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
-void VerifyTrustAPI::Verify(scoped_ptr<Params> params,
+void VerifyTrustAPI::Verify(std::unique_ptr<Params> params,
const std::string& extension_id,
const VerifyCallback& ui_callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -148,7 +148,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
}
-void VerifyTrustAPI::IOPart::Verify(scoped_ptr<Params> params,
+void VerifyTrustAPI::IOPart::Verify(std::unique_ptr<Params> params,
const std::string& extension_id,
const VerifyCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
@@ -182,8 +182,9 @@
}
net::CertVerifier* verifier = extension_to_verifier_[extension_id].get();
- scoped_ptr<net::CertVerifyResult> verify_result(new net::CertVerifyResult);
- scoped_ptr<net::BoundNetLog> net_log(new net::BoundNetLog);
+ std::unique_ptr<net::CertVerifyResult> verify_result(
+ new net::CertVerifyResult);
+ std::unique_ptr<net::BoundNetLog> net_log(new net::BoundNetLog);
const int flags = 0;
std::string ocsp_response;
@@ -212,7 +213,7 @@
void VerifyTrustAPI::IOPart::CallBackWithResult(
const VerifyCallback& callback,
- scoped_ptr<net::CertVerifyResult> verify_result,
+ std::unique_ptr<net::CertVerifyResult> verify_result,
RequestState* request_state,
int return_value) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
diff --git a/chrome/browser/extensions/api/platform_keys/verify_trust_api.h b/chrome/browser/extensions/api/platform_keys/verify_trust_api.h
index 96a7aa5..1d88b3e 100644
--- a/chrome/browser/extensions/api/platform_keys/verify_trust_api.h
+++ b/chrome/browser/extensions/api/platform_keys/verify_trust_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_PLATFORM_KEYS_VERIFY_TRUST_API_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "content/public/browser/browser_thread.h"
@@ -57,7 +57,7 @@
// Note: It is safe to delete this object while there are still
// outstanding operations. However, if this happens, |callback|
// will NOT be called.
- void Verify(scoped_ptr<Params> params,
+ void Verify(std::unique_ptr<Params> params,
const std::string& extension_id,
const VerifyCallback& callback);
@@ -95,7 +95,7 @@
// Created on the UIThread but must be used and destroyed only on the
// IOThread.
- scoped_ptr<IOPart, content::BrowserThread::DeleteOnIOThread> io_part_;
+ std::unique_ptr<IOPart, content::BrowserThread::DeleteOnIOThread> io_part_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
registry_observer_;
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting.cc b/chrome/browser/extensions/api/preference/chrome_direct_setting.cc
index e2d99be..87de9bb 100644
--- a/chrome/browser/extensions/api/preference/chrome_direct_setting.cc
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting.cc
@@ -36,7 +36,7 @@
EXTENSION_FUNCTION_VALIDATE(preference);
const base::Value* value = preference->GetValue();
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->Set(preference_api_constants::kValue, value->DeepCopy());
SetResult(result.release());
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
index 635d127..0a35340 100644
--- a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
@@ -136,7 +136,7 @@
profile_->GetPrefs()->FindPreference(pref_key.c_str());
const base::Value* value = preference->GetValue();
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->Set(preference_api_constants::kValue, value->DeepCopy());
base::ListValue args;
args.Append(result.release());
@@ -145,7 +145,7 @@
ExtensionRegistry::Get(profile_)->enabled_extensions()) {
const std::string& extension_id = extension->id();
if (router->ExtensionHasEventListener(extension_id, event_name)) {
- scoped_ptr<base::ListValue> args_copy(args.DeepCopy());
+ std::unique_ptr<base::ListValue> args_copy(args.DeepCopy());
// TODO(kalman): Have a histogram value for each pref type.
// This isn't so important for the current use case of these
// histograms, which is to track which event types are waking up event
@@ -157,7 +157,7 @@
// to change.
events::HistogramValue histogram_value =
events::TYPES_PRIVATE_CHROME_DIRECT_SETTING_ON_CHANGE;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args_copy)));
router->DispatchEventToExtension(extension_id, std::move(event));
}
diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc
index 577221a..3d24d98 100644
--- a/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chrome/browser/extensions/api/preference/preference_api.cc
@@ -342,7 +342,7 @@
// Mapping from browser pref keys to transformers.
std::map<std::string, PrefTransformerInterface*> transformers_;
- scoped_ptr<PrefTransformerInterface> identity_transformer_;
+ std::unique_ptr<PrefTransformerInterface> identity_transformer_;
DISALLOW_COPY_AND_ASSIGN(PrefMapping);
};
@@ -638,7 +638,7 @@
prefs->FindPreference(browser_pref.c_str());
CHECK(pref);
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
// Retrieve level of control.
std::string level_of_control = helpers::GetLevelOfControl(
@@ -730,7 +730,7 @@
PrefMapping::GetInstance()->FindTransformerForBrowserPref(browser_pref);
std::string error;
bool bad_message = false;
- scoped_ptr<base::Value> browser_pref_value(
+ std::unique_ptr<base::Value> browser_pref_value(
transformer->ExtensionToBrowserPref(value, &error, &bad_message));
if (!browser_pref_value) {
error_ = error;
@@ -741,7 +741,7 @@
// Validate also that the stored value can be converted back by the
// transformer.
- scoped_ptr<base::Value> extensionPrefValue(
+ std::unique_ptr<base::Value> extensionPrefValue(
transformer->BrowserToExtensionPref(browser_pref_value.get()));
if (!extensionPrefValue) {
error_ = ErrorUtils::FormatErrorMessage(kConversionErrorMessage,
diff --git a/chrome/browser/extensions/api/preference/preference_api.h b/chrome/browser/extensions/api/preference/preference_api.h
index 3ec5f973..f82bb8e 100644
--- a/chrome/browser/extensions/api/preference/preference_api.h
+++ b/chrome/browser/extensions/api/preference/preference_api.h
@@ -136,7 +136,7 @@
static const bool kServiceRedirectedInIncognito = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<PreferenceEventRouter> preference_event_router_;
+ std::unique_ptr<PreferenceEventRouter> preference_event_router_;
DISALLOW_COPY_AND_ASSIGN(PreferenceAPI);
};
diff --git a/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc b/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
index 187035d6..6fcad79d 100644
--- a/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
+++ b/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc
@@ -4,11 +4,11 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_service.h"
#include "chrome/browser/extensions/api/preference/preference_api.h"
@@ -213,7 +213,8 @@
extension1(), kPref1, new base::StringValue("val1"));
InstallExtensionControlledPrefIncognito(
extension1(), kPref1, new base::StringValue("val2"));
- scoped_ptr<PrefService> incog_prefs(prefs_.CreateIncognitoPrefService());
+ std::unique_ptr<PrefService> incog_prefs(
+ prefs_.CreateIncognitoPrefService());
std::string actual = incog_prefs->GetString(kPref1);
EXPECT_EQ("val2", actual);
}
@@ -223,7 +224,8 @@
std::string actual = prefs()->pref_service()->GetString(kPref1);
EXPECT_EQ("val1", actual);
// Incognito pref service shall see incognito values.
- scoped_ptr<PrefService> incog_prefs(prefs_.CreateIncognitoPrefService());
+ std::unique_ptr<PrefService> incog_prefs(
+ prefs_.CreateIncognitoPrefService());
actual = incog_prefs->GetString(kPref1);
EXPECT_EQ("val2", actual);
}
@@ -242,7 +244,8 @@
extension1(), kPref1, new base::StringValue("val1"));
InstallExtensionControlledPrefIncognitoSessionOnly(
extension1(), kPref1, new base::StringValue("val2"));
- scoped_ptr<PrefService> incog_prefs(prefs_.CreateIncognitoPrefService());
+ std::unique_ptr<PrefService> incog_prefs(
+ prefs_.CreateIncognitoPrefService());
std::string actual = incog_prefs->GetString(kPref1);
EXPECT_EQ("val2", actual);
}
@@ -253,7 +256,8 @@
// Incognito pref service shall see session-only incognito values only
// during first run. Once the pref service was reloaded, all values shall be
// discarded.
- scoped_ptr<PrefService> incog_prefs(prefs_.CreateIncognitoPrefService());
+ std::unique_ptr<PrefService> incog_prefs(
+ prefs_.CreateIncognitoPrefService());
actual = incog_prefs->GetString(kPref1);
if (iteration_ == 0) {
EXPECT_EQ("val2", actual);
@@ -311,7 +315,8 @@
registrar.Add(kPref1, observer.GetCallback());
MockPrefChangeCallback incognito_observer(prefs()->pref_service());
- scoped_ptr<PrefService> incog_prefs(prefs_.CreateIncognitoPrefService());
+ std::unique_ptr<PrefService> incog_prefs(
+ prefs_.CreateIncognitoPrefService());
PrefChangeRegistrar incognito_registrar;
incognito_registrar.Init(incog_prefs.get());
incognito_registrar.Add(kPref1, incognito_observer.GetCallback());
diff --git a/chrome/browser/extensions/api/preference/preference_apitest.cc b/chrome/browser/extensions/api/preference/preference_apitest.cc
index f6e7e40..97f5299f 100644
--- a/chrome/browser/extensions/api/preference/preference_apitest.cc
+++ b/chrome/browser/extensions/api/preference/preference_apitest.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/bind_helpers.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
@@ -94,7 +95,7 @@
// BrowserProcess::Shutdown() needs to be called in a message loop, so we
// post a task to release the keep alive, then run the message loop.
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&scoped_ptr<ScopedKeepAlive>::reset,
+ FROM_HERE, base::Bind(&std::unique_ptr<ScopedKeepAlive>::reset,
base::Unretained(&keep_alive_), nullptr));
content::RunAllPendingInMessageLoop();
@@ -102,7 +103,7 @@
}
Profile* profile_;
- scoped_ptr<ScopedKeepAlive> keep_alive_;
+ std::unique_ptr<ScopedKeepAlive> keep_alive_;
};
// http://crbug.com/177163
diff --git a/chrome/browser/extensions/api/preference/preference_helpers.cc b/chrome/browser/extensions/api/preference/preference_helpers.cc
index c018fa2..e2b3577c 100644
--- a/chrome/browser/extensions/api/preference/preference_helpers.cc
+++ b/chrome/browser/extensions/api/preference/preference_helpers.cc
@@ -127,8 +127,8 @@
}
}
- scoped_ptr<base::ListValue> args_copy(args->DeepCopy());
- scoped_ptr<Event> event(
+ std::unique_ptr<base::ListValue> args_copy(args->DeepCopy());
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args_copy)));
event->restrict_to_browser_context = restrict_to_profile;
router->DispatchEventToExtension(extension->id(), std::move(event));
diff --git a/chrome/browser/extensions/api/processes/processes_api.cc b/chrome/browser/extensions/api/processes/processes_api.cc
index 967e99b..3527bf90 100644
--- a/chrome/browser/extensions/api/processes/processes_api.cc
+++ b/chrome/browser/extensions/api/processes/processes_api.cc
@@ -56,9 +56,9 @@
task_management::REFRESH_TYPE_WEBCACHE_STATS;
}
-scoped_ptr<api::processes::Cache> CreateCacheData(
+std::unique_ptr<api::processes::Cache> CreateCacheData(
const blink::WebCache::ResourceTypeStat& stat) {
- scoped_ptr<api::processes::Cache> cache(new api::processes::Cache());
+ std::unique_ptr<api::processes::Cache> cache(new api::processes::Cache());
cache->size = static_cast<double>(stat.size);
cache->live_size = static_cast<double>(stat.liveSize);
return cache;
@@ -325,10 +325,10 @@
void ProcessesEventRouter::DispatchEvent(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) const {
+ std::unique_ptr<base::ListValue> event_args) const {
EventRouter* event_router = EventRouter::Get(browser_context_);
if (event_router) {
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(event_args)));
event_router->BroadcastEvent(std::move(event));
}
@@ -440,7 +440,7 @@
ExtensionFunction::ResponseAction ProcessesGetProcessIdForTabFunction::Run() {
// For this function, the task manager doesn't even need to be running.
- scoped_ptr<api::processes::GetProcessIdForTab::Params> params(
+ std::unique_ptr<api::processes::GetProcessIdForTab::Params> params(
api::processes::GetProcessIdForTab::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -472,7 +472,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// For this function, the task manager doesn't even need to be running.
- scoped_ptr<api::processes::Terminate::Params> params(
+ std::unique_ptr<api::processes::Terminate::Params> params(
api::processes::Terminate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -564,7 +564,7 @@
}
ExtensionFunction::ResponseAction ProcessesGetProcessInfoFunction::Run() {
- scoped_ptr<api::processes::GetProcessInfo::Params> params(
+ std::unique_ptr<api::processes::GetProcessInfo::Params> params(
api::processes::GetProcessInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->process_ids.as_integer)
diff --git a/chrome/browser/extensions/api/processes/processes_api.h b/chrome/browser/extensions/api/processes/processes_api.h
index 5ea54b0..9b0a32a 100644
--- a/chrome/browser/extensions/api/processes/processes_api.h
+++ b/chrome/browser/extensions/api/processes/processes_api.h
@@ -44,7 +44,7 @@
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) const;
+ std::unique_ptr<base::ListValue> event_args) const;
// Determines whether there is a registered listener for the specified event.
// It helps to avoid collecting data if no one is interested in it.
@@ -102,7 +102,7 @@
content::BrowserContext* browser_context_;
// Created lazily on first access.
- scoped_ptr<ProcessesEventRouter> processes_event_router_;
+ std::unique_ptr<ProcessesEventRouter> processes_event_router_;
DISALLOW_COPY_AND_ASSIGN(ProcessesAPI);
};
diff --git a/chrome/browser/extensions/api/proxy/proxy_api.cc b/chrome/browser/extensions/api/proxy/proxy_api.cc
index adbc9306..65f197a1 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api.cc
@@ -39,7 +39,7 @@
EventRouterForwarder* event_router,
void* profile,
int error_code) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetBoolean(keys::kProxyEventFatal, true);
dict->SetString(keys::kProxyEventError, net::ErrorToString(error_code));
@@ -62,7 +62,7 @@
void* profile,
int line_number,
const base::string16& error) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetBoolean(keys::kProxyEventFatal, false);
dict->SetString(keys::kProxyEventError,
@@ -153,7 +153,8 @@
}
// Build a new ProxyConfig instance as defined in the extension API.
- scoped_ptr<base::DictionaryValue> extension_pref(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> extension_pref(
+ new base::DictionaryValue);
extension_pref->SetString(keys::kProxyConfigMode,
ProxyPrefs::ProxyModeToString(mode));
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
index 34c3117..40bf1770 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
@@ -364,7 +364,7 @@
ProxyPrefs::ProxyMode mode;
CHECK(proxy_config.GetMode(&mode) && mode == ProxyPrefs::MODE_FIXED_SERVERS);
- scoped_ptr<base::DictionaryValue> extension_proxy_rules(
+ std::unique_ptr<base::DictionaryValue> extension_proxy_rules(
new base::DictionaryValue);
std::string proxy_servers;
@@ -430,7 +430,7 @@
}
base::DictionaryValue* CreateProxyServerDict(const net::ProxyServer& proxy) {
- scoped_ptr<base::DictionaryValue> out(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue);
switch (proxy.scheme()) {
case net::ProxyServer::SCHEME_HTTP:
out->SetString(keys::kProxyConfigRuleScheme, "http");
@@ -462,7 +462,8 @@
ProxyPrefs::ProxyMode mode;
CHECK(proxy_config.GetMode(&mode) && mode == ProxyPrefs::MODE_PAC_SCRIPT);
- scoped_ptr<base::DictionaryValue> pac_script_dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> pac_script_dict(
+ new base::DictionaryValue);
std::string pac_url;
if (!proxy_config.GetPacUrl(&pac_url)) {
LOG(ERROR) << "Invalid proxy configuration. Missing PAC URL.";
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
index 98864bd44..b081927 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc
@@ -4,10 +4,12 @@
// Unit tests for helper functions for the Chrome Extensions Proxy Settings API.
-#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h"
+
+#include <memory>
+
#include "base/values.h"
#include "chrome/browser/extensions/api/proxy/proxy_api_constants.h"
-#include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h"
#include "components/proxy_config/proxy_config_dictionary.h"
#include "components/proxy_config/proxy_prefs.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -220,76 +222,46 @@
TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) {
std::string error;
- scoped_ptr<base::DictionaryValue> exp_direct(
+ std::unique_ptr<base::DictionaryValue> exp_direct(
ProxyConfigDictionary::CreateDirect());
- scoped_ptr<base::DictionaryValue> out_direct(
- CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT,
- false,
- std::string(),
- std::string(),
- std::string(),
- std::string(),
- &error));
+ std::unique_ptr<base::DictionaryValue> out_direct(CreateProxyConfigDict(
+ ProxyPrefs::MODE_DIRECT, false, std::string(), std::string(),
+ std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_direct.get(), out_direct.get()));
- scoped_ptr<base::DictionaryValue> exp_auto(
+ std::unique_ptr<base::DictionaryValue> exp_auto(
ProxyConfigDictionary::CreateAutoDetect());
- scoped_ptr<base::DictionaryValue> out_auto(
- CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT,
- false,
- std::string(),
- std::string(),
- std::string(),
- std::string(),
- &error));
+ std::unique_ptr<base::DictionaryValue> out_auto(CreateProxyConfigDict(
+ ProxyPrefs::MODE_AUTO_DETECT, false, std::string(), std::string(),
+ std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_auto.get(), out_auto.get()));
- scoped_ptr<base::DictionaryValue> exp_pac_url(
+ std::unique_ptr<base::DictionaryValue> exp_pac_url(
ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false));
- scoped_ptr<base::DictionaryValue> out_pac_url(
- CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT,
- false,
- kSamplePacScriptUrl,
- std::string(),
- std::string(),
- std::string(),
- &error));
+ std::unique_ptr<base::DictionaryValue> out_pac_url(CreateProxyConfigDict(
+ ProxyPrefs::MODE_PAC_SCRIPT, false, kSamplePacScriptUrl, std::string(),
+ std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_pac_url.get(), out_pac_url.get()));
- scoped_ptr<base::DictionaryValue> exp_pac_data(
+ std::unique_ptr<base::DictionaryValue> exp_pac_data(
ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false));
- scoped_ptr<base::DictionaryValue> out_pac_data(
- CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT,
- false,
- std::string(),
- kSamplePacScript,
- std::string(),
- std::string(),
- &error));
+ std::unique_ptr<base::DictionaryValue> out_pac_data(CreateProxyConfigDict(
+ ProxyPrefs::MODE_PAC_SCRIPT, false, std::string(), kSamplePacScript,
+ std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_pac_data.get(), out_pac_data.get()));
- scoped_ptr<base::DictionaryValue> exp_fixed(
+ std::unique_ptr<base::DictionaryValue> exp_fixed(
ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost"));
- scoped_ptr<base::DictionaryValue> out_fixed(
- CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS,
- false,
- std::string(),
- std::string(),
- "foo:80",
- "localhost",
- &error));
+ std::unique_ptr<base::DictionaryValue> out_fixed(CreateProxyConfigDict(
+ ProxyPrefs::MODE_FIXED_SERVERS, false, std::string(), std::string(),
+ "foo:80", "localhost", &error));
EXPECT_TRUE(base::Value::Equals(exp_fixed.get(), out_fixed.get()));
- scoped_ptr<base::DictionaryValue> exp_system(
+ std::unique_ptr<base::DictionaryValue> exp_system(
ProxyConfigDictionary::CreateSystem());
- scoped_ptr<base::DictionaryValue> out_system(
- CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM,
- false,
- std::string(),
- std::string(),
- std::string(),
- std::string(),
- &error));
+ std::unique_ptr<base::DictionaryValue> out_system(CreateProxyConfigDict(
+ ProxyPrefs::MODE_SYSTEM, false, std::string(), std::string(),
+ std::string(), std::string(), &error));
EXPECT_TRUE(base::Value::Equals(exp_system.get(), out_system.get()));
// Neither of them should have set an error.
@@ -336,16 +308,16 @@
// This tests CreateProxyServerDict as well.
TEST(ExtensionProxyApiHelpers, CreateProxyRulesDict) {
- scoped_ptr<base::DictionaryValue> browser_pref(
+ std::unique_ptr<base::DictionaryValue> browser_pref(
ProxyConfigDictionary::CreateFixedServers(
"http=proxy1:80;https=proxy2:80;ftp=proxy3:80;socks=proxy4:80",
"localhost"));
ProxyConfigDictionary config(browser_pref.get());
- scoped_ptr<base::DictionaryValue> extension_pref(
+ std::unique_ptr<base::DictionaryValue> extension_pref(
CreateProxyRulesDict(config));
ASSERT_TRUE(extension_pref.get());
- scoped_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
expected->Set("proxyForHttp",
CreateTestProxyServerDict("http", "proxy1", 80));
expected->Set("proxyForHttps",
@@ -363,17 +335,17 @@
// Test multiple proxies per scheme -- expect that only the first is returned.
TEST(ExtensionProxyApiHelpers, CreateProxyRulesDictMultipleProxies) {
- scoped_ptr<base::DictionaryValue> browser_pref(
+ std::unique_ptr<base::DictionaryValue> browser_pref(
ProxyConfigDictionary::CreateFixedServers(
"http=proxy1:80,default://;https=proxy2:80,proxy1:80;ftp=proxy3:80,"
"https://proxy5:443;socks=proxy4:80,proxy1:80",
"localhost"));
ProxyConfigDictionary config(browser_pref.get());
- scoped_ptr<base::DictionaryValue> extension_pref(
+ std::unique_ptr<base::DictionaryValue> extension_pref(
CreateProxyRulesDict(config));
ASSERT_TRUE(extension_pref.get());
- scoped_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
expected->Set("proxyForHttp",
CreateTestProxyServerDict("http", "proxy1", 80));
expected->Set("proxyForHttps",
@@ -391,13 +363,14 @@
// Test if a PAC script URL is specified.
TEST(ExtensionProxyApiHelpers, CreatePacScriptDictWithUrl) {
- scoped_ptr<base::DictionaryValue> browser_pref(
+ std::unique_ptr<base::DictionaryValue> browser_pref(
ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false));
ProxyConfigDictionary config(browser_pref.get());
- scoped_ptr<base::DictionaryValue> extension_pref(CreatePacScriptDict(config));
+ std::unique_ptr<base::DictionaryValue> extension_pref(
+ CreatePacScriptDict(config));
ASSERT_TRUE(extension_pref.get());
- scoped_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
expected->SetString(keys::kProxyConfigPacScriptUrl, kSamplePacScriptUrl);
expected->SetBoolean(keys::kProxyConfigPacScriptMandatory, false);
@@ -406,13 +379,14 @@
// Test if a PAC script is encoded in a data URL.
TEST(ExtensionProxyApiHelpers, CreatePacScriptDictWidthData) {
- scoped_ptr<base::DictionaryValue> browser_pref(
+ std::unique_ptr<base::DictionaryValue> browser_pref(
ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false));
ProxyConfigDictionary config(browser_pref.get());
- scoped_ptr<base::DictionaryValue> extension_pref(CreatePacScriptDict(config));
+ std::unique_ptr<base::DictionaryValue> extension_pref(
+ CreatePacScriptDict(config));
ASSERT_TRUE(extension_pref.get());
- scoped_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> expected(new base::DictionaryValue);
expected->SetString(keys::kProxyConfigPacScriptData, kSamplePacScript);
expected->SetBoolean(keys::kProxyConfigPacScriptMandatory, false);
@@ -425,7 +399,7 @@
expected.Append(new base::StringValue("s2"));
expected.Append(new base::StringValue("s3"));
- scoped_ptr<base::ListValue> out(TokenizeToStringList("s1;s2;s3", ";"));
+ std::unique_ptr<base::ListValue> out(TokenizeToStringList("s1;s2;s3", ";"));
EXPECT_TRUE(base::Value::Equals(&expected, out.get()));
}
diff --git a/chrome/browser/extensions/api/resources_private/resources_private_api.cc b/chrome/browser/extensions/api/resources_private/resources_private_api.cc
index 1aed8116..37a7fa38 100644
--- a/chrome/browser/extensions/api/resources_private/resources_private_api.cc
+++ b/chrome/browser/extensions/api/resources_private/resources_private_api.cc
@@ -61,8 +61,9 @@
ResourcesPrivateGetStringsFunction::~ResourcesPrivateGetStringsFunction() {}
ExtensionFunction::ResponseAction ResourcesPrivateGetStringsFunction::Run() {
- scoped_ptr<get_strings::Params> params(get_strings::Params::Create(*args_));
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<get_strings::Params> params(
+ get_strings::Params::Create(*args_));
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
api::resources_private::Component component = params->component;
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
index 33cef86..cfa1d27 100644
--- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
+++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
@@ -65,7 +65,7 @@
ScreenlockPrivateSetLockedFunction::~ScreenlockPrivateSetLockedFunction() {}
bool ScreenlockPrivateSetLockedFunction::RunAsync() {
- scoped_ptr<screenlock::SetLocked::Params> params(
+ std::unique_ptr<screenlock::SetLocked::Params> params(
screenlock::SetLocked::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
EasyUnlockService* service = EasyUnlockService::Get(GetProfile());
@@ -95,7 +95,7 @@
~ScreenlockPrivateAcceptAuthAttemptFunction() {}
bool ScreenlockPrivateAcceptAuthAttemptFunction::RunSync() {
- scoped_ptr<screenlock::AcceptAuthAttempt::Params> params(
+ std::unique_ptr<screenlock::AcceptAuthAttempt::Params> params(
screenlock::AcceptAuthAttempt::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -135,10 +135,10 @@
events::HistogramValue histogram_value,
const std::string& event_name,
base::Value* arg) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
if (arg)
args->Append(arg);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
@@ -164,11 +164,11 @@
if (!router->HasEventListener(screenlock::OnAuthAttempted::kEventName))
return false;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->AppendString(screenlock::ToString(FromLockHandlerAuthType(auth_type)));
args->AppendString(value);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED,
screenlock::OnAuthAttempted::kEventName, std::move(args)));
router->BroadcastEvent(std::move(event));
diff --git a/chrome/browser/extensions/api/sessions/session_id.cc b/chrome/browser/extensions/api/sessions/session_id.cc
index 37201a0..1862a3da 100644
--- a/chrome/browser/extensions/api/sessions/session_id.cc
+++ b/chrome/browser/extensions/api/sessions/session_id.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
namespace extensions {
@@ -13,7 +14,7 @@
const char kIdSeparator = '.';
// static
-scoped_ptr<SessionId> SessionId::Parse(const std::string& session_id) {
+std::unique_ptr<SessionId> SessionId::Parse(const std::string& session_id) {
std::string session_tag;
// Populate session_tag if the |session_id| represents a foreign SessionId.
@@ -28,9 +29,9 @@
if (!base::StringToInt(
session_tag.empty() ? session_id : session_id.substr(separator + 1),
&id)) {
- return scoped_ptr<SessionId>();
+ return std::unique_ptr<SessionId>();
}
- return make_scoped_ptr(new SessionId(session_tag, id));
+ return base::WrapUnique(new SessionId(session_tag, id));
}
SessionId::SessionId(const std::string& session_tag, int id)
diff --git a/chrome/browser/extensions/api/sessions/session_id.h b/chrome/browser/extensions/api/sessions/session_id.h
index c973f9f..627542c 100644
--- a/chrome/browser/extensions/api/sessions/session_id.h
+++ b/chrome/browser/extensions/api/sessions/session_id.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__
#define CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
namespace extensions {
@@ -17,7 +17,7 @@
// Returns a SessionId, representing either a local or a foreign session.
// In the case that the session is local, |session_tag_| will be empty string.
// |session_string| should be in the format that ToString() would produce.
- static scoped_ptr<SessionId> Parse(const std::string& session_string);
+ static std::unique_ptr<SessionId> Parse(const std::string& session_string);
// Constructs a SessionId object for the given session information.
// |session_tag| is the string used to uniquely identify a synced foreign
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc
index 9e49631..3328467 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.cc
+++ b/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -5,11 +5,13 @@
#include "chrome/browser/extensions/api/sessions/sessions_api.h"
#include <stddef.h>
+
#include <utility>
#include <vector>
#include "base/i18n/rtl.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -106,12 +108,12 @@
return tab_struct;
}
-scoped_ptr<windows::Window> CreateWindowModelHelper(
- scoped_ptr<std::vector<tabs::Tab>> tabs,
+std::unique_ptr<windows::Window> CreateWindowModelHelper(
+ std::unique_ptr<std::vector<tabs::Tab>> tabs,
const std::string& session_id,
const windows::WindowType& type,
const windows::WindowState& state) {
- scoped_ptr<windows::Window> window_struct(new windows::Window);
+ std::unique_ptr<windows::Window> window_struct(new windows::Window);
window_struct->tabs = std::move(tabs);
window_struct->session_id.reset(new std::string(session_id));
window_struct->incognito = false;
@@ -122,11 +124,11 @@
return window_struct;
}
-scoped_ptr<api::sessions::Session> CreateSessionModelHelper(
+std::unique_ptr<api::sessions::Session> CreateSessionModelHelper(
int last_modified,
- scoped_ptr<tabs::Tab> tab,
- scoped_ptr<windows::Window> window) {
- scoped_ptr<api::sessions::Session> session_struct(
+ std::unique_ptr<tabs::Tab> tab,
+ std::unique_ptr<windows::Window> window) {
+ std::unique_ptr<api::sessions::Session> session_struct(
new api::sessions::Session());
session_struct->last_modified = last_modified;
if (tab)
@@ -159,13 +161,13 @@
extension());
}
-scoped_ptr<windows::Window>
+std::unique_ptr<windows::Window>
SessionsGetRecentlyClosedFunction::CreateWindowModel(
const sessions::TabRestoreService::Window& window,
int session_id) {
DCHECK(!window.tabs.empty());
- scoped_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>());
+ std::unique_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>());
for (size_t i = 0; i < window.tabs.size(); ++i) {
tabs->push_back(CreateTabModel(window.tabs[i], window.tabs[i].id,
window.selected_tab_index));
@@ -176,11 +178,11 @@
windows::WINDOW_STATE_NORMAL);
}
-scoped_ptr<api::sessions::Session>
+std::unique_ptr<api::sessions::Session>
SessionsGetRecentlyClosedFunction::CreateSessionModel(
const sessions::TabRestoreService::Entry* entry) {
- scoped_ptr<tabs::Tab> tab;
- scoped_ptr<windows::Window> window;
+ std::unique_ptr<tabs::Tab> tab;
+ std::unique_ptr<windows::Window> window;
switch (entry->type) {
case sessions::TabRestoreService::TAB:
tab.reset(new tabs::Tab(CreateTabModel(
@@ -200,7 +202,7 @@
}
bool SessionsGetRecentlyClosedFunction::RunSync() {
- scoped_ptr<GetRecentlyClosed::Params> params(
+ std::unique_ptr<GetRecentlyClosed::Params> params(
GetRecentlyClosed::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
int max_results = api::sessions::MAX_SESSION_RESULTS;
@@ -250,8 +252,9 @@
extension());
}
-scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
- const sessions::SessionWindow& window, const std::string& session_tag) {
+std::unique_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
+ const sessions::SessionWindow& window,
+ const std::string& session_tag) {
DCHECK(!window.tabs.empty());
// Prune tabs that are not syncable or are NewTabPage. Then, sort the tabs
@@ -269,10 +272,10 @@
tabs_in_window.push_back(tab);
}
if (tabs_in_window.empty())
- return scoped_ptr<windows::Window>();
+ return std::unique_ptr<windows::Window>();
std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency);
- scoped_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>());
+ std::unique_ptr<std::vector<tabs::Tab>> tabs(new std::vector<tabs::Tab>());
for (size_t i = 0; i < tabs_in_window.size(); ++i) {
tabs->push_back(CreateTabModel(session_tag, *tabs_in_window[i], i,
window.selected_tab_index));
@@ -312,7 +315,7 @@
break;
}
- scoped_ptr<windows::Window> window_struct(
+ std::unique_ptr<windows::Window> window_struct(
CreateWindowModelHelper(std::move(tabs), session_id, type, state));
// TODO(dwankri): Dig deeper to resolve bounds not being optional, so closed
// windows in GetRecentlyClosed can have set values in Window helper.
@@ -324,16 +327,17 @@
return window_struct;
}
-scoped_ptr<api::sessions::Session>
+std::unique_ptr<api::sessions::Session>
SessionsGetDevicesFunction::CreateSessionModel(
- const sessions::SessionWindow& window, const std::string& session_tag) {
- scoped_ptr<windows::Window> window_model(
+ const sessions::SessionWindow& window,
+ const std::string& session_tag) {
+ std::unique_ptr<windows::Window> window_model(
CreateWindowModel(window, session_tag));
// There is a chance that after pruning uninteresting tabs the window will be
// empty.
- return !window_model ? scoped_ptr<api::sessions::Session>()
+ return !window_model ? std::unique_ptr<api::sessions::Session>()
: CreateSessionModelHelper(window.timestamp.ToTimeT(),
- scoped_ptr<tabs::Tab>(),
+ std::unique_ptr<tabs::Tab>(),
std::move(window_model));
}
@@ -341,7 +345,8 @@
const sync_driver::SyncedSession* session) {
int max_results = api::sessions::MAX_SESSION_RESULTS;
// Already validated in RunAsync().
- scoped_ptr<GetDevices::Params> params(GetDevices::Params::Create(*args_));
+ std::unique_ptr<GetDevices::Params> params(
+ GetDevices::Params::Create(*args_));
if (params->filter && params->filter->max_results)
max_results = *params->filter->max_results;
@@ -354,8 +359,8 @@
it != session->windows.end() &&
static_cast<int>(device_struct.sessions.size()) < max_results;
++it) {
- scoped_ptr<api::sessions::Session> session_model(CreateSessionModel(
- *it->second, session->session_tag));
+ std::unique_ptr<api::sessions::Session> session_model(
+ CreateSessionModel(*it->second, session->session_tag));
if (session_model)
device_struct.sessions.push_back(std::move(*session_model));
}
@@ -380,7 +385,8 @@
return true;
}
- scoped_ptr<GetDevices::Params> params(GetDevices::Params::Create(*args_));
+ std::unique_ptr<GetDevices::Params> params(
+ GetDevices::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
if (params->filter && params->filter->max_results) {
EXTENSION_FUNCTION_VALIDATE(*params->filter->max_results >= 0 &&
@@ -404,11 +410,11 @@
void SessionsRestoreFunction::SetResultRestoredTab(
content::WebContents* contents) {
- scoped_ptr<tabs::Tab> tab(
+ std::unique_ptr<tabs::Tab> tab(
ExtensionTabUtil::CreateTabObject(contents, extension()));
- scoped_ptr<api::sessions::Session> restored_session(
+ std::unique_ptr<api::sessions::Session> restored_session(
CreateSessionModelHelper(base::Time::Now().ToTimeT(), std::move(tab),
- scoped_ptr<windows::Window>()));
+ std::unique_ptr<windows::Window>()));
results_ = Restore::Results::Create(*restored_session);
}
@@ -418,12 +424,13 @@
// error_ is set by GetWindowFromWindowId function call.
return false;
}
- scoped_ptr<base::DictionaryValue> window_value(
+ std::unique_ptr<base::DictionaryValue> window_value(
controller->CreateWindowValueWithTabs(extension()));
- scoped_ptr<windows::Window> window(windows::Window::FromValue(
- *window_value));
+ std::unique_ptr<windows::Window> window(
+ windows::Window::FromValue(*window_value));
results_ = Restore::Results::Create(*CreateSessionModelHelper(
- base::Time::Now().ToTimeT(), scoped_ptr<tabs::Tab>(), std::move(window)));
+ base::Time::Now().ToTimeT(), std::unique_ptr<tabs::Tab>(),
+ std::move(window)));
return true;
}
@@ -558,7 +565,7 @@
}
bool SessionsRestoreFunction::RunSync() {
- scoped_ptr<Restore::Params> params(Restore::Params::Create(*args_));
+ std::unique_ptr<Restore::Params> params(Restore::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
Browser* browser = chrome::FindBrowserWithProfile(GetProfile());
@@ -575,7 +582,7 @@
if (!params->session_id)
return RestoreMostRecentlyClosed(browser);
- scoped_ptr<SessionId> session_id(SessionId::Parse(*params->session_id));
+ std::unique_ptr<SessionId> session_id(SessionId::Parse(*params->session_id));
if (!session_id) {
SetInvalidIdError(*params->session_id);
return false;
@@ -604,8 +611,8 @@
void SessionsEventRouter::TabRestoreServiceChanged(
sessions::TabRestoreService* service) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
- EventRouter::Get(profile_)->BroadcastEvent(make_scoped_ptr(
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
+ EventRouter::Get(profile_)->BroadcastEvent(base::WrapUnique(
new Event(events::SESSIONS_ON_CHANGED,
api::sessions::OnChanged::kEventName, std::move(args))));
}
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.h b/chrome/browser/extensions/api/sessions/sessions_api.h
index 9edf5464..cd1afeb 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.h
+++ b/chrome/browser/extensions/api/sessions/sessions_api.h
@@ -38,10 +38,10 @@
api::tabs::Tab CreateTabModel(const sessions::TabRestoreService::Tab& tab,
int session_id,
int selected_index);
- scoped_ptr<api::windows::Window> CreateWindowModel(
+ std::unique_ptr<api::windows::Window> CreateWindowModel(
const sessions::TabRestoreService::Window& window,
int session_id);
- scoped_ptr<api::sessions::Session> CreateSessionModel(
+ std::unique_ptr<api::sessions::Session> CreateSessionModel(
const sessions::TabRestoreService::Entry* entry);
};
@@ -56,10 +56,10 @@
const sessions::SessionTab& tab,
int tab_index,
int selected_index);
- scoped_ptr<api::windows::Window> CreateWindowModel(
+ std::unique_ptr<api::windows::Window> CreateWindowModel(
const sessions::SessionWindow& window,
const std::string& session_tag);
- scoped_ptr<api::sessions::Session> CreateSessionModel(
+ std::unique_ptr<api::sessions::Session> CreateSessionModel(
const sessions::SessionWindow& window,
const std::string& session_tag);
api::sessions::Device CreateDeviceModel(
@@ -133,7 +133,7 @@
static const bool kServiceIsNULLWhileTesting = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<SessionsEventRouter> sessions_event_router_;
+ std::unique_ptr<SessionsEventRouter> sessions_event_router_;
DISALLOW_COPY_AND_ASSIGN(SessionsAPI);
};
diff --git a/chrome/browser/extensions/api/sessions/sessions_apitest.cc b/chrome/browser/extensions/api/sessions/sessions_apitest.cc
index 0c2903bee4..8a06bd3b 100644
--- a/chrome/browser/extensions/api/sessions/sessions_apitest.cc
+++ b/chrome/browser/extensions/api/sessions/sessions_apitest.cc
@@ -3,10 +3,12 @@
// found in the LICENSE file.
#include <stddef.h>
+
#include <utility>
#include "base/command_line.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/strings/pattern.h"
#include "base/strings/stringprintf.h"
@@ -96,7 +98,7 @@
void SetUpOnMainThread() override;
protected:
- static scoped_ptr<KeyedService> BuildProfileSyncService(
+ static std::unique_ptr<KeyedService> BuildProfileSyncService(
content::BrowserContext* profile);
void CreateTestProfileSyncService();
@@ -127,29 +129,25 @@
CreateTestExtension();
}
-scoped_ptr<KeyedService> ExtensionSessionsTest::BuildProfileSyncService(
+std::unique_ptr<KeyedService> ExtensionSessionsTest::BuildProfileSyncService(
content::BrowserContext* context) {
- scoped_ptr<SyncApiComponentFactoryMock> factory(
+ std::unique_ptr<SyncApiComponentFactoryMock> factory(
new SyncApiComponentFactoryMock());
factory->SetLocalDeviceInfoProvider(
- scoped_ptr<sync_driver::LocalDeviceInfoProvider>(
+ std::unique_ptr<sync_driver::LocalDeviceInfoProvider>(
new sync_driver::LocalDeviceInfoProviderMock(
- kSessionTags[0],
- "machine name",
- "Chromium 10k",
- "Chrome 10k",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
- "device_id")));
+ kSessionTags[0], "machine name", "Chromium 10k", "Chrome 10k",
+ sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id")));
Profile* profile = static_cast<Profile*>(context);
ProfileSyncServiceMock* sync_service =
new ProfileSyncServiceMock(CreateProfileSyncServiceParamsForTest(
- make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)),
+ base::WrapUnique(new browser_sync::ChromeSyncClient(profile)),
profile));
static_cast<browser_sync::ChromeSyncClient*>(sync_service->GetSyncClient())
->SetSyncApiComponentFactoryForTesting(std::move(factory));
- return make_scoped_ptr(sync_service);
+ return base::WrapUnique(sync_service);
}
void ExtensionSessionsTest::CreateTestProfileSyncService() {
@@ -189,7 +187,7 @@
}
void ExtensionSessionsTest::CreateTestExtension() {
- scoped_ptr<base::DictionaryValue> test_extension_value(
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
api_test_utils::ParseDictionary(
"{\"name\": \"Test\", \"version\": \"1.0\", "
"\"permissions\": [\"sessions\", \"tabs\"]}"));
@@ -230,13 +228,13 @@
}
}
- ProfileSyncServiceFactory::GetForProfile(browser_->profile())->
- GetSessionsSyncableService()->
- MergeDataAndStartSyncing(syncer::SESSIONS, initial_data,
- scoped_ptr<syncer::SyncChangeProcessor>(
- new syncer::FakeSyncChangeProcessor()),
- scoped_ptr<syncer::SyncErrorFactory>(
- new syncer::SyncErrorFactoryMock()));
+ ProfileSyncServiceFactory::GetForProfile(browser_->profile())
+ ->GetSessionsSyncableService()
+ ->MergeDataAndStartSyncing(syncer::SESSIONS, initial_data,
+ std::unique_ptr<syncer::SyncChangeProcessor>(
+ new syncer::FakeSyncChangeProcessor()),
+ std::unique_ptr<syncer::SyncErrorFactory>(
+ new syncer::SyncErrorFactoryMock()));
}
testing::AssertionResult CheckSessionModels(const base::ListValue& devices,
@@ -290,31 +288,28 @@
IN_PROC_BROWSER_TEST_F(ExtensionSessionsTest, GetDevices) {
CreateSessionModels();
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
CreateFunction<SessionsGetDevicesFunction>(true).get(),
- "[{\"maxResults\": 0}]",
- browser_)));
+ "[{\"maxResults\": 0}]", browser_)));
ASSERT_TRUE(result);
EXPECT_TRUE(CheckSessionModels(*result, 0u));
}
IN_PROC_BROWSER_TEST_F(ExtensionSessionsTest, GetDevicesMaxResults) {
CreateSessionModels();
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(
- CreateFunction<SessionsGetDevicesFunction>(true).get(),
- "[]",
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ CreateFunction<SessionsGetDevicesFunction>(true).get(), "[]",
browser_)));
ASSERT_TRUE(result);
EXPECT_TRUE(CheckSessionModels(*result, 1u));
}
IN_PROC_BROWSER_TEST_F(ExtensionSessionsTest, GetDevicesListEmpty) {
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(
- CreateFunction<SessionsGetDevicesFunction>(true).get(),
- "[]",
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ CreateFunction<SessionsGetDevicesFunction>(true).get(), "[]",
browser_)));
ASSERT_TRUE(result);
@@ -327,19 +322,15 @@
DISABLED_RestoreForeignSessionWindow) {
CreateSessionModels();
- scoped_ptr<base::DictionaryValue> restored_window_session(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
- CreateFunction<SessionsRestoreFunction>(true).get(),
- "[\"tag3.3\"]",
- browser_,
- utils::INCLUDE_INCOGNITO)));
+ std::unique_ptr<base::DictionaryValue> restored_window_session(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ CreateFunction<SessionsRestoreFunction>(true).get(), "[\"tag3.3\"]",
+ browser_, utils::INCLUDE_INCOGNITO)));
ASSERT_TRUE(restored_window_session);
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(
- CreateFunction<WindowsGetAllFunction>(true).get(),
- "[]",
- browser_)));
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ CreateFunction<WindowsGetAllFunction>(true).get(), "[]", browser_)));
ASSERT_TRUE(result);
base::ListValue* windows = result.get();
@@ -377,10 +368,9 @@
}
IN_PROC_BROWSER_TEST_F(ExtensionSessionsTest, GetRecentlyClosedIncognito) {
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(
- CreateFunction<SessionsGetRecentlyClosedFunction>(true).get(),
- "[]",
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ CreateFunction<SessionsGetRecentlyClosedFunction>(true).get(), "[]",
CreateIncognitoBrowser())));
ASSERT_TRUE(result);
base::ListValue* sessions = result.get();
diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
index 1fe7998..23dc6d7 100644
--- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
+++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
@@ -188,7 +188,7 @@
kManyStartupPagesWarning,
manifest_keys::kSettingsOverride);
}
- scoped_ptr<base::ListValue> url_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> url_list(new base::ListValue);
url_list->Append(new base::StringValue(SubstituteInstallParam(
settings->startup_pages[0].spec(), install_parameter)));
SetPref(
@@ -267,7 +267,7 @@
const SettingsOverrides* settings = SettingsOverrides::Get(extension);
DCHECK(settings);
DCHECK(settings->search_engine);
- scoped_ptr<TemplateURL::AssociatedExtensionInfo> info(
+ std::unique_ptr<TemplateURL::AssociatedExtensionInfo> info(
new TemplateURL::AssociatedExtensionInfo(
TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, extension->id()));
info->wants_to_be_default_engine = settings->search_engine->is_default;
diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
index b100db0..5167a04 100644
--- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
+++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.h
@@ -69,7 +69,7 @@
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
- scoped_ptr<TemplateURLService::Subscription> template_url_sub_;
+ std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
DISALLOW_COPY_AND_ASSIGN(SettingsOverridesAPI);
};
diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc b/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc
index d721f2ca0e..7c48d49 100644
--- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc
+++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc
@@ -35,7 +35,7 @@
runner_->Quit();
}
base::RunLoop* runner_;
- scoped_ptr<TemplateURLService::Subscription> template_url_sub_;
+ std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceObserver);
};
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc
index 0f69e53..bd007efe 100644
--- a/chrome/browser/extensions/api/settings_private/prefs_util.cc
+++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -292,9 +292,9 @@
}
}
-scoped_ptr<settings_private::PrefObject> PrefsUtil::GetCrosSettingsPref(
+std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetCrosSettingsPref(
const std::string& name) {
- scoped_ptr<settings_private::PrefObject> pref_object(
+ std::unique_ptr<settings_private::PrefObject> pref_object(
new settings_private::PrefObject());
#if defined(OS_CHROMEOS)
@@ -308,10 +308,10 @@
return pref_object;
}
-scoped_ptr<settings_private::PrefObject> PrefsUtil::GetPref(
+std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetPref(
const std::string& name) {
const PrefService::Preference* pref = nullptr;
- scoped_ptr<settings_private::PrefObject> pref_object;
+ std::unique_ptr<settings_private::PrefObject> pref_object;
if (IsCrosSetting(name)) {
pref_object = GetCrosSettingsPref(name);
} else {
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.h b/chrome/browser/extensions/api/settings_private/prefs_util.h
index ee750e7a..321a5c9 100644
--- a/chrome/browser/extensions/api/settings_private/prefs_util.h
+++ b/chrome/browser/extensions/api/settings_private/prefs_util.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_PREFS_UTIL_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/common/extensions/api/settings_private.h"
@@ -43,7 +43,7 @@
// Gets the value of the pref with the given |name|. Returns a pointer to an
// empty PrefObject if no pref is found for |name|.
- virtual scoped_ptr<api::settings_private::PrefObject> GetPref(
+ virtual std::unique_ptr<api::settings_private::PrefObject> GetPref(
const std::string& name);
// Sets the pref with the given name and value in the proper PrefService.
@@ -96,7 +96,7 @@
api::settings_private::PrefType GetType(const std::string& name,
base::Value::Type type);
- scoped_ptr<api::settings_private::PrefObject> GetCrosSettingsPref(
+ std::unique_ptr<api::settings_private::PrefObject> GetCrosSettingsPref(
const std::string& name);
SetPrefResult SetCrosSettingsPref(const std::string& name,
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_api.cc b/chrome/browser/extensions/api/settings_private/settings_private_api.cc
index 7a510d0..cfacf75 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_api.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_api.cc
@@ -28,7 +28,7 @@
}
ExtensionFunction::ResponseAction SettingsPrivateSetPrefFunction::Run() {
- scoped_ptr<api::settings_private::SetPref::Params> parameters =
+ std::unique_ptr<api::settings_private::SetPref::Params> parameters =
api::settings_private::SetPref::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -83,7 +83,7 @@
}
ExtensionFunction::ResponseAction SettingsPrivateGetPrefFunction::Run() {
- scoped_ptr<api::settings_private::GetPref::Params> parameters =
+ std::unique_ptr<api::settings_private::GetPref::Params> parameters =
api::settings_private::GetPref::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -92,7 +92,7 @@
if (delegate == nullptr)
return RespondNow(Error(kDelegateIsNull));
- scoped_ptr<base::Value> value = delegate->GetPref(parameters->name);
+ std::unique_ptr<base::Value> value = delegate->GetPref(parameters->name);
if (value->IsType(base::Value::TYPE_NULL))
return RespondNow(Error("Pref * does not exist", parameters->name));
else
@@ -128,8 +128,9 @@
ExtensionFunction::ResponseAction
SettingsPrivateSetDefaultZoomPercentFunction::Run() {
- scoped_ptr<api::settings_private::SetDefaultZoomPercent::Params> parameters =
- api::settings_private::SetDefaultZoomPercent::Params::Create(*args_);
+ std::unique_ptr<api::settings_private::SetDefaultZoomPercent::Params>
+ parameters =
+ api::settings_private::SetDefaultZoomPercent::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
SettingsPrivateDelegate* delegate =
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc b/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
index fdc96a13..3e6d167 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
@@ -2,9 +2,10 @@
// 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/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/settings_private/settings_private_delegate.h"
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc b/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
index 5cf66b8..8395e36 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
@@ -31,21 +31,21 @@
SettingsPrivateDelegate::~SettingsPrivateDelegate() {
}
-scoped_ptr<base::Value> SettingsPrivateDelegate::GetPref(
+std::unique_ptr<base::Value> SettingsPrivateDelegate::GetPref(
const std::string& name) {
- scoped_ptr<api::settings_private::PrefObject> pref =
+ std::unique_ptr<api::settings_private::PrefObject> pref =
prefs_util_->GetPref(name);
if (!pref)
return base::Value::CreateNullValue();
return pref->ToValue();
}
-scoped_ptr<base::Value> SettingsPrivateDelegate::GetAllPrefs() {
- scoped_ptr<base::ListValue> prefs(new base::ListValue());
+std::unique_ptr<base::Value> SettingsPrivateDelegate::GetAllPrefs() {
+ std::unique_ptr<base::ListValue> prefs(new base::ListValue());
const TypedPrefMap& keys = prefs_util_->GetWhitelistedKeys();
for (const auto& it : keys) {
- scoped_ptr<base::Value> pref = GetPref(it.first);
+ std::unique_ptr<base::Value> pref = GetPref(it.first);
if (!pref->IsType(base::Value::TYPE_NULL))
prefs->Append(pref.release());
}
@@ -58,10 +58,10 @@
return prefs_util_->SetPref(pref_name, value);
}
-scoped_ptr<base::Value> SettingsPrivateDelegate::GetDefaultZoomPercent() {
+std::unique_ptr<base::Value> SettingsPrivateDelegate::GetDefaultZoomPercent() {
double zoom = content::ZoomLevelToZoomFactor(
profile_->GetZoomLevelPrefs()->GetDefaultZoomLevelPref()) * 100;
- scoped_ptr<base::Value> value(new base::FundamentalValue(zoom));
+ std::unique_ptr<base::Value> value(new base::FundamentalValue(zoom));
return value;
}
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_delegate.h b/chrome/browser/extensions/api/settings_private/settings_private_delegate.h
index ede6e15..66c7153 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_delegate.h
+++ b/chrome/browser/extensions/api/settings_private/settings_private_delegate.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_DELEGATE_H_
#include <map>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/settings_private/prefs_util.h"
#include "chrome/common/extensions/api/settings_private.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -39,20 +39,20 @@
const std::string& name, const base::Value* value);
// Gets the value of the pref with the given |name|.
- virtual scoped_ptr<base::Value> GetPref(const std::string& name);
+ virtual std::unique_ptr<base::Value> GetPref(const std::string& name);
// Gets the values of all whitelisted prefs.
- virtual scoped_ptr<base::Value> GetAllPrefs();
+ virtual std::unique_ptr<base::Value> GetAllPrefs();
// Gets the value.
- virtual scoped_ptr<base::Value> GetDefaultZoomPercent();
+ virtual std::unique_ptr<base::Value> GetDefaultZoomPercent();
// Sets the pref.
virtual PrefsUtil::SetPrefResult SetDefaultZoomPercent(int percent);
protected:
Profile* profile_; // weak; not owned by us
- scoped_ptr<PrefsUtil> prefs_util_;
+ std::unique_ptr<PrefsUtil> prefs_util_;
private:
DISALLOW_COPY_AND_ASSIGN(SettingsPrivateDelegate);
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc b/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc
index f51f6db..4b0db66 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc
@@ -94,7 +94,7 @@
std::string pref_name = it.first;
if (prefs_util_->IsCrosSetting(pref_name)) {
#if defined(OS_CHROMEOS)
- scoped_ptr<chromeos::CrosSettings::ObserverSubscription> observer =
+ std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> observer =
chromeos::CrosSettings::Get()->AddSettingsObserver(
pref_name.c_str(),
base::Bind(&SettingsPrivateEventRouter::OnPreferenceChanged,
@@ -131,17 +131,17 @@
return;
}
- scoped_ptr<api::settings_private::PrefObject> pref_object =
+ std::unique_ptr<api::settings_private::PrefObject> pref_object =
prefs_util_->GetPref(pref_name);
std::vector<api::settings_private::PrefObject> prefs;
if (pref_object)
prefs.push_back(std::move(*pref_object));
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::settings_private::OnPrefsChanged::Create(prefs));
- scoped_ptr<Event> extension_event(new Event(
+ std::unique_ptr<Event> extension_event(new Event(
events::SETTINGS_PRIVATE_ON_PREFS_CHANGED,
api::settings_private::OnPrefsChanged::kEventName, std::move(args)));
event_router->BroadcastEvent(std::move(extension_event));
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_event_router.h b/chrome/browser/extensions/api/settings_private/settings_private_event_router.h
index 8c3031a..7738b97 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_event_router.h
+++ b/chrome/browser/extensions/api/settings_private/settings_private_event_router.h
@@ -65,7 +65,7 @@
content::BrowserContext* context_;
bool listening_;
- scoped_ptr<PrefsUtil> prefs_util_;
+ std::unique_ptr<PrefsUtil> prefs_util_;
DISALLOW_COPY_AND_ASSIGN(SettingsPrivateEventRouter);
};
diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc
index fec0546..726df26e 100644
--- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/memory/scoped_vector.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
@@ -84,7 +85,7 @@
}
}
-scoped_ptr<DeviceInfo> GetDeviceInfoForClientId(
+std::unique_ptr<DeviceInfo> GetDeviceInfoForClientId(
const std::string& client_id,
const std::string& extension_id,
Profile* profile) {
@@ -96,12 +97,12 @@
it != devices.end();
++it) {
if ((*it)->guid() == client_id) {
- scoped_ptr<DeviceInfo> device(*it);
+ std::unique_ptr<DeviceInfo> device(*it);
devices.weak_erase(it);
return device;
}
}
- return scoped_ptr<DeviceInfo>();
+ return std::unique_ptr<DeviceInfo>();
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h
index a126633..69a8dfa 100644
--- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h
+++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_SIGNED_IN_DEVICES_ID_MAPPING_HELPER_H__
#define CHROME_BROWSER_EXTENSIONS_API_SIGNED_IN_DEVICES_ID_MAPPING_HELPER_H__
+#include <memory>
#include <string>
#include <vector>
-#include "base/memory/scoped_ptr.h"
namespace base {
class DictionaryValue;
@@ -50,7 +50,7 @@
// Gets the device info for a given client id. If the device is not found
// the returned pointer would be null.
-scoped_ptr<sync_driver::DeviceInfo> GetDeviceInfoForClientId(
+std::unique_ptr<sync_driver::DeviceInfo> GetDeviceInfoForClientId(
const std::string& client_id,
const std::string& extension_id,
Profile* profile);
diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
index 7a4bb6f7..aa887edf 100644
--- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h"
+
+#include <memory>
#include <string>
#include "base/guid.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/values.h"
-#include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h"
#include "components/sync_driver/device_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
index 9de72ed..927b7d6 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/memory/scoped_vector.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h"
@@ -37,7 +38,8 @@
&out_value) || out_value == NULL) {
// Looks like this is the first call to get the dictionary. Let us create
// a dictionary and set it in to |extension_prefs|.
- scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dictionary(
+ new base::DictionaryValue());
out_value = dictionary.get();
extension_prefs->UpdateExtensionPref(
extension_id,
@@ -64,7 +66,7 @@
CHECK(mapping_dictionary);
// |mapping_dictionary| is const. So make an editable copy.
- scoped_ptr<base::DictionaryValue> editable_mapping_dictionary(
+ std::unique_ptr<base::DictionaryValue> editable_mapping_dictionary(
mapping_dictionary->DeepCopy());
CreateMappingForUnmappedDevices(&(devices.get()),
@@ -95,31 +97,30 @@
return GetAllSignedInDevices(extension_id, device_tracker, extension_prefs);
}
-scoped_ptr<DeviceInfo> GetLocalDeviceInfo(const std::string& extension_id,
- Profile* profile) {
+std::unique_ptr<DeviceInfo> GetLocalDeviceInfo(const std::string& extension_id,
+ Profile* profile) {
ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile);
if (!pss) {
- return scoped_ptr<DeviceInfo>();
+ return std::unique_ptr<DeviceInfo>();
}
LocalDeviceInfoProvider* local_device = pss->GetLocalDeviceInfoProvider();
DCHECK(local_device);
std::string guid = local_device->GetLocalSyncCacheGUID();
- scoped_ptr<DeviceInfo> device = GetDeviceInfoForClientId(guid,
- extension_id,
- profile);
+ std::unique_ptr<DeviceInfo> device =
+ GetDeviceInfoForClientId(guid, extension_id, profile);
return device;
}
bool SignedInDevicesGetFunction::RunSync() {
- scoped_ptr<api::signed_in_devices::Get::Params> params(
+ std::unique_ptr<api::signed_in_devices::Get::Params> params(
api::signed_in_devices::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool is_local = params->is_local.get() ? *params->is_local : false;
if (is_local) {
- scoped_ptr<DeviceInfo> device =
+ std::unique_ptr<DeviceInfo> device =
GetLocalDeviceInfo(extension_id(), GetProfile());
base::ListValue* result = new base::ListValue();
if (device.get()) {
@@ -132,7 +133,7 @@
ScopedVector<DeviceInfo> devices =
GetAllSignedInDevices(extension_id(), GetProfile());
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
for (ScopedVector<DeviceInfo>::const_iterator it = devices.begin();
it != devices.end();
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
index f0153a1..05e3d8f 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
@@ -2,15 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
+#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h"
+#include <memory>
+#include <string>
#include <vector>
#include "base/guid.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
-#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
#include "chrome/browser/extensions/test_extension_prefs.h"
#include "chrome/browser/profiles/profile.h"
@@ -37,10 +38,10 @@
bool IsSyncing() const override { return !devices_.empty(); }
- scoped_ptr<DeviceInfo> GetDeviceInfo(
+ std::unique_ptr<DeviceInfo> GetDeviceInfo(
const std::string& client_id) const override {
NOTREACHED();
- return scoped_ptr<DeviceInfo>();
+ return std::unique_ptr<DeviceInfo>();
}
static DeviceInfo* CloneDeviceInfo(const DeviceInfo* device_info) {
@@ -152,9 +153,9 @@
MOCK_CONST_METHOD0(GetDeviceInfoTracker, DeviceInfoTracker*());
};
-scoped_ptr<KeyedService> CreateProfileSyncServiceMock(
+std::unique_ptr<KeyedService> CreateProfileSyncServiceMock(
content::BrowserContext* context) {
- return make_scoped_ptr(new ProfileSyncServiceMockForExtensionTests(
+ return base::WrapUnique(new ProfileSyncServiceMockForExtensionTests(
Profile::FromBrowserContext(context)));
}
@@ -182,7 +183,7 @@
std::string public_id = GetPublicId(actual_value);
device_info->set_public_id(public_id);
- scoped_ptr<base::DictionaryValue> expected_value(device_info->ToValue());
+ std::unique_ptr<base::DictionaryValue> expected_value(device_info->ToValue());
EXPECT_TRUE(expected_value->Equals(actual_value));
}
@@ -224,8 +225,8 @@
EXPECT_CALL(*pss_mock, Shutdown());
- scoped_ptr<base::ListValue> result(RunFunctionAndReturnList(
- new SignedInDevicesGetFunction(), "[null]"));
+ std::unique_ptr<base::ListValue> result(
+ RunFunctionAndReturnList(new SignedInDevicesGetFunction(), "[null]"));
// Ensure dictionary matches device info.
VerifyDictionaryWithDeviceInfo(GetDictionaryFromList(0, result.get()),
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
index 786d1ec9..ecb7a82 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h"
@@ -72,9 +72,9 @@
args.push_back(std::move(api_device));
}
- scoped_ptr<base::ListValue> result =
+ std::unique_ptr<base::ListValue> result =
api::signed_in_devices::OnDeviceInfoChange::Create(args);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE,
api::signed_in_devices::OnDeviceInfoChange::kEventName,
std::move(result)));
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc
index 43f1634c..0ed8808 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h"
+
+#include <memory>
+
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/extensions/api/signed_in_devices.h"
@@ -22,7 +24,7 @@
// Adds a listener and removes it.
TEST(SignedInDevicesManager, UpdateListener) {
content::TestBrowserThreadBundle thread_bundle;
- scoped_ptr<TestingProfile> profile(new TestingProfile());
+ std::unique_ptr<TestingProfile> profile(new TestingProfile());
SigninManagerFactory::GetForProfile(profile.get())->
SetAuthenticatedAccountInfo("gaia_id", "foo");
ProfileSyncServiceFactory::GetInstance()->SetTestingFactory(profile.get(),
diff --git a/chrome/browser/extensions/api/socket/combined_socket_unittest.cc b/chrome/browser/extensions/api/socket/combined_socket_unittest.cc
index 22cdebb..72b37c34 100644
--- a/chrome/browser/extensions/api/socket/combined_socket_unittest.cc
+++ b/chrome/browser/extensions/api/socket/combined_socket_unittest.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/api/socket/mock_tcp_client_socket.h"
#include "extensions/browser/api/socket/socket.h"
#include "extensions/browser/api/socket/tcp_socket.h"
@@ -16,17 +18,20 @@
const int kBufferLength = 10;
template <typename T>
-scoped_ptr<T> CreateTestSocket(scoped_ptr<MockTCPClientSocket> stream);
+std::unique_ptr<T> CreateTestSocket(
+ std::unique_ptr<MockTCPClientSocket> stream);
template <>
-scoped_ptr<TCPSocket> CreateTestSocket(scoped_ptr<MockTCPClientSocket> stream) {
- return make_scoped_ptr(new TCPSocket(std::move(stream), "fake id",
- true /* is_connected */));
+std::unique_ptr<TCPSocket> CreateTestSocket(
+ std::unique_ptr<MockTCPClientSocket> stream) {
+ return base::WrapUnique(
+ new TCPSocket(std::move(stream), "fake id", true /* is_connected */));
}
template <>
-scoped_ptr<TLSSocket> CreateTestSocket(scoped_ptr<MockTCPClientSocket> stream) {
- return make_scoped_ptr(new TLSSocket(std::move(stream), "fake id"));
+std::unique_ptr<TLSSocket> CreateTestSocket(
+ std::unique_ptr<MockTCPClientSocket> stream) {
+ return base::WrapUnique(new TLSSocket(std::move(stream), "fake id"));
}
class CombinedSocketTest : public testing::Test {
@@ -38,14 +43,14 @@
void TestRead() {
net::IOBuffer* buffer = nullptr;
- scoped_ptr<MockTCPClientSocket> stream(
+ std::unique_ptr<MockTCPClientSocket> stream(
new testing::StrictMock<MockTCPClientSocket>());
EXPECT_CALL(*stream, Read(testing::NotNull(), kBufferLength, testing::_))
.WillOnce(DoAll(testing::SaveArg<0>(&buffer),
testing::Return(kBufferLength)));
EXPECT_CALL(*stream, Disconnect());
- scoped_ptr<T> socket = CreateTestSocket<T>(std::move(stream));
+ std::unique_ptr<T> socket = CreateTestSocket<T>(std::move(stream));
ReadCompletionCallback read_callback =
base::Bind(&CombinedSocketTest::OnRead, base::Unretained(this));
socket->Read(kBufferLength, read_callback);
@@ -60,7 +65,7 @@
net::IOBuffer* buffer = nullptr;
net::CompletionCallback socket_cb;
- scoped_ptr<MockTCPClientSocket> stream(
+ std::unique_ptr<MockTCPClientSocket> stream(
new testing::StrictMock<MockTCPClientSocket>());
EXPECT_CALL(*stream, Read(testing::NotNull(), kBufferLength, testing::_))
.WillOnce(DoAll(testing::SaveArg<0>(&buffer),
@@ -68,7 +73,7 @@
testing::Return(net::ERR_IO_PENDING)));
EXPECT_CALL(*stream, Disconnect());
- scoped_ptr<T> socket = CreateTestSocket<T>(std::move(stream));
+ std::unique_ptr<T> socket = CreateTestSocket<T>(std::move(stream));
ReadCompletionCallback read_callback =
base::Bind(&CombinedSocketTest::OnRead, base::Unretained(this));
socket->Read(kBufferLength, read_callback);
@@ -85,7 +90,7 @@
void TestReadAfterDisconnect() {
net::IOBuffer* buffer = nullptr;
- scoped_ptr<MockTCPClientSocket> stream(
+ std::unique_ptr<MockTCPClientSocket> stream(
new testing::NiceMock<MockTCPClientSocket>());
EXPECT_CALL(*stream, Read(testing::NotNull(), kBufferLength, testing::_))
.WillOnce(DoAll(testing::SaveArg<0>(&buffer),
@@ -93,7 +98,7 @@
ON_CALL(*stream, IsConnected()).WillByDefault(testing::Return(false));
EXPECT_CALL(*stream, Disconnect());
- scoped_ptr<T> socket = CreateTestSocket<T>(std::move(stream));
+ std::unique_ptr<T> socket = CreateTestSocket<T>(std::move(stream));
ReadCompletionCallback read_callback =
base::Bind(&CombinedSocketTest::OnRead, base::Unretained(this));
socket->Read(kBufferLength, read_callback);
diff --git a/chrome/browser/extensions/api/socket/socket_api_unittest.cc b/chrome/browser/extensions/api/socket/socket_api_unittest.cc
index d493dd97..1fd256eb 100644
--- a/chrome/browser/extensions/api/socket/socket_api_unittest.cc
+++ b/chrome/browser/extensions/api/socket/socket_api_unittest.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
@@ -17,9 +19,9 @@
namespace extensions {
-scoped_ptr<KeyedService> ApiResourceManagerTestFactory(
+std::unique_ptr<KeyedService> ApiResourceManagerTestFactory(
content::BrowserContext* context) {
- return make_scoped_ptr(new ApiResourceManager<Socket>(context));
+ return base::WrapUnique(new ApiResourceManager<Socket>(context));
}
class SocketUnitTest : public ExtensionApiUnittest {
@@ -42,7 +44,7 @@
function->set_work_thread_id(id);
// Run tests
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
RunFunctionAndReturnDictionary(function, "[\"tcp\"]"));
ASSERT_TRUE(result.get());
}
diff --git a/chrome/browser/extensions/api/socket/socket_apitest.cc b/chrome/browser/extensions/api/socket/socket_apitest.cc
index eb528073..cb2ae76 100644
--- a/chrome/browser/extensions/api/socket/socket_apitest.cc
+++ b/chrome/browser/extensions/api/socket/socket_apitest.cc
@@ -55,7 +55,7 @@
} // namespace
IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPExtension) {
- scoped_ptr<net::SpawnedTestServer> test_server(
+ std::unique_ptr<net::SpawnedTestServer> test_server(
new net::SpawnedTestServer(
net::SpawnedTestServer::TYPE_UDP_ECHO,
net::SpawnedTestServer::kLocalhost,
@@ -83,7 +83,7 @@
}
IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPExtension) {
- scoped_ptr<net::SpawnedTestServer> test_server(
+ std::unique_ptr<net::SpawnedTestServer> test_server(
new net::SpawnedTestServer(
net::SpawnedTestServer::TYPE_TCP_ECHO,
net::SpawnedTestServer::kLocalhost,
diff --git a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
index 9f1ac9e..f844dc0 100644
--- a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
+++ b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/api/socket/tcp_socket.h"
+#include <memory>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "extensions/browser/api/socket/tcp_socket.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
@@ -46,8 +46,9 @@
public:
MockTCPServerSocket() : net::TCPServerSocket(NULL, net::NetLog::Source()) {}
MOCK_METHOD2(Listen, int(const net::IPEndPoint& address, int backlog));
- MOCK_METHOD2(Accept, int(scoped_ptr<net::StreamSocket>* socket,
- const net::CompletionCallback& callback));
+ MOCK_METHOD2(Accept,
+ int(std::unique_ptr<net::StreamSocket>* socket,
+ const net::CompletionCallback& callback));
private:
DISALLOW_COPY_AND_ASSIGN(MockTCPServerSocket);
@@ -62,7 +63,7 @@
// MOCK_METHOD cannot mock a scoped_ptr argument.
MOCK_METHOD2(OnAcceptMock, void(int, net::TCPClientSocket*));
- void OnAccept(int count, scoped_ptr<net::TCPClientSocket> socket) {
+ void OnAccept(int count, std::unique_ptr<net::TCPClientSocket> socket) {
OnAcceptMock(count, socket.get());
}
@@ -74,7 +75,8 @@
TEST(SocketTest, TestTCPSocketRead) {
net::AddressList address_list;
- scoped_ptr<MockTCPSocket> tcp_client_socket(new MockTCPSocket(address_list));
+ std::unique_ptr<MockTCPSocket> tcp_client_socket(
+ new MockTCPSocket(address_list));
CompleteHandler handler;
EXPECT_CALL(*tcp_client_socket, Read(_, _, _))
@@ -82,7 +84,7 @@
EXPECT_CALL(handler, OnReadComplete(_, _))
.Times(1);
- scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
+ std::unique_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
std::move(tcp_client_socket), FAKE_ID, true));
const int count = 512;
@@ -92,7 +94,8 @@
TEST(SocketTest, TestTCPSocketWrite) {
net::AddressList address_list;
- scoped_ptr<MockTCPSocket> tcp_client_socket(new MockTCPSocket(address_list));
+ std::unique_ptr<MockTCPSocket> tcp_client_socket(
+ new MockTCPSocket(address_list));
CompleteHandler handler;
net::CompletionCallback callback;
@@ -103,7 +106,7 @@
EXPECT_CALL(handler, OnComplete(_))
.Times(1);
- scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
+ std::unique_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
std::move(tcp_client_socket), FAKE_ID, true));
scoped_refptr<net::IOBufferWithSize> io_buffer(
@@ -114,7 +117,8 @@
TEST(SocketTest, TestTCPSocketBlockedWrite) {
net::AddressList address_list;
- scoped_ptr<MockTCPSocket> tcp_client_socket(new MockTCPSocket(address_list));
+ std::unique_ptr<MockTCPSocket> tcp_client_socket(
+ new MockTCPSocket(address_list));
CompleteHandler handler;
net::CompletionCallback callback;
@@ -123,7 +127,7 @@
.WillRepeatedly(testing::DoAll(SaveArg<2>(&callback),
Return(net::ERR_IO_PENDING)));
- scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
+ std::unique_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
std::move(tcp_client_socket), FAKE_ID, true));
scoped_refptr<net::IOBufferWithSize> io_buffer(new net::IOBufferWithSize(42));
@@ -140,7 +144,8 @@
TEST(SocketTest, TestTCPSocketBlockedWriteReentry) {
net::AddressList address_list;
- scoped_ptr<MockTCPSocket> tcp_client_socket(new MockTCPSocket(address_list));
+ std::unique_ptr<MockTCPSocket> tcp_client_socket(
+ new MockTCPSocket(address_list));
CompleteHandler handlers[5];
net::CompletionCallback callback;
@@ -149,7 +154,7 @@
.WillRepeatedly(testing::DoAll(SaveArg<2>(&callback),
Return(net::ERR_IO_PENDING)));
- scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
+ std::unique_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
std::move(tcp_client_socket), FAKE_ID, true));
scoped_refptr<net::IOBufferWithSize> io_buffers[5];
@@ -173,7 +178,8 @@
TEST(SocketTest, TestTCPSocketSetNoDelay) {
net::AddressList address_list;
- scoped_ptr<MockTCPSocket> tcp_client_socket(new MockTCPSocket(address_list));
+ std::unique_ptr<MockTCPSocket> tcp_client_socket(
+ new MockTCPSocket(address_list));
bool no_delay = false;
{
@@ -184,7 +190,7 @@
.WillOnce(testing::DoAll(SaveArg<0>(&no_delay), Return(false)));
}
- scoped_ptr<TCPSocket> socket(
+ std::unique_ptr<TCPSocket> socket(
TCPSocket::CreateSocketForTesting(std::move(tcp_client_socket), FAKE_ID));
EXPECT_FALSE(no_delay);
@@ -199,7 +205,8 @@
TEST(SocketTest, TestTCPSocketSetKeepAlive) {
net::AddressList address_list;
- scoped_ptr<MockTCPSocket> tcp_client_socket(new MockTCPSocket(address_list));
+ std::unique_ptr<MockTCPSocket> tcp_client_socket(
+ new MockTCPSocket(address_list));
bool enable = false;
int delay = 0;
@@ -213,7 +220,7 @@
Return(false)));
}
- scoped_ptr<TCPSocket> socket(
+ std::unique_ptr<TCPSocket> socket(
TCPSocket::CreateSocketForTesting(std::move(tcp_client_socket), FAKE_ID));
EXPECT_FALSE(enable);
@@ -229,13 +236,14 @@
}
TEST(SocketTest, TestTCPServerSocketListenAccept) {
- scoped_ptr<MockTCPServerSocket> tcp_server_socket(new MockTCPServerSocket());
+ std::unique_ptr<MockTCPServerSocket> tcp_server_socket(
+ new MockTCPServerSocket());
CompleteHandler handler;
EXPECT_CALL(*tcp_server_socket, Accept(_, _)).Times(1);
EXPECT_CALL(*tcp_server_socket, Listen(_, _)).Times(1);
- scoped_ptr<TCPSocket> socket(TCPSocket::CreateServerSocketForTesting(
+ std::unique_ptr<TCPSocket> socket(TCPSocket::CreateServerSocketForTesting(
std::move(tcp_server_socket), FAKE_ID));
EXPECT_CALL(handler, OnAcceptMock(_, _));
diff --git a/chrome/browser/extensions/api/socket/tls_socket_unittest.cc b/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
index b360dcf6..dd172da2 100644
--- a/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
+++ b/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/api/socket/tls_socket.h"
-
#include <stddef.h>
#include <stdint.h>
#include <deque>
+#include <memory>
#include <utility>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
+#include "extensions/browser/api/socket/tls_socket.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
@@ -125,7 +124,7 @@
net::AddressList address_list;
// |ssl_socket_| is owned by |socket_|. TLSSocketTest keeps a pointer to
// it to expect invocations from TLSSocket to |ssl_socket_|.
- scoped_ptr<MockSSLClientSocket> ssl_sock(new MockSSLClientSocket);
+ std::unique_ptr<MockSSLClientSocket> ssl_sock(new MockSSLClientSocket);
ssl_socket_ = ssl_sock.get();
socket_.reset(new TLSSocket(std::move(ssl_sock), "test_extension_id"));
EXPECT_CALL(*ssl_socket_, Disconnect()).Times(1);
@@ -138,7 +137,7 @@
protected:
MockSSLClientSocket* ssl_socket_;
- scoped_ptr<TLSSocket> socket_;
+ std::unique_ptr<TLSSocket> socket_;
};
// Verify that a Read() on TLSSocket will pass through into a Read() on
diff --git a/chrome/browser/extensions/api/socket/udp_socket_unittest.cc b/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
index 50bd78a7..77d52e9 100644
--- a/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
+++ b/chrome/browser/extensions/api/socket/udp_socket_unittest.cc
@@ -2,20 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/api/socket/udp_socket.h"
-
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/location.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/test/test_timeouts.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/test/base/browser_with_test_window_test.h"
+#include "extensions/browser/api/socket/udp_socket.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api_unittest.cc b/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api_unittest.cc
index 15b26bb..38add75 100644
--- a/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api_unittest.cc
+++ b/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api_unittest.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/extensions/extension_api_unittest.h"
@@ -19,14 +21,14 @@
namespace extensions {
namespace api {
-static scoped_ptr<KeyedService> ApiResourceManagerTestFactory(
+static std::unique_ptr<KeyedService> ApiResourceManagerTestFactory(
content::BrowserContext* context) {
- return make_scoped_ptr(new ApiResourceManager<ResumableTCPSocket>(context));
+ return base::WrapUnique(new ApiResourceManager<ResumableTCPSocket>(context));
}
-static scoped_ptr<KeyedService> ApiResourceManagerTestServerFactory(
+static std::unique_ptr<KeyedService> ApiResourceManagerTestServerFactory(
content::BrowserContext* context) {
- return make_scoped_ptr(
+ return base::WrapUnique(
new ApiResourceManager<ResumableTCPServerSocket>(context));
}
@@ -56,7 +58,7 @@
function->set_work_thread_id(id);
// Run tests
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
+ std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
function, "[{\"persistent\": true, \"name\": \"foo\"}]"));
ASSERT_TRUE(result.get());
}
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index 78c46436..4d1117b1 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -91,14 +91,15 @@
void OnExtensionsReady();
// Starts a schema load for all extensions that use managed storage.
- void LoadSchemas(scoped_ptr<ExtensionSet> added);
+ void LoadSchemas(std::unique_ptr<ExtensionSet> added);
bool UsesManagedStorage(const Extension* extension) const;
// Loads the schemas of the |extensions| and passes a ComponentMap to
// Register().
- static void LoadSchemasOnBlockingPool(scoped_ptr<ExtensionSet> extensions,
- base::WeakPtr<ExtensionTracker> self);
+ static void LoadSchemasOnBlockingPool(
+ std::unique_ptr<ExtensionSet> extensions,
+ base::WeakPtr<ExtensionTracker> self);
void Register(const policy::ComponentMap* components);
Profile* profile_;
@@ -135,7 +136,7 @@
// most once.
if (!ExtensionSystem::Get(profile_)->ready().is_signaled())
return;
- scoped_ptr<ExtensionSet> added(new ExtensionSet);
+ std::unique_ptr<ExtensionSet> added(new ExtensionSet);
added->Insert(extension);
LoadSchemas(std::move(added));
}
@@ -159,7 +160,7 @@
}
void ManagedValueStoreCache::ExtensionTracker::LoadSchemas(
- scoped_ptr<ExtensionSet> added) {
+ std::unique_ptr<ExtensionSet> added) {
// Filter out extensions that don't use managed storage.
ExtensionSet::const_iterator it = added->begin();
while (it != added->end()) {
@@ -190,10 +191,10 @@
// static
void ManagedValueStoreCache::ExtensionTracker::LoadSchemasOnBlockingPool(
- scoped_ptr<ExtensionSet> extensions,
+ std::unique_ptr<ExtensionSet> extensions,
base::WeakPtr<ExtensionTracker> self) {
DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
- scoped_ptr<policy::ComponentMap> components(new policy::ComponentMap);
+ std::unique_ptr<policy::ComponentMap> components(new policy::ComponentMap);
for (ExtensionSet::const_iterator it = extensions->begin();
it != extensions->end(); ++it) {
@@ -339,7 +340,7 @@
void ManagedValueStoreCache::UpdatePolicyOnFILE(
const std::string& extension_id,
- scoped_ptr<policy::PolicyMap> current_policy) {
+ std::unique_ptr<policy::PolicyMap> current_policy) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (!HasStore(extension_id) && current_policy->empty()) {
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.h b/chrome/browser/extensions/api/storage/managed_value_store_cache.h
index b76793e8..f0d5beff 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.h
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_
#include <map>
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
@@ -13,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "components/policy/core/common/policy_service.h"
#include "extensions/browser/api/storage/settings_observer.h"
#include "extensions/browser/api/storage/value_store_cache.h"
@@ -71,7 +71,7 @@
// Posted by OnPolicyUpdated() to update a PolicyValueStore on the FILE
// thread.
void UpdatePolicyOnFILE(const std::string& extension_id,
- scoped_ptr<policy::PolicyMap> current_policy);
+ std::unique_ptr<policy::PolicyMap> current_policy);
// Returns an existing PolicyValueStore for |extension_id|, or NULL.
PolicyValueStore* GetStoreFor(const std::string& extension_id);
@@ -88,7 +88,7 @@
// Observes extension loading and unloading, and keeps the Profile's
// PolicyService aware of the current list of extensions.
- scoped_ptr<ExtensionTracker> extension_tracker_;
+ std::unique_ptr<ExtensionTracker> extension_tracker_;
// These live on the FILE thread.
scoped_refptr<ValueStoreFactory> storage_factory_;
diff --git a/chrome/browser/extensions/api/storage/policy_value_store.cc b/chrome/browser/extensions/api/storage/policy_value_store.cc
index 66708b3d..5fd0826 100644
--- a/chrome/browser/extensions/api/storage/policy_value_store.cc
+++ b/chrome/browser/extensions/api/storage/policy_value_store.cc
@@ -30,7 +30,7 @@
PolicyValueStore::PolicyValueStore(
const std::string& extension_id,
const scoped_refptr<SettingsObserverList>& observers,
- scoped_ptr<ValueStore> delegate)
+ std::unique_ptr<ValueStore> delegate)
: extension_id_(extension_id),
observers_(observers),
delegate_(std::move(delegate)) {}
diff --git a/chrome/browser/extensions/api/storage/policy_value_store.h b/chrome/browser/extensions/api/storage/policy_value_store.h
index 0ffc702..69e22a47 100644
--- a/chrome/browser/extensions/api/storage/policy_value_store.h
+++ b/chrome/browser/extensions/api/storage/policy_value_store.h
@@ -7,13 +7,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/storage/settings_observer.h"
#include "extensions/browser/value_store/value_store.h"
@@ -32,7 +32,7 @@
public:
PolicyValueStore(const std::string& extension_id,
const scoped_refptr<SettingsObserverList>& observers,
- scoped_ptr<ValueStore> delegate);
+ std::unique_ptr<ValueStore> delegate);
~PolicyValueStore() override;
// Stores |policy| in the persistent database represented by the |delegate_|
@@ -64,7 +64,7 @@
private:
std::string extension_id_;
scoped_refptr<SettingsObserverList> observers_;
- scoped_ptr<ValueStore> delegate_;
+ std::unique_ptr<ValueStore> delegate_;
DISALLOW_COPY_AND_ASSIGN(PolicyValueStore);
};
diff --git a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
index 5ea5af6..c740358 100644
--- a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
+++ b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
@@ -4,12 +4,14 @@
#include "chrome/browser/extensions/api/storage/policy_value_store.h"
+#include <memory>
+
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_map.h"
@@ -48,7 +50,7 @@
: PolicyValueStore(
kTestExtensionId,
make_scoped_refptr(new SettingsObserverList()),
- make_scoped_ptr(
+ base::WrapUnique(
new LeveldbValueStore(kDatabaseUMAClientName, path))) {}
~MutablePolicyValueStore() override {}
@@ -100,8 +102,8 @@
observers_->AddObserver(&observer_);
store_.reset(new PolicyValueStore(
kTestExtensionId, observers_,
- make_scoped_ptr(new LeveldbValueStore(kDatabaseUMAClientName,
- scoped_temp_dir_.path()))));
+ base::WrapUnique(new LeveldbValueStore(kDatabaseUMAClientName,
+ scoped_temp_dir_.path()))));
}
void TearDown() override {
@@ -113,7 +115,7 @@
base::ScopedTempDir scoped_temp_dir_;
base::MessageLoop loop_;
content::TestBrowserThread file_thread_;
- scoped_ptr<PolicyValueStore> store_;
+ std::unique_ptr<PolicyValueStore> store_;
MockSettingsObserver observer_;
scoped_refptr<SettingsObserverList> observers_;
};
diff --git a/chrome/browser/extensions/api/storage/setting_sync_data.cc b/chrome/browser/extensions/api/storage/setting_sync_data.cc
index 2147294..1ca5ded 100644
--- a/chrome/browser/extensions/api/storage/setting_sync_data.cc
+++ b/chrome/browser/extensions/api/storage/setting_sync_data.cc
@@ -28,7 +28,7 @@
SettingSyncData::SettingSyncData(syncer::SyncChange::SyncChangeType change_type,
const std::string& extension_id,
const std::string& key,
- scoped_ptr<base::Value> value)
+ std::unique_ptr<base::Value> value)
: change_type_(change_type),
extension_id_(extension_id),
key_(key),
@@ -36,7 +36,7 @@
SettingSyncData::~SettingSyncData() {}
-scoped_ptr<base::Value> SettingSyncData::PassValue() {
+std::unique_ptr<base::Value> SettingSyncData::PassValue() {
DCHECK(value_) << "value has already been Pass()ed";
return std::move(value_);
}
diff --git a/chrome/browser/extensions/api/storage/setting_sync_data.h b/chrome/browser/extensions/api/storage/setting_sync_data.h
index 181e3e7..ee92291 100644
--- a/chrome/browser/extensions/api/storage/setting_sync_data.h
+++ b/chrome/browser/extensions/api/storage/setting_sync_data.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_
#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/values.h"
#include "sync/api/sync_change.h"
@@ -34,11 +34,10 @@
explicit SettingSyncData(const syncer::SyncData& sync_data);
// Creates explicitly.
- SettingSyncData(
- syncer::SyncChange::SyncChangeType change_type,
- const std::string& extension_id,
- const std::string& key,
- scoped_ptr<base::Value> value);
+ SettingSyncData(syncer::SyncChange::SyncChangeType change_type,
+ const std::string& extension_id,
+ const std::string& key,
+ std::unique_ptr<base::Value> value);
~SettingSyncData();
@@ -54,7 +53,7 @@
// Releases ownership of the value to the caller. Neither value() nor
// PassValue() can be after this.
- scoped_ptr<base::Value> PassValue();
+ std::unique_ptr<base::Value> PassValue();
private:
// Populates the extension ID, key, and value from |sync_data|. This will be
@@ -64,7 +63,7 @@
syncer::SyncChange::SyncChangeType change_type_;
std::string extension_id_;
std::string key_;
- scoped_ptr<base::Value> value_;
+ std::unique_ptr<base::Value> value_;
DISALLOW_COPY_AND_ASSIGN(SettingSyncData);
};
diff --git a/chrome/browser/extensions/api/storage/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc
index d0fb0f1..1bc1773 100644
--- a/chrome/browser/extensions/api/storage/settings_apitest.cc
+++ b/chrome/browser/extensions/api/storage/settings_apitest.cc
@@ -128,7 +128,7 @@
}
void SetPolicies(const base::DictionaryValue& policies) {
- scoped_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle());
+ std::unique_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle());
policy::PolicyMap& policy_map = bundle->Get(policy::PolicyNamespace(
policy::POLICY_DOMAIN_EXTENSIONS, kManagedStorageExtensionId));
policy_map.LoadFrom(&policies, policy::POLICY_LEVEL_MANDATORY,
@@ -182,17 +182,16 @@
void InitSyncWithSyncableService(
syncer::SyncChangeProcessor* sync_processor,
syncer::SyncableService* settings_service) {
- EXPECT_FALSE(
- settings_service->MergeDataAndStartSyncing(
- kModelType,
- syncer::SyncDataList(),
- scoped_ptr<syncer::SyncChangeProcessor>(
- new syncer::SyncChangeProcessorWrapperForTest(
- sync_processor)),
- scoped_ptr<syncer::SyncErrorFactory>(
- new syncer::SyncErrorFactoryMock()))
- .error()
- .IsSet());
+ EXPECT_FALSE(settings_service
+ ->MergeDataAndStartSyncing(
+ kModelType, syncer::SyncDataList(),
+ std::unique_ptr<syncer::SyncChangeProcessor>(
+ new syncer::SyncChangeProcessorWrapperForTest(
+ sync_processor)),
+ std::unique_ptr<syncer::SyncErrorFactory>(
+ new syncer::SyncErrorFactoryMock()))
+ .error()
+ .IsSet());
}
void SendChangesToSyncableService(
@@ -478,7 +477,7 @@
IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorage) {
// Set policies for the test extension.
- scoped_ptr<base::DictionaryValue> policy =
+ std::unique_ptr<base::DictionaryValue> policy =
extensions::DictionaryBuilder()
.Set("string-policy", "value")
.Set("int-policy", -123)
@@ -516,11 +515,12 @@
message_.clear();
// Set policies for the test extension.
- scoped_ptr<base::DictionaryValue> policy = extensions::DictionaryBuilder()
- .Set("constant-policy", "aaa")
- .Set("changes-policy", "bbb")
- .Set("deleted-policy", "ccc")
- .Build();
+ std::unique_ptr<base::DictionaryValue> policy =
+ extensions::DictionaryBuilder()
+ .Set("constant-policy", "aaa")
+ .Set("changes-policy", "bbb")
+ .Set("deleted-policy", "ccc")
+ .Build();
SetPolicies(*policy);
ExtensionTestMessageListener ready_listener("ready", false);
diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
index cf55beb7..44fdc149 100644
--- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
+++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -10,7 +12,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
@@ -166,13 +168,14 @@
bool fail_all_requests_;
};
-scoped_ptr<KeyedService> MockExtensionSystemFactoryFunction(
+std::unique_ptr<KeyedService> MockExtensionSystemFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(new MockExtensionSystem(context));
+ return base::WrapUnique(new MockExtensionSystem(context));
}
-scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* profile) {
- return make_scoped_ptr(new extensions::EventRouter(profile, nullptr));
+std::unique_ptr<KeyedService> BuildEventRouter(
+ content::BrowserContext* profile) {
+ return base::WrapUnique(new extensions::EventRouter(profile, nullptr));
}
} // namespace
@@ -259,11 +262,12 @@
content::TestBrowserThread file_thread_;
base::ScopedTempDir temp_dir_;
- scoped_ptr<TestingProfile> profile_;
- scoped_ptr<StorageFrontend> frontend_;
+ std::unique_ptr<TestingProfile> profile_;
+ std::unique_ptr<StorageFrontend> frontend_;
scoped_refptr<TestValueStoreFactory> storage_factory_;
- scoped_ptr<MockSyncChangeProcessor> sync_processor_;
- scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> sync_processor_wrapper_;
+ std::unique_ptr<MockSyncChangeProcessor> sync_processor_;
+ std::unique_ptr<syncer::SyncChangeProcessorWrapperForTest>
+ sync_processor_wrapper_;
};
// Get a semblance of coverage for both EXTENSION_SETTINGS and APP_SETTINGS
@@ -283,7 +287,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
AddExtensionAndGetStorage("s2", type);
EXPECT_EQ(0u, GetAllSyncData(model_type).size());
@@ -324,7 +328,7 @@
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Already in sync, so no changes.
EXPECT_EQ(0u, sync_processor_->changes().size());
@@ -361,7 +365,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// All settings should have been pushed to sync.
EXPECT_EQ(2u, sync_processor_->changes().size());
@@ -399,7 +403,7 @@
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
expected1.Set("foo", value1.DeepCopy());
expected2.Set("bar", value2.DeepCopy());
@@ -441,7 +445,7 @@
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
expected2.Set("bar", value2.DeepCopy());
// Make sync add some settings.
@@ -515,7 +519,7 @@
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Add something locally.
storage1->Set(DEFAULTS, "bar", value2);
@@ -653,7 +657,7 @@
->MergeDataAndStartSyncing(
syncer::EXTENSION_SETTINGS, sync_data,
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
GetSyncableService(syncer::EXTENSION_SETTINGS)->
StopSyncing(syncer::EXTENSION_SETTINGS);
EXPECT_EQ(0u, sync_processor_->changes().size());
@@ -662,12 +666,13 @@
sync_data.push_back(settings_sync_util::CreateData(
"s2", "bar", value2, syncer::APP_SETTINGS));
- scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> app_settings_delegate_(
- new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
+ std::unique_ptr<syncer::SyncChangeProcessorWrapperForTest>
+ app_settings_delegate_(
+ new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
GetSyncableService(syncer::APP_SETTINGS)
->MergeDataAndStartSyncing(
syncer::APP_SETTINGS, sync_data, std::move(app_settings_delegate_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
GetSyncableService(syncer::APP_SETTINGS)->
StopSyncing(syncer::APP_SETTINGS);
EXPECT_EQ(0u, sync_processor_->changes().size());
@@ -698,7 +703,7 @@
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
}
GetExisting("bad")->set_status_code(ValueStore::OK);
@@ -814,7 +819,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Local settings will have been pushed to sync, since it's empty (in this
// test; presumably it wouldn't be live, since we've been getting changes).
@@ -882,7 +887,7 @@
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
}
EXPECT_EQ(0u, sync_processor_->changes().size());
@@ -983,7 +988,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
sync_processor_->GetOnlyChange("good", "foo")->change_type());
@@ -1022,7 +1027,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
GetExisting("bad")->set_status_code(ValueStore::OK);
EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
@@ -1072,7 +1077,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
sync_processor_->GetOnlyChange("good", "foo")->change_type());
@@ -1113,7 +1118,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
sync_processor_->set_fail_all_requests(false);
// Changes from good will be send to sync, changes from bad won't.
@@ -1156,7 +1161,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
sync_processor_->GetOnlyChange("good", "foo")->change_type());
@@ -1191,7 +1196,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// bad will fail to send changes.
good->Set(DEFAULTS, "foo", fooValue);
@@ -1243,7 +1248,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
sync_processor_->GetOnlyChange("good", "foo")->change_type());
@@ -1280,7 +1285,7 @@
->MergeDataAndStartSyncing(
model_type, syncer::SyncDataList(),
std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Large local change rejected and doesn't get sent out.
ValueStore* storage1 = AddExtensionAndGetStorage("s1", type);
@@ -1316,14 +1321,14 @@
{
syncer::SyncDataList sync_data_list;
- scoped_ptr<base::Value> string_value(new base::StringValue("value"));
+ std::unique_ptr<base::Value> string_value(new base::StringValue("value"));
sync_data_list.push_back(settings_sync_util::CreateData(
"ext", "key.with.dot", *string_value, model_type));
GetSyncableService(model_type)
->MergeDataAndStartSyncing(
model_type, sync_data_list, std::move(sync_processor_wrapper_),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
}
// Test dots in keys that come from sync.
@@ -1340,7 +1345,7 @@
// Test dots in keys going to sync.
{
- scoped_ptr<base::Value> string_value(new base::StringValue("spot"));
+ std::unique_ptr<base::Value> string_value(new base::StringValue("spot"));
storage->Set(DEFAULTS, "key.with.spot", *string_value);
ASSERT_EQ(1u, sync_processor_->changes().size());
@@ -1363,7 +1368,7 @@
static void UnlimitedSyncStorageTestCallback(ValueStore* sync_storage) {
// Sync storage should still run out after ~100K; the unlimitedStorage
// permission can't apply to sync.
- scoped_ptr<base::Value> kilobyte = util::CreateKilobyte();
+ std::unique_ptr<base::Value> kilobyte = util::CreateKilobyte();
for (int i = 0; i < 100; ++i) {
sync_storage->Set(ValueStore::DEFAULTS, base::IntToString(i), *kilobyte);
}
@@ -1374,7 +1379,7 @@
static void UnlimitedLocalStorageTestCallback(ValueStore* local_storage) {
// Local storage should never run out.
- scoped_ptr<base::Value> megabyte = util::CreateMegabyte();
+ std::unique_ptr<base::Value> megabyte = util::CreateMegabyte();
for (int i = 0; i < 7; ++i) {
local_storage->Set(ValueStore::DEFAULTS, base::IntToString(i), *megabyte);
}
diff --git a/chrome/browser/extensions/api/storage/sync_storage_backend.cc b/chrome/browser/extensions/api/storage/sync_storage_backend.cc
index ea17e60c..ad544162 100644
--- a/chrome/browser/extensions/api/storage/sync_storage_backend.cc
+++ b/chrome/browser/extensions/api/storage/sync_storage_backend.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/api/storage/settings_sync_processor.h"
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
@@ -29,8 +30,8 @@
}
}
-scoped_ptr<base::DictionaryValue> EmptyDictionaryValue() {
- return make_scoped_ptr(new base::DictionaryValue());
+std::unique_ptr<base::DictionaryValue> EmptyDictionaryValue() {
+ return base::WrapUnique(new base::DictionaryValue());
}
ValueStoreFactory::ModelType ToFactoryModelType(syncer::ModelType sync_type) {
@@ -72,7 +73,7 @@
SyncableSettingsStorage* SyncStorageBackend::GetOrCreateStorageWithSyncData(
const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> sync_data) const {
+ std::unique_ptr<base::DictionaryValue> sync_data) const {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
StorageObjMap::iterator maybe_storage = storage_objs_.find(extension_id);
@@ -80,7 +81,7 @@
return maybe_storage->second.get();
}
- scoped_ptr<SettingsStorageQuotaEnforcer> storage(
+ std::unique_ptr<SettingsStorageQuotaEnforcer> storage(
new SettingsStorageQuotaEnforcer(
quota_, storage_factory_->CreateSettingsStore(
settings_namespace::SYNC, ToFactoryModelType(sync_type_),
@@ -166,8 +167,8 @@
syncer::SyncMergeResult SyncStorageBackend::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
- scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) {
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
+ std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK_EQ(sync_type_, type);
DCHECK(!sync_processor_.get());
@@ -203,7 +204,7 @@
auto group = grouped_sync_data.find(extension_id);
syncer::SyncError error;
if (group != grouped_sync_data.end()) {
- error = storage->StartSyncing(make_scoped_ptr(group->second),
+ error = storage->StartSyncing(base::WrapUnique(group->second),
CreateSettingsSyncProcessor(extension_id));
grouped_sync_data.erase(group);
} else {
@@ -219,7 +220,7 @@
// Under normal circumstances (i.e. not first-time sync) this will be all of
// them.
for (const auto& group : grouped_sync_data) {
- GetOrCreateStorageWithSyncData(group.first, make_scoped_ptr(group.second));
+ GetOrCreateStorageWithSyncData(group.first, base::WrapUnique(group.second));
}
return syncer::SyncMergeResult(type);
@@ -237,7 +238,7 @@
std::map<std::string, SettingSyncDataList*> grouped_sync_data;
for (const syncer::SyncChange& change : sync_changes) {
- scoped_ptr<SettingSyncData> data(new SettingSyncData(change));
+ std::unique_ptr<SettingSyncData> data(new SettingSyncData(change));
SettingSyncDataList*& group = grouped_sync_data[data->extension_id()];
if (!group)
group = new SettingSyncDataList();
@@ -249,7 +250,7 @@
SyncableSettingsStorage* storage =
GetOrCreateStorageWithSyncData(group.first, EmptyDictionaryValue());
syncer::SyncError error =
- storage->ProcessSyncChanges(make_scoped_ptr(group.second));
+ storage->ProcessSyncChanges(base::WrapUnique(group.second));
if (error.IsSet())
storage->StopSyncing();
}
@@ -272,11 +273,11 @@
sync_error_factory_.reset();
}
-scoped_ptr<SettingsSyncProcessor>
-SyncStorageBackend::CreateSettingsSyncProcessor(const std::string& extension_id)
- const {
+std::unique_ptr<SettingsSyncProcessor>
+SyncStorageBackend::CreateSettingsSyncProcessor(
+ const std::string& extension_id) const {
CHECK(sync_processor_.get());
- return scoped_ptr<SettingsSyncProcessor>(new SettingsSyncProcessor(
+ return std::unique_ptr<SettingsSyncProcessor>(new SettingsSyncProcessor(
extension_id, sync_type_, sync_processor_.get()));
}
diff --git a/chrome/browser/extensions/api/storage/sync_storage_backend.h b/chrome/browser/extensions/api/storage/sync_storage_backend.h
index fe95c81f..a0f5ddb 100644
--- a/chrome/browser/extensions/api/storage/sync_storage_backend.h
+++ b/chrome/browser/extensions/api/storage/sync_storage_backend.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
@@ -14,7 +15,6 @@
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/storage/settings_observer.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/value_store/value_store_factory.h"
@@ -53,8 +53,8 @@
syncer::SyncMergeResult MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
- scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) override;
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
+ std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) override;
syncer::SyncError ProcessSyncChanges(
const tracked_objects::Location& from_here,
const syncer::SyncChangeList& change_list) override;
@@ -65,7 +65,7 @@
// initializing sync with some initial data if sync enabled.
SyncableSettingsStorage* GetOrCreateStorageWithSyncData(
const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> sync_data) const;
+ std::unique_ptr<base::DictionaryValue> sync_data) const;
// Gets all extension IDs known to extension settings. This may not be all
// installed extensions.
@@ -73,7 +73,7 @@
ValueStoreFactory::ModelType model_type) const;
// Creates a new SettingsSyncProcessor for an extension.
- scoped_ptr<SettingsSyncProcessor> CreateSettingsSyncProcessor(
+ std::unique_ptr<SettingsSyncProcessor> CreateSettingsSyncProcessor(
const std::string& extension_id) const;
// The Factory to use for creating new ValueStores.
@@ -95,10 +95,10 @@
syncer::ModelType sync_type_;
// Current sync processor, if any.
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_;
// Current sync error handler if any.
- scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_;
+ std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory_;
syncer::SyncableService::StartSyncFlare flare_;
diff --git a/chrome/browser/extensions/api/storage/sync_value_store_cache.h b/chrome/browser/extensions/api/storage/sync_value_store_cache.h
index 6de8c1d5..ab0bbaa 100644
--- a/chrome/browser/extensions/api/storage/sync_value_store_cache.h
+++ b/chrome/browser/extensions/api/storage/sync_value_store_cache.h
@@ -5,10 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_
#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/storage/settings_observer.h"
#include "extensions/browser/api/storage/value_store_cache.h"
#include "sync/api/syncable_service.h"
@@ -49,8 +50,8 @@
const base::FilePath& profile_path);
bool initialized_;
- scoped_ptr<SyncStorageBackend> app_backend_;
- scoped_ptr<SyncStorageBackend> extension_backend_;
+ std::unique_ptr<SyncStorageBackend> app_backend_;
+ std::unique_ptr<SyncStorageBackend> extension_backend_;
DISALLOW_COPY_AND_ASSIGN(SyncValueStoreCache);
};
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index 8d43d8e..543d2b44 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -153,8 +153,8 @@
// Sync-related methods.
syncer::SyncError SyncableSettingsStorage::StartSyncing(
- scoped_ptr<base::DictionaryValue> sync_state,
- scoped_ptr<SettingsSyncProcessor> sync_processor) {
+ std::unique_ptr<base::DictionaryValue> sync_state,
+ std::unique_ptr<SettingsSyncProcessor> sync_processor) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(sync_state);
DCHECK(!sync_processor_.get());
@@ -171,7 +171,7 @@
sync_processor_->type());
}
- scoped_ptr<base::DictionaryValue> current_settings =
+ std::unique_ptr<base::DictionaryValue> current_settings =
maybe_settings->PassSettings();
return sync_state->empty()
? SendLocalSettingsToSync(std::move(current_settings))
@@ -180,7 +180,7 @@
}
syncer::SyncError SyncableSettingsStorage::SendLocalSettingsToSync(
- scoped_ptr<base::DictionaryValue> local_state) {
+ std::unique_ptr<base::DictionaryValue> local_state) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (local_state->empty())
@@ -192,7 +192,7 @@
// It's not possible to iterate over a DictionaryValue and modify it at the
// same time, so hack around that restriction.
std::string key = base::DictionaryValue::Iterator(*local_state).key();
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
local_state->RemoveWithoutPathExpansion(key, &value);
changes.push_back(ValueStoreChange(key, nullptr, value.release()));
}
@@ -204,16 +204,16 @@
}
syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
- scoped_ptr<base::DictionaryValue> sync_state,
- scoped_ptr<base::DictionaryValue> local_state) {
+ std::unique_ptr<base::DictionaryValue> sync_state,
+ std::unique_ptr<base::DictionaryValue> local_state) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
// This is implemented by building up a list of sync changes then sending
// those to ProcessSyncChanges. This generates events like onStorageChanged.
- scoped_ptr<SettingSyncDataList> changes(new SettingSyncDataList());
+ std::unique_ptr<SettingSyncDataList> changes(new SettingSyncDataList());
for (base::DictionaryValue::Iterator it(*local_state); !it.IsAtEnd();
it.Advance()) {
- scoped_ptr<base::Value> sync_value;
+ std::unique_ptr<base::Value> sync_value;
if (sync_state->RemoveWithoutPathExpansion(it.key(), &sync_value)) {
if (sync_value->Equals(&it.value())) {
// Sync and local values are the same, no changes to send.
@@ -227,7 +227,7 @@
// Not synced, delete local setting.
changes->push_back(new SettingSyncData(
syncer::SyncChange::ACTION_DELETE, extension_id_, it.key(),
- scoped_ptr<base::Value>(new base::DictionaryValue())));
+ std::unique_ptr<base::Value>(new base::DictionaryValue())));
}
}
@@ -236,7 +236,7 @@
// It's not possible to iterate over a DictionaryValue and modify it at the
// same time, so hack around that restriction.
std::string key = base::DictionaryValue::Iterator(*sync_state).key();
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
CHECK(sync_state->RemoveWithoutPathExpansion(key, &value));
changes->push_back(new SettingSyncData(
syncer::SyncChange::ACTION_ADD, extension_id_, key, std::move(value)));
@@ -253,7 +253,7 @@
}
syncer::SyncError SyncableSettingsStorage::ProcessSyncChanges(
- scoped_ptr<SettingSyncDataList> sync_changes) {
+ std::unique_ptr<SettingSyncDataList> sync_changes) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!sync_changes->empty()) << "No sync changes for " << extension_id_;
@@ -272,9 +272,9 @@
it != sync_changes->end(); ++it) {
DCHECK_EQ(extension_id_, (*it)->extension_id());
const std::string& key = (*it)->key();
- scoped_ptr<base::Value> change_value = (*it)->PassValue();
+ std::unique_ptr<base::Value> change_value = (*it)->PassValue();
- scoped_ptr<base::Value> current_value;
+ std::unique_ptr<base::Value> current_value;
{
ReadResult maybe_settings = Get(key);
if (!maybe_settings->status().ok()) {
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.h b/chrome/browser/extensions/api/storage/syncable_settings_storage.h
index 3e16094..c49b49e 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.h
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.h
@@ -7,13 +7,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list_threadsafe.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/storage/setting_sync_data.h"
@@ -65,8 +65,8 @@
// |sync_processor| is used to write out any changes.
// Returns any error when trying to sync, or an empty error on success.
syncer::SyncError StartSyncing(
- scoped_ptr<base::DictionaryValue> sync_state,
- scoped_ptr<SettingsSyncProcessor> sync_processor);
+ std::unique_ptr<base::DictionaryValue> sync_state,
+ std::unique_ptr<SettingsSyncProcessor> sync_processor);
// Stops syncing this storage area. May be called at any time (idempotent).
void StopSyncing();
@@ -75,7 +75,7 @@
// time, changes will be ignored if sync isn't active.
// Returns any error when trying to sync, or an empty error on success.
syncer::SyncError ProcessSyncChanges(
- scoped_ptr<SettingSyncDataList> sync_changes);
+ std::unique_ptr<SettingSyncDataList> sync_changes);
private:
// Sends the changes from |result| to sync if it's enabled.
@@ -90,13 +90,13 @@
// in sync yet.
// Returns any error when trying to sync, or an empty error on success.
syncer::SyncError SendLocalSettingsToSync(
- scoped_ptr<base::DictionaryValue> local_state);
+ std::unique_ptr<base::DictionaryValue> local_state);
// Overwrites local state with sync state.
// Returns any error when trying to sync, or an empty error on success.
syncer::SyncError OverwriteLocalSettingsWithSync(
- scoped_ptr<base::DictionaryValue> sync_state,
- scoped_ptr<base::DictionaryValue> local_state);
+ std::unique_ptr<base::DictionaryValue> sync_state,
+ std::unique_ptr<base::DictionaryValue> local_state);
// Called when an Add/Update/Remove comes from sync. Ownership of Value*s
// are taken.
@@ -121,10 +121,10 @@
std::string const extension_id_;
// Storage area to sync.
- const scoped_ptr<ValueStore> delegate_;
+ const std::unique_ptr<ValueStore> delegate_;
// Object which sends changes to sync.
- scoped_ptr<SettingsSyncProcessor> sync_processor_;
+ std::unique_ptr<SettingsSyncProcessor> sync_processor_;
const syncer::ModelType sync_type_;
const syncer::SyncableService::StartSyncFlare flare_;
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.cc b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
index 1bd0b3f..7b8b6b7 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
@@ -66,7 +66,7 @@
void StreamsPrivateAPI::ExecuteMimeTypeHandler(
const std::string& extension_id,
content::WebContents* web_contents,
- scoped_ptr<content::StreamInfo> stream,
+ std::unique_ptr<content::StreamInfo> stream,
const std::string& view_id,
int64_t expected_content_size,
bool embedded,
@@ -86,7 +86,7 @@
GURL handler_url(Extension::GetBaseURLFromExtensionId(extension_id).spec() +
handler->handler_url());
auto tab_id = ExtensionTabUtil::GetTabId(web_contents);
- scoped_ptr<StreamContainer> stream_container(new StreamContainer(
+ std::unique_ptr<StreamContainer> stream_container(new StreamContainer(
std::move(stream), tab_id, embedded, handler_url, extension_id));
MimeHandlerStreamManager::Get(browser_context_)
->AddStream(view_id, std::move(stream_container), render_process_id,
@@ -113,7 +113,7 @@
CreateResponseHeadersDictionary(stream->response_headers.get(),
&info.response_headers.additional_properties);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::STREAMS_PRIVATE_ON_EXECUTE_MIME_TYPE_HANDLER,
streams_private::OnExecuteMimeTypeHandler::kEventName,
streams_private::OnExecuteMimeTypeHandler::Create(info)));
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.h b/chrome/browser/extensions/api/streams_private/streams_private_api.h
index 825ad43..d1c2243 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.h
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.h
@@ -41,7 +41,7 @@
// should be set to whether the document is embedded within another document.
void ExecuteMimeTypeHandler(const std::string& extension_id,
content::WebContents* web_contents,
- scoped_ptr<content::StreamInfo> stream,
+ std::unique_ptr<content::StreamInfo> stream,
const std::string& view_id,
int64_t expected_content_size,
bool embedded,
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc
index fdc3fed..86f1b0c 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc
@@ -54,8 +54,8 @@
// Test server's request handler.
// Returns response that should be sent by the test server.
-scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
- scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse());
+std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
+ std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse());
// For relative path "/doc_path.doc", return success response with MIME type
// "application/msword".
@@ -182,7 +182,7 @@
info.tab_id = 10;
info.expected_content_size = 20;
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
extensions::events::STREAMS_PRIVATE_ON_EXECUTE_MIME_TYPE_HANDLER,
streams_private::OnExecuteMimeTypeHandler::kEventName,
streams_private::OnExecuteMimeTypeHandler::Create(info)));
@@ -237,7 +237,7 @@
protected:
std::string test_extension_id_;
// The HTTP server used in the tests.
- scoped_ptr<net::EmbeddedTestServer> test_server_;
+ std::unique_ptr<net::EmbeddedTestServer> test_server_;
base::ScopedTempDir downloads_dir_;
};
@@ -357,7 +357,7 @@
// The test should start a download.
DownloadManager* download_manager = GetDownloadManager();
- scoped_ptr<content::DownloadTestObserver> download_observer(
+ std::unique_ptr<content::DownloadTestObserver> download_observer(
new content::DownloadTestObserverInProgress(download_manager, 1));
ui_test_utils::NavigateToURL(browser(),
@@ -394,7 +394,7 @@
ResultCatcher catcher;
DownloadManager* download_manager = GetDownloadManager();
- scoped_ptr<content::DownloadTestObserver> download_observer(
+ std::unique_ptr<content::DownloadTestObserver> download_observer(
new content::DownloadTestObserverInProgress(download_manager, 1));
// The resource's URL on the test server.
@@ -408,7 +408,7 @@
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents);
- scoped_ptr<DownloadUrlParameters> params(
+ std::unique_ptr<DownloadUrlParameters> params(
DownloadUrlParameters::FromWebContents(web_contents, url));
params->set_file_path(target_path);
diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc
index 6d9d18c..911e9e4 100644
--- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc
+++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc
@@ -77,7 +77,7 @@
api::sync_file_system::ServiceInfo service_info;
service_info.state = SyncServiceStateToExtensionEnum(state);
service_info.description = description;
- scoped_ptr<base::ListValue> params(
+ std::unique_ptr<base::ListValue> params(
api::sync_file_system::OnServiceStatusChanged::Create(service_info));
BroadcastOrDispatchEvent(
@@ -92,9 +92,9 @@
sync_file_system::SyncFileStatus status,
sync_file_system::SyncAction action,
sync_file_system::SyncDirection direction) {
- scoped_ptr<base::ListValue> params(new base::ListValue());
+ std::unique_ptr<base::ListValue> params(new base::ListValue());
- scoped_ptr<base::DictionaryValue> entry(
+ std::unique_ptr<base::DictionaryValue> entry(
CreateDictionaryValueForFileSystemEntry(url, file_type));
if (!entry)
return;
@@ -121,14 +121,14 @@
const GURL& app_origin,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> values) {
+ std::unique_ptr<base::ListValue> values) {
// Check to see whether the event should be broadcasted to all listening
// extensions or sent to a specific extension ID.
bool broadcast_mode = app_origin.is_empty();
EventRouter* event_router = EventRouter::Get(browser_context_);
DCHECK(event_router);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(values)));
event->restrict_to_browser_context = browser_context_;
diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h
index 1bfa1cf..d14b9d4 100644
--- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h
+++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h
@@ -5,9 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSERVER_H_
#define CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSERVER_H_
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/sync_file_system/sync_event_observer.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
@@ -69,7 +70,7 @@
void BroadcastOrDispatchEvent(const GURL& app_origin,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> value);
+ std::unique_ptr<base::ListValue> value);
DISALLOW_COPY_AND_ASSIGN(ExtensionSyncEventObserver);
};
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc
index 60b4385..04b445e 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc
@@ -69,7 +69,7 @@
// ExtensionsBrowserClient setup in BrowserProcessImpl.
mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>;
SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service(
- scoped_ptr<RemoteFileSyncService>(mock_remote_service_));
+ std::unique_ptr<RemoteFileSyncService>(mock_remote_service_));
ExtensionApiTest::SetUpOnMainThread();
}
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc
index b1095e22..9dd2a56 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc
@@ -36,11 +36,11 @@
: change_observer_(change_observer) {}
~FakeDriveServiceFactory() override {}
- scoped_ptr<drive::DriveServiceInterface> CreateDriveService(
+ std::unique_ptr<drive::DriveServiceInterface> CreateDriveService(
OAuth2TokenService* oauth2_token_service,
net::URLRequestContextGetter* url_request_context_getter,
base::SequencedTaskRunner* blocking_task_runner) override {
- scoped_ptr<drive::FakeDriveService> drive_service(
+ std::unique_ptr<drive::FakeDriveService> drive_service(
new drive::FakeDriveService);
drive_service->AddChangeObserver(change_observer_);
return std::move(drive_service);
@@ -93,7 +93,7 @@
ExtensionServiceInterface* extension_service =
extensions::ExtensionSystem::Get(context)->extension_service();
- scoped_ptr<drive_backend::SyncEngine::DriveServiceFactory>
+ std::unique_ptr<drive_backend::SyncEngine::DriveServiceFactory>
drive_service_factory(new FakeDriveServiceFactory(this));
fake_signin_manager_.reset(new FakeSigninManagerForTesting(
@@ -112,7 +112,7 @@
std::move(drive_service_factory), in_memory_env_.get());
remote_service_->SetSyncEnabled(true);
factory->set_mock_remote_file_service(
- scoped_ptr<RemoteFileSyncService>(remote_service_));
+ std::unique_ptr<RemoteFileSyncService>(remote_service_));
}
// drive::FakeDriveService::ChangeObserver override.
@@ -150,9 +150,9 @@
private:
base::ScopedTempDir base_dir_;
- scoped_ptr<leveldb::Env> in_memory_env_;
+ std::unique_ptr<leveldb::Env> in_memory_env_;
- scoped_ptr<FakeSigninManagerForTesting> fake_signin_manager_;
+ std::unique_ptr<FakeSigninManagerForTesting> fake_signin_manager_;
drive_backend::SyncEngine* remote_service_;
diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
index 7ebe877..11caece 100644
--- a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
+++ b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc
@@ -61,7 +61,7 @@
ExtensionAction* action,
Profile* profile,
StatusTray* status_tray) {
- scoped_ptr<ExtensionIndicatorIcon> extension_icon(
+ std::unique_ptr<ExtensionIndicatorIcon> extension_icon(
new ExtensionIndicatorIcon(extension, action, profile, status_tray));
// Check if a status icon was successfully created.
@@ -80,13 +80,13 @@
}
void ExtensionIndicatorIcon::OnStatusIconClicked() {
- scoped_ptr<base::ListValue> params(
+ std::unique_ptr<base::ListValue> params(
api::system_indicator::OnClicked::Create());
EventRouter* event_router = EventRouter::Get(profile_);
- scoped_ptr<Event> event(new Event(events::SYSTEM_INDICATOR_ON_CLICKED,
- system_indicator::OnClicked::kEventName,
- std::move(params), profile_));
+ std::unique_ptr<Event> event(new Event(
+ events::SYSTEM_INDICATOR_ON_CLICKED,
+ system_indicator::OnClicked::kEventName, std::move(params), profile_));
event_router->DispatchEventToExtension(extension_->id(), std::move(event));
}
diff --git a/chrome/browser/extensions/api/system_private/system_private_api.cc b/chrome/browser/extensions/api/system_private/system_private_api.cc
index 4f3343d3..6f3f94c 100644
--- a/chrome/browser/extensions/api/system_private/system_private_api.cc
+++ b/chrome/browser/extensions/api/system_private/system_private_api.cc
@@ -54,7 +54,7 @@
void DispatchEvent(extensions::events::HistogramValue histogram_value,
const std::string& event_name,
base::Value* argument) {
- scoped_ptr<base::ListValue> list_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> list_args(new base::ListValue());
if (argument) {
list_args->Append(argument);
}
diff --git a/chrome/browser/extensions/api/system_private/system_private_apitest.cc b/chrome/browser/extensions/api/system_private/system_private_apitest.cc
index 09f2b1a3..6b47168d 100644
--- a/chrome/browser/extensions/api/system_private/system_private_apitest.cc
+++ b/chrome/browser/extensions/api/system_private/system_private_apitest.cc
@@ -35,7 +35,7 @@
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
fake_update_engine_client_ = new chromeos::FakeUpdateEngineClient;
chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient(
- scoped_ptr<UpdateEngineClient>(fake_update_engine_client_));
+ std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_));
}
void TearDownInProcessBrowserTestFixture() override {
diff --git a/chrome/browser/extensions/api/tab_capture/offscreen_tab.cc b/chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
index 93d8363..9e00054 100644
--- a/chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
+++ b/chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
@@ -388,11 +388,9 @@
DVLOG(2) << "Allowing " << devices.size()
<< " capture devices for OffscreenTab content.";
- callback.Run(
- devices,
- devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE :
- content::MEDIA_DEVICE_OK,
- scoped_ptr<content::MediaStreamUI>(nullptr));
+ callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE
+ : content::MEDIA_DEVICE_OK,
+ std::unique_ptr<content::MediaStreamUI>(nullptr));
}
bool OffscreenTab::CheckMediaAccessPermission(
diff --git a/chrome/browser/extensions/api/tab_capture/offscreen_tab.h b/chrome/browser/extensions/api/tab_capture/offscreen_tab.h
index afc252c7..20d88e7 100644
--- a/chrome/browser/extensions/api/tab_capture/offscreen_tab.h
+++ b/chrome/browser/extensions/api/tab_capture/offscreen_tab.h
@@ -186,10 +186,10 @@
// A non-shared off-the-record profile based on the profile of the extension
// background page.
- const scoped_ptr<Profile> profile_;
+ const std::unique_ptr<Profile> profile_;
// The WebContents containing the off-screen tab's page.
- scoped_ptr<content::WebContents> offscreen_tab_web_contents_;
+ std::unique_ptr<content::WebContents> offscreen_tab_web_contents_;
// The time at which Start() finished creating |offscreen_tab_web_contents_|.
base::TimeTicks start_time_;
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
index 47e2e8c3..7bdc6cd 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -89,7 +89,7 @@
bad_keys.push_back(it.key());
}
for (const std::string& k : bad_keys) {
- scoped_ptr<base::Value> ignored;
+ std::unique_ptr<base::Value> ignored;
dict->RemoveWithoutPathExpansion(k, &ignored);
}
};
@@ -198,7 +198,7 @@
};
bool TabCaptureCaptureFunction::RunSync() {
- scoped_ptr<api::tab_capture::Capture::Params> params =
+ std::unique_ptr<api::tab_capture::Capture::Params> params =
TabCapture::Capture::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -273,7 +273,7 @@
}
bool TabCaptureCaptureOffscreenTabFunction::RunSync() {
- scoped_ptr<TabCapture::CaptureOffscreenTab::Params> params =
+ std::unique_ptr<TabCapture::CaptureOffscreenTab::Params> params =
TabCapture::CaptureOffscreenTab::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc
index 93ae279..6be7404 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc
@@ -160,7 +160,7 @@
page += "&fps=60";
ASSERT_TRUE(RunExtensionSubtest("tab_capture", page)) << message_;
ASSERT_TRUE(tracing::EndTracing(&json_events));
- scoped_ptr<trace_analyzer::TraceAnalyzer> analyzer;
+ std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer;
analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events));
// The printed result will be the average time between frames in the
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
index 8e1e1345..0cf76f8 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
@@ -324,13 +324,13 @@
if (!router)
return;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
tab_capture::CaptureInfo info;
request->GetCaptureInfo(&info);
args->Append(info.ToValue().release());
- scoped_ptr<Event> event(new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED,
- tab_capture::OnStatusChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED,
+ tab_capture::OnStatusChanged::kEventName, std::move(args)));
event->restrict_to_browser_context = browser_context_;
router->DispatchEventToExtension(request->extension_id(), std::move(event));
diff --git a/chrome/browser/extensions/api/tabs/app_window_controller.cc b/chrome/browser/extensions/api/tabs/app_window_controller.cc
index 2e326a2..3e708e4 100644
--- a/chrome/browser/extensions/api/tabs/app_window_controller.cc
+++ b/chrome/browser/extensions/api/tabs/app_window_controller.cc
@@ -21,9 +21,10 @@
namespace extensions {
-AppWindowController::AppWindowController(AppWindow* app_window,
- scoped_ptr<AppBaseWindow> base_window,
- Profile* profile)
+AppWindowController::AppWindowController(
+ AppWindow* app_window,
+ std::unique_ptr<AppBaseWindow> base_window,
+ Profile* profile)
: WindowController(base_window.get(), profile),
app_window_(app_window),
base_window_(std::move(base_window)) {
@@ -65,7 +66,7 @@
return CreateTabObject(extension, tab_index)->ToValue().release();
}
-scoped_ptr<api::tabs::Tab> AppWindowController::CreateTabObject(
+std::unique_ptr<api::tabs::Tab> AppWindowController::CreateTabObject(
const extensions::Extension* extension,
int tab_index) const {
if (tab_index > 0)
@@ -75,7 +76,7 @@
if (!web_contents)
return nullptr;
- scoped_ptr<api::tabs::Tab> tab_object(new api::tabs::Tab);
+ std::unique_ptr<api::tabs::Tab> tab_object(new api::tabs::Tab);
tab_object->id.reset(new int(SessionTabHelper::IdForTab(web_contents)));
tab_object->index = 0;
tab_object->window_id =
diff --git a/chrome/browser/extensions/api/tabs/app_window_controller.h b/chrome/browser/extensions/api/tabs/app_window_controller.h
index 437e1810..78f8183 100644
--- a/chrome/browser/extensions/api/tabs/app_window_controller.h
+++ b/chrome/browser/extensions/api/tabs/app_window_controller.h
@@ -22,7 +22,7 @@
class AppWindowController : public WindowController {
public:
AppWindowController(AppWindow* window,
- scoped_ptr<AppBaseWindow> base_window,
+ std::unique_ptr<AppBaseWindow> base_window,
Profile* profile);
~AppWindowController() override;
@@ -33,7 +33,7 @@
const Extension* extension) const override;
base::DictionaryValue* CreateTabValue(const Extension* extension,
int tab_index) const override;
- scoped_ptr<api::tabs::Tab> CreateTabObject(
+ std::unique_ptr<api::tabs::Tab> CreateTabObject(
const extensions::Extension* extension,
int tab_index) const override;
@@ -45,7 +45,7 @@
private:
AppWindow* app_window_; // Owns us.
- scoped_ptr<AppBaseWindow> base_window_;
+ std::unique_ptr<AppBaseWindow> base_window_;
DISALLOW_COPY_AND_ASSIGN(AppWindowController);
};
diff --git a/chrome/browser/extensions/api/tabs/ash_panel_contents.h b/chrome/browser/extensions/api/tabs/ash_panel_contents.h
index e789e50..442051d 100644
--- a/chrome/browser/extensions/api/tabs/ash_panel_contents.h
+++ b/chrome/browser/extensions/api/tabs/ash_panel_contents.h
@@ -7,10 +7,10 @@
#include <stdint.h>
+#include <memory>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h"
#include "extensions/browser/app_window/app_window.h"
@@ -59,8 +59,8 @@
private:
extensions::AppWindow* host_;
GURL url_;
- scoped_ptr<content::WebContents> web_contents_;
- scoped_ptr<LauncherFaviconLoader> launcher_favicon_loader_;
+ std::unique_ptr<content::WebContents> web_contents_;
+ std::unique_ptr<LauncherFaviconLoader> launcher_favicon_loader_;
DISALLOW_COPY_AND_ASSIGN(AshPanelContents);
};
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index ab647b1..f2d0fd9d 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -202,8 +202,8 @@
}
template <typename T>
-void AssignOptionalValue(const scoped_ptr<T>& source,
- scoped_ptr<T>& destination) {
+void AssignOptionalValue(const std::unique_ptr<T>& source,
+ std::unique_ptr<T>& destination) {
if (source.get()) {
destination.reset(new T(*source.get()));
}
@@ -285,7 +285,8 @@
// Windows ---------------------------------------------------------------------
bool WindowsGetFunction::RunSync() {
- scoped_ptr<windows::Get::Params> params(windows::Get::Params::Create(*args_));
+ std::unique_ptr<windows::Get::Params> params(
+ windows::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
ApiParameterExtractor<windows::Get::Params> extractor(params.get());
@@ -303,7 +304,7 @@
}
bool WindowsGetCurrentFunction::RunSync() {
- scoped_ptr<windows::GetCurrent::Params> params(
+ std::unique_ptr<windows::GetCurrent::Params> params(
windows::GetCurrent::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -322,7 +323,7 @@
}
bool WindowsGetLastFocusedFunction::RunSync() {
- scoped_ptr<windows::GetLastFocused::Params> params(
+ std::unique_ptr<windows::GetLastFocused::Params> params(
windows::GetLastFocused::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -351,7 +352,7 @@
}
bool WindowsGetAllFunction::RunSync() {
- scoped_ptr<windows::GetAll::Params> params(
+ std::unique_ptr<windows::GetAll::Params> params(
windows::GetAll::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -423,7 +424,7 @@
}
bool WindowsCreateFunction::RunSync() {
- scoped_ptr<windows::Create::Params> params(
+ std::unique_ptr<windows::Create::Params> params(
windows::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
std::vector<GURL> urls;
@@ -698,7 +699,7 @@
}
bool WindowsUpdateFunction::RunSync() {
- scoped_ptr<windows::Update::Params> params(
+ std::unique_ptr<windows::Update::Params> params(
windows::Update::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -802,7 +803,7 @@
}
bool WindowsRemoveFunction::RunSync() {
- scoped_ptr<windows::Remove::Params> params(
+ std::unique_ptr<windows::Remove::Params> params(
windows::Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -829,7 +830,7 @@
// windowId defaults to "current" window.
int window_id = extension_misc::kCurrentWindowId;
- scoped_ptr<tabs::GetSelected::Params> params(
+ std::unique_ptr<tabs::GetSelected::Params> params(
tabs::GetSelected::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->window_id.get())
@@ -851,7 +852,7 @@
}
bool TabsGetAllInWindowFunction::RunSync() {
- scoped_ptr<tabs::GetAllInWindow::Params> params(
+ std::unique_ptr<tabs::GetAllInWindow::Params> params(
tabs::GetAllInWindow::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// windowId defaults to "current" window.
@@ -869,7 +870,8 @@
}
bool TabsQueryFunction::RunSync() {
- scoped_ptr<tabs::Query::Params> params(tabs::Query::Params::Create(*args_));
+ std::unique_ptr<tabs::Query::Params> params(
+ tabs::Query::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool loading_status_set = params->query_info.status != tabs::TAB_STATUS_NONE;
@@ -1022,7 +1024,8 @@
}
bool TabsCreateFunction::RunSync() {
- scoped_ptr<tabs::Create::Params> params(tabs::Create::Params::Create(*args_));
+ std::unique_ptr<tabs::Create::Params> params(
+ tabs::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
ExtensionTabUtil::OpenTabParams options;
@@ -1037,7 +1040,7 @@
AssignOptionalValue(params->create_properties.url, options.url);
std::string error;
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
ExtensionTabUtil::OpenTab(this, options, &error));
if (!result) {
SetError(error);
@@ -1052,7 +1055,7 @@
}
bool TabsDuplicateFunction::RunSync() {
- scoped_ptr<tabs::Duplicate::Params> params(
+ std::unique_ptr<tabs::Duplicate::Params> params(
tabs::Duplicate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
int tab_id = params->tab_id;
@@ -1094,7 +1097,7 @@
}
bool TabsGetFunction::RunSync() {
- scoped_ptr<tabs::Get::Params> params(tabs::Get::Params::Create(*args_));
+ std::unique_ptr<tabs::Get::Params> params(tabs::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
int tab_id = params->tab_id;
@@ -1130,7 +1133,7 @@
}
bool TabsHighlightFunction::RunSync() {
- scoped_ptr<tabs::Highlight::Params> params(
+ std::unique_ptr<tabs::Highlight::Params> params(
tabs::Highlight::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -1200,7 +1203,8 @@
}
bool TabsUpdateFunction::RunAsync() {
- scoped_ptr<tabs::Update::Params> params(tabs::Update::Params::Create(*args_));
+ std::unique_ptr<tabs::Update::Params> params(
+ tabs::Update::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
int tab_id = -1;
@@ -1401,12 +1405,13 @@
}
bool TabsMoveFunction::RunSync() {
- scoped_ptr<tabs::Move::Params> params(tabs::Move::Params::Create(*args_));
+ std::unique_ptr<tabs::Move::Params> params(
+ tabs::Move::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
int new_index = params->move_properties.index;
int* window_id = params->move_properties.window_id.get();
- scoped_ptr<base::ListValue> tab_values(new base::ListValue());
+ std::unique_ptr<base::ListValue> tab_values(new base::ListValue());
size_t num_tabs = 0;
if (params->tab_ids.as_integers) {
@@ -1435,7 +1440,7 @@
error_ = "No tabs given.";
return false;
} else if (num_tabs == 1) {
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
CHECK(tab_values.get()->Remove(0, &value));
SetResult(value.release());
} else {
@@ -1550,7 +1555,7 @@
}
bool TabsReloadFunction::RunSync() {
- scoped_ptr<tabs::Reload::Params> params(
+ std::unique_ptr<tabs::Reload::Params> params(
tabs::Reload::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -1606,7 +1611,8 @@
}
bool TabsRemoveFunction::RunSync() {
- scoped_ptr<tabs::Remove::Params> params(tabs::Remove::Params::Create(*args_));
+ std::unique_ptr<tabs::Remove::Params> params(
+ tabs::Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->tab_ids.as_integers) {
@@ -1697,7 +1703,7 @@
int context_id = extension_misc::kCurrentWindowId;
args_->GetInteger(0, &context_id);
- scoped_ptr<ImageDetails> image_details;
+ std::unique_ptr<ImageDetails> image_details;
if (args_->GetSize() > 1) {
base::Value* spec = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &spec) && spec);
@@ -1747,7 +1753,7 @@
}
bool TabsDetectLanguageFunction::RunAsync() {
- scoped_ptr<tabs::DetectLanguage::Params> params(
+ std::unique_ptr<tabs::DetectLanguage::Params> params(
tabs::DetectLanguage::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -1869,7 +1875,7 @@
base::DictionaryValue* details_value = NULL;
if (!args_->GetDictionary(1, &details_value))
return false;
- scoped_ptr<InjectDetails> details(new InjectDetails());
+ std::unique_ptr<InjectDetails> details(new InjectDetails());
if (!InjectDetails::Populate(*details_value, details.get()))
return false;
@@ -2022,7 +2028,7 @@
}
bool TabsSetZoomFunction::RunAsync() {
- scoped_ptr<tabs::SetZoom::Params> params(
+ std::unique_ptr<tabs::SetZoom::Params> params(
tabs::SetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -2054,7 +2060,7 @@
}
bool TabsGetZoomFunction::RunAsync() {
- scoped_ptr<tabs::GetZoom::Params> params(
+ std::unique_ptr<tabs::GetZoom::Params> params(
tabs::GetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -2074,7 +2080,7 @@
bool TabsSetZoomSettingsFunction::RunAsync() {
using api::tabs::ZoomSettings;
- scoped_ptr<tabs::SetZoomSettings::Params> params(
+ std::unique_ptr<tabs::SetZoomSettings::Params> params(
tabs::SetZoomSettings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -2124,7 +2130,7 @@
}
bool TabsGetZoomSettingsFunction::RunAsync() {
- scoped_ptr<tabs::GetZoomSettings::Params> params(
+ std::unique_ptr<tabs::GetZoomSettings::Params> params(
tabs::GetZoomSettings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
diff --git a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
index 5d0e502f..91dcbc1 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
@@ -20,13 +20,13 @@
namespace {
-scoped_ptr<base::ListValue> RunTabsQueryFunction(
+std::unique_ptr<base::ListValue> RunTabsQueryFunction(
Browser* browser,
const Extension* extension,
const std::string& query_info) {
scoped_refptr<TabsQueryFunction> function(new TabsQueryFunction());
function->set_extension(extension);
- scoped_ptr<base::Value> value(
+ std::unique_ptr<base::Value> value(
extension_function_test_utils::RunFunctionAndReturnSingleResult(
function.get(), query_info, browser,
extension_function_test_utils::NONE));
@@ -48,8 +48,8 @@
void TearDown() override;
// The browser (and accompanying window).
- scoped_ptr<TestBrowserWindow> browser_window_;
- scoped_ptr<Browser> browser_;
+ std::unique_ptr<TestBrowserWindow> browser_window_;
+ std::unique_ptr<Browser> browser_;
DISALLOW_COPY_AND_ASSIGN(TabsApiUnitTest);
};
@@ -98,7 +98,7 @@
// An extension without "tabs" permission will see none of the 3 tabs.
scoped_refptr<const Extension> extension = test_util::CreateEmptyExtension();
- scoped_ptr<base::ListValue> tabs_list_without_permission(
+ std::unique_ptr<base::ListValue> tabs_list_without_permission(
RunTabsQueryFunction(browser(), extension.get(), kTitleAndURLQueryInfo));
ASSERT_TRUE(tabs_list_without_permission);
EXPECT_EQ(0u, tabs_list_without_permission->GetSize());
@@ -114,8 +114,9 @@
.Set("permissions", ListBuilder().Append("tabs").Build())
.Build())
.Build();
- scoped_ptr<base::ListValue> tabs_list_with_permission(RunTabsQueryFunction(
- browser(), extension_with_permission.get(), kTitleAndURLQueryInfo));
+ std::unique_ptr<base::ListValue> tabs_list_with_permission(
+ RunTabsQueryFunction(browser(), extension_with_permission.get(),
+ kTitleAndURLQueryInfo));
ASSERT_TRUE(tabs_list_with_permission);
ASSERT_EQ(1u, tabs_list_with_permission->GetSize());
@@ -165,8 +166,9 @@
.Build();
{
- scoped_ptr<base::ListValue> tabs_list_with_permission(RunTabsQueryFunction(
- browser(), extension_with_permission.get(), kTitleAndURLQueryInfo));
+ std::unique_ptr<base::ListValue> tabs_list_with_permission(
+ RunTabsQueryFunction(browser(), extension_with_permission.get(),
+ kTitleAndURLQueryInfo));
ASSERT_TRUE(tabs_list_with_permission);
ASSERT_EQ(1u, tabs_list_with_permission->GetSize());
@@ -180,8 +182,9 @@
// Try the same without title, first and third tabs will match.
const char* kURLQueryInfo = "[{\"url\": \"*://www.google.com/*\"}]";
{
- scoped_ptr<base::ListValue> tabs_list_with_permission(RunTabsQueryFunction(
- browser(), extension_with_permission.get(), kURLQueryInfo));
+ std::unique_ptr<base::ListValue> tabs_list_with_permission(
+ RunTabsQueryFunction(browser(), extension_with_permission.get(),
+ kURLQueryInfo));
ASSERT_TRUE(tabs_list_with_permission);
ASSERT_EQ(2u, tabs_list_with_permission->GetSize());
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
index b425eff..455ce42 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -5,8 +5,10 @@
#include "chrome/browser/extensions/api/tabs/tabs_event_router.h"
#include <stddef.h>
+
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
@@ -41,17 +43,17 @@
const Extension* extension,
Event* event,
const base::DictionaryValue* listener_filter) {
- scoped_ptr<api::tabs::Tab> tab_object =
+ std::unique_ptr<api::tabs::Tab> tab_object =
ExtensionTabUtil::CreateTabObject(contents, extension);
base::DictionaryValue* tab_value = tab_object->ToValue().release();
- scoped_ptr<base::DictionaryValue> changed_properties(
+ std::unique_ptr<base::DictionaryValue> changed_properties(
new base::DictionaryValue);
const base::Value* value = nullptr;
for (const auto& property : changed_property_names) {
if (tab_value->Get(property, &value))
- changed_properties->Set(property, make_scoped_ptr(value->DeepCopy()));
+ changed_properties->Set(property, base::WrapUnique(value->DeepCopy()));
}
event->event_args->Set(1, changed_properties.release());
@@ -155,7 +157,7 @@
int tab_id = ExtensionTabUtil::GetTabId(contents);
DCHECK(tab_entries_.find(tab_id) == tab_entries_.end());
- tab_entries_[tab_id] = make_scoped_ptr(new TabEntry(this, contents));
+ tab_entries_[tab_id] = base::WrapUnique(new TabEntry(this, contents));
}
void TabsEventRouter::UnregisterForTabNotifications(WebContents* contents) {
@@ -199,8 +201,8 @@
int index,
bool active) {
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
- scoped_ptr<base::ListValue> args(new base::ListValue);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<Event> event(new Event(
events::TABS_ON_CREATED, tabs::OnCreated::kEventName, std::move(args)));
event->restrict_to_browser_context = profile;
event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED;
@@ -225,7 +227,7 @@
}
int tab_id = ExtensionTabUtil::GetTabId(contents);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(new FundamentalValue(tab_id));
base::DictionaryValue* object_args = new base::DictionaryValue();
@@ -247,7 +249,7 @@
return;
}
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(
new FundamentalValue(ExtensionTabUtil::GetTabId(contents)));
@@ -269,7 +271,7 @@
int index) {
int tab_id = ExtensionTabUtil::GetTabId(contents);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(new FundamentalValue(tab_id));
base::DictionaryValue* object_args = new base::DictionaryValue();
@@ -290,7 +292,7 @@
WebContents* new_contents,
int index,
int reason) {
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
int tab_id = ExtensionTabUtil::GetTabId(new_contents);
args->Append(new FundamentalValue(tab_id));
@@ -310,10 +312,10 @@
: EventRouter::USER_GESTURE_NOT_ENABLED;
DispatchEvent(profile, events::TABS_ON_SELECTION_CHANGED,
tabs::OnSelectionChanged::kEventName,
- scoped_ptr<base::ListValue>(args->DeepCopy()), gesture);
+ std::unique_ptr<base::ListValue>(args->DeepCopy()), gesture);
DispatchEvent(profile, events::TABS_ON_ACTIVE_CHANGED,
tabs::OnActiveChanged::kEventName,
- scoped_ptr<base::ListValue>(args->DeepCopy()), gesture);
+ std::unique_ptr<base::ListValue>(args->DeepCopy()), gesture);
// The onActivated event takes one argument: {windowId, tabId}.
args->Remove(0, NULL);
@@ -328,7 +330,7 @@
const ui::ListSelectionModel& old_model) {
ui::ListSelectionModel::SelectedIndices new_selection =
tab_strip_model->selection_model().selected_indices();
- scoped_ptr<base::ListValue> all_tabs(new base::ListValue);
+ std::unique_ptr<base::ListValue> all_tabs(new base::ListValue);
for (size_t i = 0; i < new_selection.size(); ++i) {
int index = new_selection[i];
@@ -339,8 +341,8 @@
all_tabs->Append(new FundamentalValue(tab_id));
}
- scoped_ptr<base::ListValue> args(new base::ListValue);
- scoped_ptr<base::DictionaryValue> select_info(new base::DictionaryValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::DictionaryValue> select_info(new base::DictionaryValue);
select_info->Set(
tabs_constants::kWindowIdKey,
@@ -354,7 +356,7 @@
Profile* profile = tab_strip_model->profile();
DispatchEvent(profile, events::TABS_ON_HIGHLIGHT_CHANGED,
tabs::OnHighlightChanged::kEventName,
- scoped_ptr<base::ListValue>(args->DeepCopy()),
+ std::unique_ptr<base::ListValue>(args->DeepCopy()),
EventRouter::USER_GESTURE_UNKNOWN);
DispatchEvent(profile, events::TABS_ON_HIGHLIGHTED,
tabs::OnHighlighted::kEventName, std::move(args),
@@ -364,7 +366,7 @@
void TabsEventRouter::TabMoved(WebContents* contents,
int from_index,
int to_index) {
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(
new FundamentalValue(ExtensionTabUtil::GetTabId(contents)));
@@ -414,13 +416,13 @@
Profile* profile,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
EventRouter::UserGestureState user_gesture) {
EventRouter* event_router = EventRouter::Get(profile);
if (!profile_->IsSameProfile(profile) || !event_router)
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
event->restrict_to_browser_context = profile;
event->user_gesture = user_gesture;
@@ -435,7 +437,7 @@
// The state of the tab (as seen from the extension point of view) has
// changed. Send a notification to the extension.
- scoped_ptr<base::ListValue> args_base(new base::ListValue);
+ std::unique_ptr<base::ListValue> args_base(new base::ListValue);
// First arg: The id of the tab that changed.
args_base->AppendInteger(ExtensionTabUtil::GetTabId(contents));
@@ -448,9 +450,9 @@
// WillDispatchTabUpdatedEvent.
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
- scoped_ptr<Event> event(new Event(events::TABS_ON_UPDATED,
- tabs::OnUpdated::kEventName,
- std::move(args_base)));
+ std::unique_ptr<Event> event(new Event(events::TABS_ON_UPDATED,
+ tabs::OnUpdated::kEventName,
+ std::move(args_base)));
event->restrict_to_browser_context = profile;
event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED;
event->will_dispatch_callback =
@@ -481,7 +483,7 @@
// WebContents being swapped.
const int new_tab_id = ExtensionTabUtil::GetTabId(new_contents);
const int old_tab_id = ExtensionTabUtil::GetTabId(old_contents);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(new FundamentalValue(new_tab_id));
args->Append(new FundamentalValue(old_tab_id));
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.h b/chrome/browser/extensions/api/tabs/tabs_event_router.h
index 0c512ae..b023dc44 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.h
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h
@@ -107,14 +107,14 @@
void DispatchEvent(Profile* profile,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
EventRouter::UserGestureState user_gesture);
void DispatchEventsAcrossIncognito(
Profile* profile,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
- scoped_ptr<base::ListValue> cross_incognito_args);
+ std::unique_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> cross_incognito_args);
// Packages |changed_property_names| as a tab updated event for the tab
// |contents| and dispatches the event to the extension.
@@ -185,7 +185,7 @@
// nullptr if not.
TabEntry* GetTabEntry(content::WebContents* contents);
- using TabEntryMap = std::map<int, scoped_ptr<TabEntry>>;
+ using TabEntryMap = std::map<int, std::unique_ptr<TabEntry>>;
TabEntryMap tab_entries_;
// The main profile that owns this event router.
diff --git a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
index 320e218..879acfe 100644
--- a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
@@ -45,10 +45,9 @@
scoped_refptr<extensions::Extension> extension(
extensions::test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[]",
- new_browser)));
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[]", new_browser)));
// The id should always match the last focused window and does not depend
// on what was passed to RunFunctionAndReturnSingleResult.
@@ -96,10 +95,9 @@
// Get tabs in the 'last focused' window called from non-focused browser.
scoped_refptr<extensions::TabsQueryFunction> function =
new extensions::TabsQueryFunction();
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[{\"lastFocusedWindow\":true}]",
- browser())));
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[{\"lastFocusedWindow\":true}]", browser())));
base::ListValue* result_tabs = result.get();
// We should have one initial tab and one added tab.
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index c4a717bd..e10c1e3 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -6,10 +6,10 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/pattern.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -121,11 +121,9 @@
function = new WindowsGetFunction();
function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
- function.get(),
- base::StringPrintf("[%u]", window_id),
- browser())));
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), base::StringPrintf("[%u]", window_id), browser())));
EXPECT_EQ(window_id, GetWindowId(result.get()));
EXPECT_FALSE(api_test_utils::GetBoolean(result.get(), "incognito"));
EXPECT_EQ("normal", api_test_utils::GetString(result.get(), "type"));
@@ -226,10 +224,9 @@
new WindowsGetCurrentFunction();
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[]",
- new_browser)));
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[]", new_browser)));
// The id should match the window id of the browser instance that was passed
// to RunFunctionAndReturnSingleResult.
@@ -280,10 +277,9 @@
scoped_refptr<WindowsGetAllFunction> function = new WindowsGetAllFunction();
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[]",
- browser())));
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(function.get(),
+ "[]", browser())));
base::ListValue* windows = result.get();
EXPECT_EQ(window_ids.size(), windows->GetSize());
@@ -351,7 +347,7 @@
scoped_refptr<WindowsGetAllFunction> function = new WindowsGetAllFunction();
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::ListValue> result(
+ std::unique_ptr<base::ListValue> result(
utils::ToList(utils::RunFunctionAndReturnSingleResult(
function.get(),
"[{\"windowTypes\": [\"app\", \"devtools\", \"normal\", \"panel\", "
@@ -412,11 +408,10 @@
// Without a callback the function will not generate a result.
update_tab_function->set_has_callback(true);
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
update_tab_function.get(),
- "[null, {\"url\": \"about:blank\", \"pinned\": true}]",
- browser())));
+ "[null, {\"url\": \"about:blank\", \"pinned\": true}]", browser())));
// The url is stripped since the extension does not have tab permissions.
EXPECT_FALSE(result->HasKey("url"));
EXPECT_TRUE(api_test_utils::GetBoolean(result.get(), "pinned"));
@@ -435,11 +430,9 @@
browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame());
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
- function.get(),
- kArgsWithoutExplicitIncognitoParam,
- browser(),
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), kArgsWithoutExplicitIncognitoParam, browser(),
utils::INCLUDE_INCOGNITO)));
// Make sure it is a new(different) window.
@@ -478,11 +471,9 @@
scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction();
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- kEmptyArgs,
- browser(),
- utils::INCLUDE_INCOGNITO)));
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), kEmptyArgs, browser(), utils::INCLUDE_INCOGNITO)));
// Make sure it is a new(different) window.
EXPECT_NE(ExtensionTabUtil::GetWindowId(browser()),
@@ -572,10 +563,9 @@
// Get tabs in the 'current' window called from non-focused browser.
scoped_refptr<TabsQueryFunction> function = new TabsQueryFunction();
function->set_extension(test_util::CreateEmptyExtension().get());
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[{\"currentWindow\":true}]",
- browser())));
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[{\"currentWindow\":true}]", browser())));
base::ListValue* result_tabs = result.get();
// We should have one initial tab and one added tab.
@@ -620,10 +610,9 @@
// Get tabs in the 'current' window called from non-focused browser.
scoped_refptr<TabsQueryFunction> function = new TabsQueryFunction();
function->set_extension(test_util::CreateEmptyExtension().get());
- scoped_ptr<base::ListValue> result(utils::ToList(
- utils::RunFunctionAndReturnSingleResult(function.get(),
- "[{}]",
- browser())));
+ std::unique_ptr<base::ListValue> result(
+ utils::ToList(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[{}]", browser())));
std::set<int> result_ids;
base::ListValue* result_tabs = result.get();
@@ -657,11 +646,10 @@
static const char kNewBlankTabArgs[] =
"[{\"url\": \"about:blank\", \"windowId\": %u}]";
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
create_tab_function.get(),
- base::StringPrintf(kNewBlankTabArgs, window_id),
- browser())));
+ base::StringPrintf(kNewBlankTabArgs, window_id), browser())));
EXPECT_NE(window_id, GetTabWindowId(result.get()));
}
@@ -721,7 +709,7 @@
scoped_refptr<WindowsGetFunction> get_function = new WindowsGetFunction();
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension().get());
get_function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
get_function.get(),
base::StringPrintf("[%u, {\"windowTypes\": [\"app\"]}]",
@@ -767,7 +755,7 @@
scoped_refptr<WindowsGetFunction> get_function = new WindowsGetFunction();
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension().get());
get_function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
get_function.get(),
base::StringPrintf(
@@ -954,7 +942,7 @@
scoped_refptr<WindowsGetLastFocusedFunction> function =
new WindowsGetLastFocusedFunction();
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
+ std::unique_ptr<base::DictionaryValue> result(utils::ToDictionary(
RunFunction(function.get(), "[{\"populate\": true}]")));
EXPECT_NE(devtools_window_id,
api_test_utils::GetInteger(result.get(), "id"));
@@ -970,7 +958,7 @@
scoped_refptr<WindowsGetLastFocusedFunction> get_current_app_function =
new WindowsGetLastFocusedFunction();
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
+ std::unique_ptr<base::DictionaryValue> result(utils::ToDictionary(
RunFunction(get_current_app_function.get(), "[{\"populate\": true}]")));
int app_window_id = app_window->session_id().id();
EXPECT_NE(app_window_id, api_test_utils::GetInteger(result.get(), "id"));
@@ -988,7 +976,7 @@
scoped_refptr<WindowsGetLastFocusedFunction> function =
new WindowsGetLastFocusedFunction();
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
+ std::unique_ptr<base::DictionaryValue> result(utils::ToDictionary(
RunFunction(function.get(), "[{\"populate\": true}]")));
int normal_browser_window_id =
ExtensionTabUtil::GetWindowId(normal_browser);
@@ -1004,7 +992,7 @@
scoped_refptr<WindowsGetLastFocusedFunction> function =
new WindowsGetLastFocusedFunction();
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
+ std::unique_ptr<base::DictionaryValue> result(utils::ToDictionary(
RunFunction(function.get(), "[{\"populate\": true}]")));
int popup_browser_window_id = ExtensionTabUtil::GetWindowId(popup_browser);
EXPECT_EQ(popup_browser_window_id,
@@ -1020,9 +1008,10 @@
scoped_refptr<WindowsGetLastFocusedFunction> function =
new WindowsGetLastFocusedFunction();
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(RunFunction(
- function.get(),
- "[{\"populate\": true, \"windowTypes\": [ \"devtools\" ]}]")));
+ std::unique_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(RunFunction(
+ function.get(),
+ "[{\"populate\": true, \"windowTypes\": [ \"devtools\" ]}]")));
int devtools_window_id = ExtensionTabUtil::GetWindowId(
DevToolsWindowTesting::Get(devtools)->browser());
EXPECT_EQ(devtools_window_id,
@@ -1041,7 +1030,7 @@
scoped_refptr<WindowsGetLastFocusedFunction> get_current_app_function =
new WindowsGetLastFocusedFunction();
- scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
+ std::unique_ptr<base::DictionaryValue> result(utils::ToDictionary(
RunFunction(get_current_app_function.get(),
"[{\"populate\": true, \"windowTypes\": [ \"app\" ]}]")));
int app_window_id = app_window->session_id().id();
@@ -1066,7 +1055,7 @@
scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
function->set_extension(extension.get());
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
function.get(), "[{\"state\": \"minimized\"}]", browser(),
utils::INCLUDE_INCOGNITO)));
@@ -1150,7 +1139,7 @@
scoped_refptr<TabsDuplicateFunction> duplicate_tab_function(
new TabsDuplicateFunction());
- scoped_ptr<base::DictionaryValue> test_extension_value(
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
api_test_utils::ParseDictionary(
"{\"name\": \"Test\", \"version\": \"1.0\", \"permissions\": "
"[\"tabs\"]}"));
@@ -1159,8 +1148,8 @@
duplicate_tab_function->set_extension(empty_tab_extension.get());
duplicate_tab_function->set_has_callback(true);
- scoped_ptr<base::DictionaryValue> duplicate_result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::DictionaryValue> duplicate_result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id),
browser())));
@@ -1198,8 +1187,8 @@
duplicate_tab_function->set_extension(empty_extension.get());
duplicate_tab_function->set_has_callback(true);
- scoped_ptr<base::DictionaryValue> duplicate_result(utils::ToDictionary(
- utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::DictionaryValue> duplicate_result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id),
browser())));
@@ -1293,7 +1282,7 @@
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, ExecuteScriptOnDevTools) {
- scoped_ptr<base::DictionaryValue> test_extension_value(
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
api_test_utils::ParseDictionary(
"{\"name\": \"Test\", \"version\": \"1.0\", \"permissions\": "
"[\"tabs\"]}"));
@@ -1380,10 +1369,9 @@
get_zoom_function->set_extension(extension_.get());
get_zoom_function->set_has_callback(true);
- scoped_ptr<base::Value> get_zoom_result(
+ std::unique_ptr<base::Value> get_zoom_result(
utils::RunFunctionAndReturnSingleResult(
- get_zoom_function.get(),
- base::StringPrintf("[%u]", tab_id),
+ get_zoom_function.get(), base::StringPrintf("[%u]", tab_id),
browser()));
if (!get_zoom_result)
@@ -1426,10 +1414,9 @@
get_zoom_settings_function->set_extension(extension_.get());
get_zoom_settings_function->set_has_callback(true);
- scoped_ptr<base::DictionaryValue> get_zoom_settings_result(
+ std::unique_ptr<base::DictionaryValue> get_zoom_settings_result(
utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
- get_zoom_settings_function.get(),
- base::StringPrintf("[%u]", tab_id),
+ get_zoom_settings_function.get(), base::StringPrintf("[%u]", tab_id),
browser())));
if (!get_zoom_settings_result)
@@ -1450,10 +1437,9 @@
get_zoom_settings_function->set_extension(extension_.get());
get_zoom_settings_function->set_has_callback(true);
- scoped_ptr<base::DictionaryValue> get_zoom_settings_result(
+ std::unique_ptr<base::DictionaryValue> get_zoom_settings_result(
utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
- get_zoom_settings_function.get(),
- base::StringPrintf("[%u]", tab_id),
+ get_zoom_settings_function.get(), base::StringPrintf("[%u]", tab_id),
browser())));
if (!get_zoom_settings_result)
diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.h b/chrome/browser/extensions/api/tabs/tabs_windows_api.h
index 4fe76e8c..78b4a42 100644
--- a/chrome/browser/extensions/api/tabs/tabs_windows_api.h
+++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_WINDOWS_API_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
@@ -46,8 +47,8 @@
}
static const bool kServiceIsNULLWhileTesting = true;
- scoped_ptr<TabsEventRouter> tabs_event_router_;
- scoped_ptr<WindowsEventRouter> windows_event_router_;
+ std::unique_ptr<TabsEventRouter> tabs_event_router_;
+ std::unique_ptr<WindowsEventRouter> windows_event_router_;
};
} // namespace extensions
diff --git a/chrome/browser/extensions/api/tabs/windows_event_router.cc b/chrome/browser/extensions/api/tabs/windows_event_router.cc
index 49463f0..ba1f49c 100644
--- a/chrome/browser/extensions/api/tabs/windows_event_router.cc
+++ b/chrome/browser/extensions/api/tabs/windows_event_router.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -194,7 +195,7 @@
if (!profile_->IsSameProfile(window_controller->profile()))
return;
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* window_dictionary =
window_controller->CreateWindowValue();
args->Append(window_dictionary);
@@ -210,7 +211,7 @@
return;
int window_id = window_controller->GetWindowId();
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(new base::FundamentalValue(window_id));
DispatchEvent(events::WINDOWS_ON_REMOVED, windows::OnRemoved::kEventName,
window_controller, std::move(args));
@@ -256,9 +257,9 @@
if (!HasEventListener(windows::OnFocusChanged::kEventName))
return;
- scoped_ptr<Event> event(new Event(events::WINDOWS_ON_FOCUS_CHANGED,
- windows::OnFocusChanged::kEventName,
- make_scoped_ptr(new base::ListValue())));
+ std::unique_ptr<Event> event(new Event(
+ events::WINDOWS_ON_FOCUS_CHANGED, windows::OnFocusChanged::kEventName,
+ base::WrapUnique(new base::ListValue())));
event->will_dispatch_callback =
base::Bind(&WillDispatchWindowFocusedEvent, window_controller);
EventRouter::Get(profile_)->BroadcastEvent(std::move(event));
@@ -267,8 +268,8 @@
void WindowsEventRouter::DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
WindowController* window_controller,
- scoped_ptr<base::ListValue> args) {
- scoped_ptr<Event> event(
+ std::unique_ptr<base::ListValue> args) {
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
event->restrict_to_browser_context = window_controller->profile();
event->will_dispatch_callback =
@@ -281,8 +282,8 @@
}
void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) {
- scoped_ptr<AppWindowController> controller(new AppWindowController(
- app_window, make_scoped_ptr(new AppBaseWindow(app_window)), profile_));
+ std::unique_ptr<AppWindowController> controller(new AppWindowController(
+ app_window, base::WrapUnique(new AppBaseWindow(app_window)), profile_));
app_windows_[app_window->session_id().id()] = std::move(controller);
}
diff --git a/chrome/browser/extensions/api/tabs/windows_event_router.h b/chrome/browser/extensions/api/tabs/windows_event_router.h
index 8ead6e1..7c7041d 100644
--- a/chrome/browser/extensions/api/tabs/windows_event_router.h
+++ b/chrome/browser/extensions/api/tabs/windows_event_router.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_EVENT_ROUTER_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/window_controller_list_observer.h"
@@ -73,7 +73,7 @@
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
WindowController* window_controller,
- scoped_ptr<base::ListValue> args);
+ std::unique_ptr<base::ListValue> args);
bool HasEventListener(const std::string& event_name);
void AddAppWindow(extensions::AppWindow* app_window);
@@ -91,7 +91,7 @@
// windows.onFocusChanged events with the same windowId.
int focused_window_id_;
- using AppWindowMap = std::map<int, scoped_ptr<AppWindowController>>;
+ using AppWindowMap = std::map<int, std::unique_ptr<AppWindowController>>;
// Map of application windows, the key to the session of the app window.
AppWindowMap app_windows_;
diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.cc b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
index 375f32a..8dd7ee6f 100644
--- a/chrome/browser/extensions/api/terminal/terminal_private_api.cc
+++ b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
@@ -67,7 +67,7 @@
return;
}
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(new base::FundamentalValue(tab_id));
args->Append(new base::FundamentalValue(terminal_id));
args->Append(new base::StringValue(output_type));
@@ -76,7 +76,7 @@
extensions::EventRouter* event_router =
extensions::EventRouter::Get(browser_context);
if (event_router) {
- scoped_ptr<extensions::Event> event(new extensions::Event(
+ std::unique_ptr<extensions::Event> event(new extensions::Event(
extensions::events::TERMINAL_PRIVATE_ON_PROCESS_OUTPUT,
terminal_private::OnProcessOutput::kEventName, std::move(args)));
event_router->DispatchEventToExtension(extension_id, std::move(event));
@@ -107,7 +107,7 @@
ExtensionFunction::ResponseAction
TerminalPrivateOpenTerminalProcessFunction::Run() {
- scoped_ptr<OpenTerminalProcess::Params> params(
+ std::unique_ptr<OpenTerminalProcess::Params> params(
OpenTerminalProcess::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -174,7 +174,7 @@
}
ExtensionFunction::ResponseAction TerminalPrivateSendInputFunction::Run() {
- scoped_ptr<SendInput::Params> params(SendInput::Params::Create(*args_));
+ std::unique_ptr<SendInput::Params> params(SendInput::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Registry lives on the FILE thread.
@@ -206,7 +206,7 @@
ExtensionFunction::ResponseAction
TerminalPrivateCloseTerminalProcessFunction::Run() {
- scoped_ptr<CloseTerminalProcess::Params> params(
+ std::unique_ptr<CloseTerminalProcess::Params> params(
CloseTerminalProcess::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -241,7 +241,7 @@
ExtensionFunction::ResponseAction
TerminalPrivateOnTerminalResizeFunction::Run() {
- scoped_ptr<OnTerminalResize::Params> params(
+ std::unique_ptr<OnTerminalResize::Params> params(
OnTerminalResize::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -273,7 +273,7 @@
TerminalPrivateAckOutputFunction::~TerminalPrivateAckOutputFunction() {}
ExtensionFunction::ResponseAction TerminalPrivateAckOutputFunction::Run() {
- scoped_ptr<AckOutput::Params> params(AckOutput::Params::Create(*args_));
+ std::unique_ptr<AckOutput::Params> params(AckOutput::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
content::WebContents* caller_contents = GetSenderWebContents();
diff --git a/chrome/browser/extensions/api/top_sites/top_sites_api.cc b/chrome/browser/extensions/api/top_sites/top_sites_api.cc
index c229cbb8..0917592 100644
--- a/chrome/browser/extensions/api/top_sites/top_sites_api.cc
+++ b/chrome/browser/extensions/api/top_sites/top_sites_api.cc
@@ -34,7 +34,7 @@
void TopSitesGetFunction::OnMostVisitedURLsAvailable(
const history::MostVisitedURLList& data) {
- scoped_ptr<base::ListValue> pages_value(new base::ListValue);
+ std::unique_ptr<base::ListValue> pages_value(new base::ListValue);
for (size_t i = 0; i < data.size(); i++) {
const history::MostVisitedURL& url = data[i];
if (!url.url.is_empty()) {
diff --git a/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc b/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
index 7561fad..f44d84b 100644
--- a/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
+++ b/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
@@ -74,7 +74,7 @@
// Without a callback the function will not generate a result.
get_top_sites_function->set_has_callback(true);
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
get_top_sites_function.get(), "[]", browser()));
base::ListValue* list;
ASSERT_TRUE(result->GetAsList(&list));
diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
index 1343ad3..27a14808 100644
--- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
+++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
@@ -77,7 +77,7 @@
// crbug.com/529474.
results->SetBoolean("a11ymode", keyboard::GetAccessibilityKeyboardEnabled());
results->SetBoolean("hotrodmode", keyboard::GetHotrodKeyboardEnabled());
- scoped_ptr<base::ListValue> features(new base::ListValue());
+ std::unique_ptr<base::ListValue> features(new base::ListValue());
features->AppendString(GenerateFeatureFlag(
"floatingvirtualkeyboard", keyboard::IsFloatingVirtualKeyboardEnabled()));
features->AppendString(
diff --git a/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc b/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
index 3a772db..2e51c36 100644
--- a/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
+++ b/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
@@ -6,6 +6,7 @@
#include <stdint.h>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/extension_apitest.h"
@@ -56,8 +57,9 @@
shill::kBroadcastAddressParameterThirdPartyVpn,
shill::kDomainSearchParameterThirdPartyVpn};
-void DoNothingFailureCallback(const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
+void DoNothingFailureCallback(
+ const std::string& error_name,
+ std::unique_ptr<base::DictionaryValue> error_data) {
EXPECT_EQ(true, false);
}
@@ -133,7 +135,7 @@
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
test_client_ = new TestShillThirdPartyVpnDriverClient();
DBusThreadManager::GetSetterForTesting()->SetShillThirdPartyVpnDriverClient(
- make_scoped_ptr(test_client_));
+ base::WrapUnique(test_client_));
}
void AddNetworkProfileForUser() {
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index c9f9cce..9e72eca 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -448,7 +448,7 @@
}
bool WebNavigationGetFrameFunction::RunSync() {
- scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_));
+ std::unique_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
int tab_id = params->details.tab_id;
int frame_id = params->details.frame_id;
@@ -495,7 +495,8 @@
}
bool WebNavigationGetAllFramesFunction::RunSync() {
- scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_));
+ std::unique_ptr<GetAllFrames::Params> params(
+ GetAllFrames::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
int tab_id = params->details.tab_id;
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
index c0cfe05..e583c35 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
@@ -210,7 +210,7 @@
static const bool kServiceIsNULLWhileTesting = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<WebNavigationEventRouter> web_navigation_event_router_;
+ std::unique_ptr<WebNavigationEventRouter> web_navigation_event_router_;
DISALLOW_COPY_AND_ASSIGN(WebNavigationAPI);
};
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
index 05f413c..69d017a 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
@@ -44,7 +44,7 @@
// Dispatches events to the extension message service.
void DispatchEvent(content::BrowserContext* browser_context,
- scoped_ptr<Event> event,
+ std::unique_ptr<Event> event,
const GURL& url) {
EventFilteringInfo info;
info.SetURL(url);
@@ -76,7 +76,7 @@
ExtensionApiFrameIdMap::GetParentFrameId(navigation_handle);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_BEFORE_NAVIGATE,
web_navigation::OnBeforeNavigate::kEventName,
web_navigation::OnBeforeNavigate::Create(details)));
@@ -98,7 +98,7 @@
if (navigation_handle->IsSrcdoc())
url = GURL(content::kAboutSrcDocURL);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents));
dict->SetString(keys::kUrlKey, url.spec());
@@ -132,7 +132,7 @@
dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
args->Append(dict);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
DispatchEvent(navigation_handle->GetWebContents()->GetBrowserContext(),
std::move(event), url);
@@ -149,7 +149,7 @@
details.frame_id = ExtensionApiFrameIdMap::GetFrameId(frame_host);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_DOM_CONTENT_LOADED,
web_navigation::OnDOMContentLoaded::kEventName,
web_navigation::OnDOMContentLoaded::Create(details)));
@@ -167,7 +167,7 @@
details.frame_id = ExtensionApiFrameIdMap::GetFrameId(frame_host);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_COMPLETED,
web_navigation::OnCompleted::kEventName,
web_navigation::OnCompleted::Create(details)));
@@ -197,7 +197,7 @@
details.tab_id = ExtensionTabUtil::GetTabId(target_web_contents);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_CREATED_NAVIGATION_TARGET,
web_navigation::OnCreatedNavigationTarget::kEventName,
web_navigation::OnCreatedNavigationTarget::Create(details)));
@@ -217,7 +217,7 @@
details.error = net::ErrorToString(error_code);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_ERROR_OCCURRED,
web_navigation::OnErrorOccurred::kEventName,
web_navigation::OnErrorOccurred::Create(details)));
@@ -236,7 +236,7 @@
: net::ErrorToString(net::ERR_ABORTED);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_ERROR_OCCURRED,
web_navigation::OnErrorOccurred::kEventName,
web_navigation::OnErrorOccurred::Create(details)));
@@ -254,7 +254,7 @@
details.tab_id = ExtensionTabUtil::GetTabId(new_web_contents);
details.time_stamp = MilliSecondsFromTime(base::Time::Now());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEB_NAVIGATION_ON_TAB_REPLACED,
web_navigation::OnTabReplaced::kEventName,
web_navigation::OnTabReplaced::Create(details)));
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index 46d1020d..6654a0e0 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -364,7 +364,7 @@
private:
scoped_refptr<TestNavigationListener> test_navigation_listener_;
- scoped_ptr<TestResourceDispatcherHostDelegate>
+ std::unique_ptr<TestResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
DISALLOW_COPY_AND_ASSIGN(WebNavigationApiTest);
diff --git a/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc b/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc
index 4e8562c..4aa4c1f0 100644
--- a/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc
+++ b/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc
@@ -61,7 +61,7 @@
const std::string& extension_id,
const GURL& url,
const std::string& api_call,
- scoped_ptr<base::DictionaryValue> details) {
+ std::unique_ptr<base::DictionaryValue> details) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(
browser_context)) {
diff --git a/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h b/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h
index 609bf89b..81d1c112 100644
--- a/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h
+++ b/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_CHROME_EXTENSION_WEB_REQUEST_EVENT_ROUTER_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_CHROME_EXTENSION_WEB_REQUEST_EVENT_ROUTER_DELEGATE_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "extensions/browser/api/web_request/web_request_event_router_delegate.h"
class ChromeExtensionWebRequestEventRouterDelegate
@@ -15,12 +16,13 @@
~ChromeExtensionWebRequestEventRouterDelegate() override;
// WebRequestEventRouterDelegate implementation.
- void LogExtensionActivity(content::BrowserContext* browser_context,
- bool is_incognito,
- const std::string& extension_id,
- const GURL& url,
- const std::string& api_call,
- scoped_ptr<base::DictionaryValue> details) override;
+ void LogExtensionActivity(
+ content::BrowserContext* browser_context,
+ bool is_incognito,
+ const std::string& extension_id,
+ const GURL& url,
+ const std::string& api_call,
+ std::unique_ptr<base::DictionaryValue> details) override;
void NotifyWebRequestWithheld(int render_process_id,
int render_frame_id,
const std::string& extension_id) override;
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index 0b4d32b4..101825b 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <queue>
#include <tuple>
@@ -16,7 +17,7 @@
#include "base/json/json_string_value_serializer.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
@@ -218,8 +219,8 @@
TestIPCSender ipc_sender_;
scoped_refptr<EventRouterForwarder> event_router_;
scoped_refptr<InfoMap> extension_info_map_;
- scoped_ptr<ChromeNetworkDelegate> network_delegate_;
- scoped_ptr<net::TestURLRequestContext> context_;
+ std::unique_ptr<ChromeNetworkDelegate> network_delegate_;
+ std::unique_ptr<net::TestURLRequestContext> context_;
};
// Tests that we handle disagreements among extensions about responses to
@@ -243,13 +244,13 @@
net::URLRequestJobFactoryImpl job_factory;
job_factory.SetProtocolHandler(
url::kAboutScheme,
- make_scoped_ptr(new about_handler::AboutProtocolHandler()));
+ base::WrapUnique(new about_handler::AboutProtocolHandler()));
context_->set_job_factory(&job_factory);
GURL redirect_url("about:redirected");
GURL not_chosen_redirect_url("about:not_chosen");
- scoped_ptr<net::URLRequest> request(context_->CreateRequest(
+ std::unique_ptr<net::URLRequest> request(context_->CreateRequest(
GURL("about:blank"), net::DEFAULT_PRIORITY, &delegate_));
{
// onBeforeRequest will be dispatched twice initially. The second response -
@@ -304,7 +305,7 @@
}
// Now test the same thing but the extensions answer in reverse order.
- scoped_ptr<net::URLRequest> request2(context_->CreateRequest(
+ std::unique_ptr<net::URLRequest> request2(context_->CreateRequest(
GURL("about:blank"), net::DEFAULT_PRIORITY, &delegate_));
{
ExtensionWebRequestEventRouter::EventResponse* response = NULL;
@@ -378,8 +379,8 @@
ipc_sender_factory.GetWeakPtr());
GURL request_url("about:blank");
- scoped_ptr<net::URLRequest> request(context_->CreateRequest(
- request_url, net::DEFAULT_PRIORITY, &delegate_));
+ std::unique_ptr<net::URLRequest> request(
+ context_->CreateRequest(request_url, net::DEFAULT_PRIORITY, &delegate_));
// onBeforeRequest will be dispatched twice. The second response -
// the redirect - would win, since it has a later |install_time|, but
@@ -446,8 +447,8 @@
kEventName2 + "/1", filter, 0, 0, 0, ipc_sender_factory.GetWeakPtr());
GURL request_url("about:blank");
- scoped_ptr<net::URLRequest> request(context_->CreateRequest(
- request_url, net::DEFAULT_PRIORITY, &delegate_));
+ std::unique_ptr<net::URLRequest> request(
+ context_->CreateRequest(request_url, net::DEFAULT_PRIORITY, &delegate_));
ExtensionWebRequestEventRouter::EventResponse* response = NULL;
@@ -509,23 +510,23 @@
const std::vector<char>& bytes_2) {
// The request URL can be arbitrary but must have an HTTP or HTTPS scheme.
GURL request_url("http://www.example.com");
- scoped_ptr<net::URLRequest> request(context_->CreateRequest(
- request_url, net::DEFAULT_PRIORITY, &delegate_));
+ std::unique_ptr<net::URLRequest> request(
+ context_->CreateRequest(request_url, net::DEFAULT_PRIORITY, &delegate_));
request->set_method(method);
if (content_type != NULL) {
request->SetExtraRequestHeaderByName(net::HttpRequestHeaders::kContentType,
content_type,
true /* overwrite */);
}
- std::vector<scoped_ptr<net::UploadElementReader>> element_readers;
- element_readers.push_back(make_scoped_ptr(
+ std::vector<std::unique_ptr<net::UploadElementReader>> element_readers;
+ element_readers.push_back(base::WrapUnique(
new net::UploadBytesElementReader(&(bytes_1[0]), bytes_1.size())));
- element_readers.push_back(make_scoped_ptr(new net::UploadFileElementReader(
+ element_readers.push_back(base::WrapUnique(new net::UploadFileElementReader(
base::ThreadTaskRunnerHandle::Get().get(), base::FilePath(), 0, 0,
base::Time())));
- element_readers.push_back(make_scoped_ptr(
+ element_readers.push_back(base::WrapUnique(
new net::UploadBytesElementReader(&(bytes_2[0]), bytes_2.size())));
- request->set_upload(make_scoped_ptr(
+ request->set_upload(base::WrapUnique(
new net::ElementsUploadDataStream(std::move(element_readers), 0)));
ipc_sender_.PushTask(base::Bind(&base::DoNothing));
request->Start();
@@ -586,7 +587,8 @@
// Contents of formData.
const char kFormData[] =
"{\"A\":[\"test text\"],\"B\":[\"\"],\"C\":[\"test password\"]}";
- scoped_ptr<const base::Value> form_data = base::JSONReader::Read(kFormData);
+ std::unique_ptr<const base::Value> form_data =
+ base::JSONReader::Read(kFormData);
ASSERT_TRUE(form_data.get() != NULL);
ASSERT_TRUE(form_data->GetType() == base::Value::TYPE_DICTIONARY);
// Contents of raw.
@@ -803,7 +805,7 @@
const GURL request_url("http://www.example.com");
for (size_t i = 0; i < arraysize(kMethods); ++i) {
- scoped_ptr<net::URLRequest> request(context_->CreateRequest(
+ std::unique_ptr<net::URLRequest> request(context_->CreateRequest(
request_url, net::DEFAULT_PRIORITY, &delegate_));
request->set_method(kMethods[i]);
ipc_sender_.PushTask(base::Bind(&base::DoNothing));
@@ -893,9 +895,9 @@
TestIPCSender ipc_sender_;
scoped_refptr<EventRouterForwarder> event_router_;
scoped_refptr<InfoMap> extension_info_map_;
- scoped_ptr<ChromeNetworkDelegate> network_delegate_;
- scoped_ptr<net::MockHostResolver> host_resolver_;
- scoped_ptr<net::TestURLRequestContext> context_;
+ std::unique_ptr<ChromeNetworkDelegate> network_delegate_;
+ std::unique_ptr<net::MockHostResolver> host_resolver_;
+ std::unique_ptr<net::TestURLRequestContext> context_;
};
TEST_P(ExtensionWebRequestHeaderModificationTest, TestModifications) {
@@ -925,8 +927,8 @@
ipc_sender_factory.GetWeakPtr());
GURL request_url("http://doesnotexist/does_not_exist.html");
- scoped_ptr<net::URLRequest> request(context_->CreateRequest(
- request_url, net::DEFAULT_PRIORITY, &delegate_));
+ std::unique_ptr<net::URLRequest> request(
+ context_->CreateRequest(request_url, net::DEFAULT_PRIORITY, &delegate_));
// Initialize headers available before extensions are notified of the
// onBeforeSendHeaders event.
@@ -1269,7 +1271,8 @@
unsigned char char_value[] = {'1', '2', '3', 0xFE, 0xD1};
std::string string_value(reinterpret_cast<char *>(char_value), 5);
- scoped_ptr<base::ListValue> converted_list(StringToCharList(string_value));
+ std::unique_ptr<base::ListValue> converted_list(
+ StringToCharList(string_value));
EXPECT_TRUE(list_value.Equals(converted_list.get()));
std::string converted_string;
@@ -1280,9 +1283,8 @@
TEST(ExtensionWebRequestHelpersTest, TestCalculateOnBeforeRequestDelta) {
const bool cancel = true;
const GURL localhost("http://localhost");
- scoped_ptr<EventResponseDelta> delta(
- CalculateOnBeforeRequestDelta("extid", base::Time::Now(),
- cancel, localhost));
+ std::unique_ptr<EventResponseDelta> delta(CalculateOnBeforeRequestDelta(
+ "extid", base::Time::Now(), cancel, localhost));
ASSERT_TRUE(delta.get());
EXPECT_TRUE(delta->cancel);
EXPECT_EQ(localhost, delta->new_url);
@@ -1300,9 +1302,9 @@
new_headers_added.AddHeadersFromString("key1: value1\r\n"
"key3: value3\r\n"
"key2: value2\r\n");
- scoped_ptr<EventResponseDelta> delta_added(
+ std::unique_ptr<EventResponseDelta> delta_added(
CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), cancel,
- &old_headers, &new_headers_added));
+ &old_headers, &new_headers_added));
ASSERT_TRUE(delta_added.get());
EXPECT_TRUE(delta_added->cancel);
ASSERT_TRUE(delta_added->modified_request_headers.GetHeader("key3", &value));
@@ -1311,9 +1313,9 @@
// Test deleting a header.
net::HttpRequestHeaders new_headers_deleted;
new_headers_deleted.AddHeadersFromString("key1: value1\r\n");
- scoped_ptr<EventResponseDelta> delta_deleted(
+ std::unique_ptr<EventResponseDelta> delta_deleted(
CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), cancel,
- &old_headers, &new_headers_deleted));
+ &old_headers, &new_headers_deleted));
ASSERT_TRUE(delta_deleted.get());
ASSERT_EQ(1u, delta_deleted->deleted_request_headers.size());
ASSERT_EQ("key2", delta_deleted->deleted_request_headers.front());
@@ -1322,9 +1324,9 @@
net::HttpRequestHeaders new_headers_modified;
new_headers_modified.AddHeadersFromString("key1: value1\r\n"
"key2: value3\r\n");
- scoped_ptr<EventResponseDelta> delta_modified(
+ std::unique_ptr<EventResponseDelta> delta_modified(
CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), cancel,
- &old_headers, &new_headers_modified));
+ &old_headers, &new_headers_modified));
ASSERT_TRUE(delta_modified.get());
EXPECT_TRUE(delta_modified->deleted_request_headers.empty());
ASSERT_TRUE(
@@ -1338,9 +1340,9 @@
new_headers_modified2.AddHeadersFromString("key1: value1\r\n"
"key2: value2\r\n"
"key2: value3\r\n");
- scoped_ptr<EventResponseDelta> delta_modified2(
+ std::unique_ptr<EventResponseDelta> delta_modified2(
CalculateOnBeforeSendHeadersDelta("extid", base::Time::Now(), cancel,
- &old_headers, &new_headers_modified));
+ &old_headers, &new_headers_modified));
ASSERT_TRUE(delta_modified2.get());
EXPECT_TRUE(delta_modified2->deleted_request_headers.empty());
ASSERT_TRUE(
@@ -1370,13 +1372,9 @@
new_headers.push_back(ResponseHeader("Key5", "Value5, end5")); // Unchanged
GURL effective_new_url;
- scoped_ptr<EventResponseDelta> delta(
- CalculateOnHeadersReceivedDelta("extid",
- base::Time::Now(),
- cancel,
- effective_new_url,
- base_headers.get(),
- &new_headers));
+ std::unique_ptr<EventResponseDelta> delta(CalculateOnHeadersReceivedDelta(
+ "extid", base::Time::Now(), cancel, effective_new_url, base_headers.get(),
+ &new_headers));
ASSERT_TRUE(delta.get());
EXPECT_TRUE(delta->cancel);
EXPECT_EQ(2u, delta->added_response_headers.size());
@@ -1396,12 +1394,11 @@
base::string16 username = base::ASCIIToUTF16("foo");
base::string16 password = base::ASCIIToUTF16("bar");
- scoped_ptr<net::AuthCredentials> credentials(
+ std::unique_ptr<net::AuthCredentials> credentials(
new net::AuthCredentials(username, password));
- scoped_ptr<EventResponseDelta> delta(
- CalculateOnAuthRequiredDelta("extid", base::Time::Now(), cancel,
- &credentials));
+ std::unique_ptr<EventResponseDelta> delta(CalculateOnAuthRequiredDelta(
+ "extid", base::Time::Now(), cancel, &credentials));
ASSERT_TRUE(delta.get());
EXPECT_TRUE(delta->cancel);
ASSERT_TRUE(delta->auth_credentials.get());
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index ff1fa0b8..82727fc 100644
--- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -4,6 +4,7 @@
#include "base/command_line.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -528,7 +529,7 @@
// receive the event.
EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
runner->set_default_bubble_close_action_for_testing(
- make_scoped_ptr(new ToolbarActionsBarBubbleDelegate::CloseAction(
+ base::WrapUnique(new ToolbarActionsBarBubbleDelegate::CloseAction(
ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE)));
runner->RunAction(extension, true);
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
index b69df1d5..6addaada 100644
--- a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/api/web_request/web_request_permissions.h"
-
#include <stddef.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "chrome/common/extensions/extension_test_util.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "extensions/browser/api/web_request/web_request_permissions.h"
#include "extensions/browser/info_map.h"
#include "extensions/common/constants.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -104,16 +104,16 @@
// Check that requests are rejected based on the destination
for (size_t i = 0; i < arraysize(sensitive_urls); ++i) {
GURL sensitive_url(sensitive_urls[i]);
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
- sensitive_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context.CreateRequest(sensitive_url, net::DEFAULT_PRIORITY, NULL));
EXPECT_TRUE(WebRequestPermissions::HideRequest(
extension_info_map_.get(), request.get())) << sensitive_urls[i];
}
// Check that requests are accepted if they don't touch sensitive urls.
for (size_t i = 0; i < arraysize(non_sensitive_urls); ++i) {
GURL non_sensitive_url(non_sensitive_urls[i]);
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
- non_sensitive_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context.CreateRequest(non_sensitive_url, net::DEFAULT_PRIORITY, NULL));
EXPECT_FALSE(WebRequestPermissions::HideRequest(
extension_info_map_.get(), request.get())) << non_sensitive_urls[i];
}
@@ -122,8 +122,8 @@
// WebStore.
// Normally this request is not protected:
GURL non_sensitive_url("http://www.google.com/test.js");
- scoped_ptr<net::URLRequest> non_sensitive_request(context.CreateRequest(
- non_sensitive_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> non_sensitive_request(
+ context.CreateRequest(non_sensitive_url, net::DEFAULT_PRIORITY, NULL));
EXPECT_FALSE(WebRequestPermissions::HideRequest(
extension_info_map_.get(), non_sensitive_request.get()));
// If the origin is labeled by the WebStoreAppId, it becomes protected.
@@ -131,8 +131,8 @@
int process_id = 42;
int site_instance_id = 23;
int view_id = 17;
- scoped_ptr<net::URLRequest> sensitive_request(context.CreateRequest(
- non_sensitive_url, net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> sensitive_request(
+ context.CreateRequest(non_sensitive_url, net::DEFAULT_PRIORITY, NULL));
ResourceRequestInfo::AllocateForTesting(sensitive_request.get(),
content::RESOURCE_TYPE_SCRIPT,
NULL,
@@ -153,7 +153,7 @@
TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest,
TestCanExtensionAccessURL_HostPermissions) {
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
+ std::unique_ptr<net::URLRequest> request(context.CreateRequest(
GURL("http://example.com"), net::DEFAULT_PRIORITY, NULL));
EXPECT_EQ(PermissionsData::ACCESS_ALLOWED,
diff --git a/chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.cc b/chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.cc
index 981a8e3b..c99c5737 100644
--- a/chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.cc
+++ b/chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.cc
@@ -19,7 +19,7 @@
// TODO(lazyboy): Add checks similar to
// WebViewInternalExtensionFunction::RunAsyncSafe(WebViewGuest*).
bool ChromeWebViewInternalContextMenusCreateFunction::RunAsync() {
- scoped_ptr<webview::ContextMenusCreate::Params> params(
+ std::unique_ptr<webview::ContextMenusCreate::Params> params(
webview::ContextMenusCreate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -52,7 +52,7 @@
}
bool ChromeWebViewInternalContextMenusUpdateFunction::RunAsync() {
- scoped_ptr<webview::ContextMenusUpdate::Params> params(
+ std::unique_ptr<webview::ContextMenusUpdate::Params> params(
webview::ContextMenusUpdate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -78,7 +78,7 @@
}
bool ChromeWebViewInternalContextMenusRemoveFunction::RunAsync() {
- scoped_ptr<webview::ContextMenusRemove::Params> params(
+ std::unique_ptr<webview::ContextMenusRemove::Params> params(
webview::ContextMenusRemove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -117,7 +117,7 @@
}
bool ChromeWebViewInternalContextMenusRemoveAllFunction::RunAsync() {
- scoped_ptr<webview::ContextMenusRemoveAll::Params> params(
+ std::unique_ptr<webview::ContextMenusRemoveAll::Params> params(
webview::ContextMenusRemoveAll::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -142,7 +142,7 @@
bool ChromeWebViewInternalShowContextMenuFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<webview::ShowContextMenu::Params> params(
+ std::unique_ptr<webview::ShowContextMenu::Params> params(
webview::ShowContextMenu::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
index 7d8a25b..dfc6882c 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_runner_util.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
@@ -92,9 +93,9 @@
const std::string& extension_id = extension->id();
if (router->ExtensionHasEventListener(extension_id, kEventName) &&
extension->permissions_data()->HasAPIPermission("webrtcAudioPrivate")) {
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::WEBRTC_AUDIO_PRIVATE_ON_SINKS_CHANGED, kEventName,
- make_scoped_ptr(new base::ListValue())));
+ base::WrapUnique(new base::ListValue())));
router->DispatchEventToExtension(extension_id, std::move(event));
}
}
@@ -116,7 +117,7 @@
return;
}
- scoped_ptr<AudioDeviceNames> device_names(new AudioDeviceNames);
+ std::unique_ptr<AudioDeviceNames> device_names(new AudioDeviceNames);
AudioManager::Get()->GetAudioOutputDeviceNames(device_names.get());
BrowserThread::PostTask(
@@ -126,7 +127,7 @@
}
void WebrtcAudioPrivateFunction::OnOutputDeviceNames(
- scoped_ptr<AudioDeviceNames> device_names) {
+ std::unique_ptr<AudioDeviceNames> device_names) {
NOTREACHED();
}
@@ -222,7 +223,7 @@
}
void WebrtcAudioPrivateGetSinksFunction::OnOutputDeviceNames(
- scoped_ptr<AudioDeviceNames> raw_ids) {
+ std::unique_ptr<AudioDeviceNames> raw_ids) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
std::vector<wap::SinkInfo> results;
@@ -258,7 +259,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
InitDeviceIDSalt();
- scoped_ptr<wap::GetActiveSink::Params> params(
+ std::unique_ptr<wap::GetActiveSink::Params> params(
wap::GetActiveSink::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -313,7 +314,7 @@
bool WebrtcAudioPrivateSetActiveSinkFunction::RunAsync() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- scoped_ptr<wap::SetActiveSink::Params> params(
+ std::unique_ptr<wap::SetActiveSink::Params> params(
wap::SetActiveSink::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -363,7 +364,7 @@
}
void WebrtcAudioPrivateSetActiveSinkFunction::OnOutputDeviceNames(
- scoped_ptr<AudioDeviceNames> device_names) {
+ std::unique_ptr<AudioDeviceNames> device_names) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
std::string raw_sink_id;
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
index 20370e5..2f683a7 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
@@ -59,7 +59,7 @@
// Must override this if you call GetOutputDeviceNames. Called on IO thread.
virtual void OnOutputDeviceNames(
- scoped_ptr<media::AudioDeviceNames> device_names);
+ std::unique_ptr<media::AudioDeviceNames> device_names);
// Retrieve the list of AudioOutputController objects. Calls back
// via OnControllerList.
@@ -119,7 +119,7 @@
bool RunAsync() override;
void DoQuery();
void OnOutputDeviceNames(
- scoped_ptr<media::AudioDeviceNames> raw_ids) override;
+ std::unique_ptr<media::AudioDeviceNames> raw_ids) override;
void DoneOnUIThread();
};
@@ -156,7 +156,7 @@
const content::RenderProcessHost::AudioOutputControllerList& controllers)
override;
void OnOutputDeviceNames(
- scoped_ptr<media::AudioDeviceNames> device_names) override;
+ std::unique_ptr<media::AudioDeviceNames> device_names) override;
void SwitchDone();
void DoneOnUIThread();
@@ -218,7 +218,7 @@
// Accessed from UI thread and device thread, but only on one at a
// time, no locking needed.
- scoped_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_;
+ std::unique_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_;
// Audio sources (input devices). Filled in by DoWorkOnDeviceThread.
media::AudioDeviceNames source_devices_;
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
index 9eefbe3..79ababe 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
@@ -103,21 +103,19 @@
scoped_refptr<WebrtcAudioPrivateGetActiveSinkFunction> function =
new WebrtcAudioPrivateGetActiveSinkFunction();
function->set_source_url(source_url_);
- scoped_ptr<base::Value> result(
- RunFunctionAndReturnSingleResult(function.get(),
- parameter_string,
- browser()));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ function.get(), parameter_string, browser()));
std::string device_id;
result->GetAsString(&device_id);
return device_id;
}
- scoped_ptr<base::Value> InvokeGetSinks(base::ListValue** sink_list) {
+ std::unique_ptr<base::Value> InvokeGetSinks(base::ListValue** sink_list) {
scoped_refptr<WebrtcAudioPrivateGetSinksFunction> function =
new WebrtcAudioPrivateGetSinksFunction();
function->set_source_url(source_url_);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnSingleResult(function.get(), "[]", browser()));
result->GetAsList(sink_list);
return result;
@@ -181,7 +179,7 @@
GetAudioDeviceNames(&AudioManager::GetAudioOutputDeviceNames, &devices);
base::ListValue* sink_list = NULL;
- scoped_ptr<base::Value> result = InvokeGetSinks(&sink_list);
+ std::unique_ptr<base::Value> result = InvokeGetSinks(&sink_list);
std::string result_string;
JSONWriter::Write(*result, &result_string);
@@ -238,10 +236,8 @@
scoped_refptr<WebrtcAudioPrivateGetActiveSinkFunction> function =
new WebrtcAudioPrivateGetActiveSinkFunction();
function->set_source_url(source_url_);
- scoped_ptr<base::Value> result(
- RunFunctionAndReturnSingleResult(function.get(),
- parameter_string,
- browser()));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ function.get(), parameter_string, browser()));
std::string result_string;
JSONWriter::Write(*result, &result_string);
@@ -280,7 +276,7 @@
// where we set the active sink to each of the different available
// sinks in turn.
base::ListValue* sink_list = NULL;
- scoped_ptr<base::Value> result = InvokeGetSinks(&sink_list);
+ std::unique_ptr<base::Value> result = InvokeGetSinks(&sink_list);
ASSERT_TRUE(StartEmbeddedTestServer());
@@ -314,7 +310,7 @@
scoped_refptr<WebrtcAudioPrivateSetActiveSinkFunction> function =
new WebrtcAudioPrivateSetActiveSinkFunction();
function->set_source_url(source_url_);
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
function.get(), parameter_string, browser()));
// The function was successful if the above invocation doesn't
// fail. Just for kicks, also check that it returns no result.
@@ -357,10 +353,8 @@
std::string parameter_string;
JSONWriter::Write(parameters, ¶meter_string);
- scoped_ptr<base::Value> result(
- RunFunctionAndReturnSingleResult(function.get(),
- parameter_string,
- browser()));
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ function.get(), parameter_string, browser()));
std::string result_string;
JSONWriter::Write(*result, &result_string);
VLOG(2) << "Results: " << result_string;
diff --git a/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc b/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc
index 014de44..db9ae65 100644
--- a/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_desktop_capture_private/webrtc_desktop_capture_private_api.cc
@@ -47,7 +47,7 @@
args_->Remove(0, NULL);
- scoped_ptr<Params> params = Params::Create(*args_);
+ std::unique_ptr<Params> params = Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params.get());
content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(
diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
index c7a4141e..4d0ec4e9 100644
--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
@@ -151,7 +151,8 @@
}
bool WebrtcLoggingPrivateSetMetaDataFunction::RunAsync() {
- scoped_ptr<SetMetaData::Params> params(SetMetaData::Params::Create(*args_));
+ std::unique_ptr<SetMetaData::Params> params(
+ SetMetaData::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WebRtcLoggingHandlerHost::GenericDoneCallback callback;
@@ -160,7 +161,7 @@
if (!webrtc_logging_handler_host.get())
return false;
- scoped_ptr<MetaDataMap> meta_data(new MetaDataMap());
+ std::unique_ptr<MetaDataMap> meta_data(new MetaDataMap());
for (const MetaDataEntry& entry : params->meta_data)
(*meta_data.get())[entry.key] = entry.value;
@@ -172,7 +173,7 @@
}
bool WebrtcLoggingPrivateStartFunction::RunAsync() {
- scoped_ptr<Start::Params> params(Start::Params::Create(*args_));
+ std::unique_ptr<Start::Params> params(Start::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WebRtcLoggingHandlerHost::GenericDoneCallback callback;
@@ -189,7 +190,7 @@
}
bool WebrtcLoggingPrivateSetUploadOnRenderCloseFunction::RunAsync() {
- scoped_ptr<SetUploadOnRenderClose::Params> params(
+ std::unique_ptr<SetUploadOnRenderClose::Params> params(
SetUploadOnRenderClose::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -205,7 +206,7 @@
}
bool WebrtcLoggingPrivateStopFunction::RunAsync() {
- scoped_ptr<Stop::Params> params(Stop::Params::Create(*args_));
+ std::unique_ptr<Stop::Params> params(Stop::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WebRtcLoggingHandlerHost::GenericDoneCallback callback;
@@ -222,7 +223,7 @@
}
bool WebrtcLoggingPrivateStoreFunction::RunAsync() {
- scoped_ptr<Store::Params> params(Store::Params::Create(*args_));
+ std::unique_ptr<Store::Params> params(Store::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WebRtcLoggingHandlerHost::GenericDoneCallback callback;
@@ -242,7 +243,8 @@
}
bool WebrtcLoggingPrivateUploadStoredFunction::RunAsync() {
- scoped_ptr<UploadStored::Params> params(UploadStored::Params::Create(*args_));
+ std::unique_ptr<UploadStored::Params> params(
+ UploadStored::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
scoped_refptr<WebRtcLoggingHandlerHost> logging_handler(
@@ -264,7 +266,7 @@
}
bool WebrtcLoggingPrivateUploadFunction::RunAsync() {
- scoped_ptr<Upload::Params> params(Upload::Params::Create(*args_));
+ std::unique_ptr<Upload::Params> params(Upload::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
scoped_refptr<WebRtcLoggingHandlerHost> logging_handler(
@@ -282,7 +284,7 @@
}
bool WebrtcLoggingPrivateDiscardFunction::RunAsync() {
- scoped_ptr<Discard::Params> params(Discard::Params::Create(*args_));
+ std::unique_ptr<Discard::Params> params(Discard::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WebRtcLoggingHandlerHost::GenericDoneCallback callback;
@@ -299,7 +301,8 @@
}
bool WebrtcLoggingPrivateStartRtpDumpFunction::RunAsync() {
- scoped_ptr<StartRtpDump::Params> params(StartRtpDump::Params::Create(*args_));
+ std::unique_ptr<StartRtpDump::Params> params(
+ StartRtpDump::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (!params->incoming && !params->outgoing) {
@@ -341,7 +344,8 @@
}
bool WebrtcLoggingPrivateStopRtpDumpFunction::RunAsync() {
- scoped_ptr<StopRtpDump::Params> params(StopRtpDump::Params::Create(*args_));
+ std::unique_ptr<StopRtpDump::Params> params(
+ StopRtpDump::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (!params->incoming && !params->outgoing) {
@@ -380,7 +384,7 @@
return false;
}
- scoped_ptr<StartAudioDebugRecordings::Params> params(
+ std::unique_ptr<StartAudioDebugRecordings::Params> params(
StartAudioDebugRecordings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -414,7 +418,7 @@
return false;
}
- scoped_ptr<StopAudioDebugRecordings::Params> params(
+ std::unique_ptr<StopAudioDebugRecordings::Params> params(
StopAudioDebugRecordings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc
index bc739df..4a6c988 100644
--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_apitest.cc
@@ -91,7 +91,7 @@
bool RunFunction(UIThreadExtensionFunction* function,
const base::ListValue& parameters,
bool expect_results) {
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
function, ParamsToString(parameters), browser()));
if (expect_results) {
EXPECT_TRUE(result.get());
diff --git a/chrome/browser/extensions/api/webstore/webstore_api.h b/chrome/browser/extensions/api/webstore/webstore_api.h
index 95ebdb6..378d581b 100644
--- a/chrome/browser/extensions/api/webstore/webstore_api.h
+++ b/chrome/browser/extensions/api/webstore/webstore_api.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WEBSTORE_API_H_
#include <list>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/install_observer.h"
#include "chrome/common/extensions/api/webstore/webstore_api_constants.h"
@@ -93,7 +93,7 @@
ObservedInstallInfoList download_progress_listeners_;
ObservedInstallInfoList install_stage_listeners_;
content::BrowserContext* browser_context_;
- scoped_ptr<ScopedObserver<InstallTracker, InstallObserver> >
+ std::unique_ptr<ScopedObserver<InstallTracker, InstallObserver>>
install_observer_;
DISALLOW_COPY_AND_ASSIGN(WebstoreAPI);
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
index 4bb451b..4f30861 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -64,9 +64,11 @@
PendingApprovals();
~PendingApprovals();
- void PushApproval(scoped_ptr<WebstoreInstaller::Approval> approval);
- scoped_ptr<WebstoreInstaller::Approval> PopApproval(
- Profile* profile, const std::string& id);
+ void PushApproval(std::unique_ptr<WebstoreInstaller::Approval> approval);
+ std::unique_ptr<WebstoreInstaller::Approval> PopApproval(
+ Profile* profile,
+ const std::string& id);
+
private:
typedef ScopedVector<WebstoreInstaller::Approval> ApprovalList;
@@ -79,21 +81,22 @@
PendingApprovals::~PendingApprovals() {}
void PendingApprovals::PushApproval(
- scoped_ptr<WebstoreInstaller::Approval> approval) {
+ std::unique_ptr<WebstoreInstaller::Approval> approval) {
approvals_.push_back(approval.release());
}
-scoped_ptr<WebstoreInstaller::Approval> PendingApprovals::PopApproval(
- Profile* profile, const std::string& id) {
+std::unique_ptr<WebstoreInstaller::Approval> PendingApprovals::PopApproval(
+ Profile* profile,
+ const std::string& id) {
for (size_t i = 0; i < approvals_.size(); ++i) {
WebstoreInstaller::Approval* approval = approvals_[i];
if (approval->extension_id == id &&
profile->IsSameProfile(approval->profile)) {
approvals_.weak_erase(approvals_.begin() + i);
- return scoped_ptr<WebstoreInstaller::Approval>(approval);
+ return std::unique_ptr<WebstoreInstaller::Approval>(approval);
}
}
- return scoped_ptr<WebstoreInstaller::Approval>();
+ return std::unique_ptr<WebstoreInstaller::Approval>();
}
api::webstore_private::Result WebstoreInstallHelperResultToApiResult(
@@ -161,9 +164,9 @@
}
// static
-scoped_ptr<WebstoreInstaller::Approval>
-WebstorePrivateApi::PopApprovalForTesting(
- Profile* profile, const std::string& extension_id) {
+std::unique_ptr<WebstoreInstaller::Approval>
+WebstorePrivateApi::PopApprovalForTesting(Profile* profile,
+ const std::string& extension_id) {
return g_pending_approvals.Get().PopApproval(profile, extension_id);
}
@@ -315,7 +318,7 @@
// This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in
// the future we may also want to add time-based expiration, where a whitelist
// entry is only valid for some number of minutes.
- scoped_ptr<WebstoreInstaller::Approval> approval(
+ std::unique_ptr<WebstoreInstaller::Approval> approval(
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
chrome_details_.GetProfile(), details().id,
std::move(parsed_manifest_), false));
@@ -372,7 +375,7 @@
CreateResults(api::webstore_private::RESULT_EMPTY_STRING));
}
-scoped_ptr<base::ListValue>
+std::unique_ptr<base::ListValue>
WebstorePrivateBeginInstallWithManifest3Function::CreateResults(
api::webstore_private::Result result) const {
return BeginInstallWithManifest3::Results::Create(result);
@@ -386,7 +389,7 @@
ExtensionFunction::ResponseAction
WebstorePrivateCompleteInstallFunction::Run() {
- scoped_ptr<CompleteInstall::Params> params(
+ std::unique_ptr<CompleteInstall::Params> params(
CompleteInstall::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
if (chrome_details_.GetProfile()->IsGuestSession() ||
@@ -621,7 +624,7 @@
~WebstorePrivateSetStoreLoginFunction() {}
ExtensionFunction::ResponseAction WebstorePrivateSetStoreLoginFunction::Run() {
- scoped_ptr<SetStoreLogin::Params> params(
+ std::unique_ptr<SetStoreLogin::Params> params(
SetStoreLogin::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
SetWebstoreLogin(chrome_details_.GetProfile(), params->login);
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
index 91a94b6..5f9205ba 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
#include "chrome/browser/extensions/active_install_data.h"
#include "chrome/browser/extensions/bundle_installer.h"
@@ -40,8 +40,9 @@
// Gets the pending approval for the |extension_id| in |profile|. Pending
// approvals are held between the calls to beginInstallWithManifest and
// completeInstall. This should only be used for testing.
- static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting(
- Profile* profile, const std::string& extension_id);
+ static std::unique_ptr<WebstoreInstaller::Approval> PopApprovalForTesting(
+ Profile* profile,
+ const std::string& extension_id);
};
class WebstorePrivateBeginInstallWithManifest3Function
@@ -77,25 +78,25 @@
ExtensionFunction::ResponseValue BuildResponse(
api::webstore_private::Result result,
const std::string& error);
- scoped_ptr<base::ListValue> CreateResults(
+ std::unique_ptr<base::ListValue> CreateResults(
api::webstore_private::Result result) const;
const Params::Details& details() const { return params_->details; }
ChromeExtensionFunctionDetails chrome_details_;
- scoped_ptr<Params> params_;
+ std::unique_ptr<Params> params_;
- scoped_ptr<ScopedActiveInstall> scoped_active_install_;
+ std::unique_ptr<ScopedActiveInstall> scoped_active_install_;
- scoped_ptr<base::DictionaryValue> parsed_manifest_;
+ std::unique_ptr<base::DictionaryValue> parsed_manifest_;
SkBitmap icon_;
// A dummy Extension object we create for the purposes of using
// ExtensionInstallPrompt to prompt for confirmation of the install.
scoped_refptr<Extension> dummy_extension_;
- scoped_ptr<ExtensionInstallPrompt> install_prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> install_prompt_;
};
class WebstorePrivateCompleteInstallFunction
@@ -124,8 +125,8 @@
ChromeExtensionFunctionDetails chrome_details_;
- scoped_ptr<WebstoreInstaller::Approval> approval_;
- scoped_ptr<ScopedActiveInstall> scoped_active_install_;
+ std::unique_ptr<WebstoreInstaller::Approval> approval_;
+ std::unique_ptr<ScopedActiveInstall> scoped_active_install_;
};
class WebstorePrivateInstallBundleFunction
@@ -155,10 +156,10 @@
ChromeExtensionFunctionDetails chrome_details_;
- scoped_ptr<Params> params_;
+ std::unique_ptr<Params> params_;
- scoped_ptr<extensions::BundleInstaller> bundle_;
- scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
+ std::unique_ptr<extensions::BundleInstaller> bundle_;
+ std::unique_ptr<chrome::BitmapFetcher> icon_fetcher_;
};
class WebstorePrivateEnableAppLauncherFunction
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
index cfc37a16..6c99f19 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
@@ -178,7 +178,7 @@
// directory for testing.
base::FilePath webstore_install_dir_copy_;
- scoped_ptr<ScopedTestDialogAutoConfirm> auto_confirm_install_;
+ std::unique_ptr<ScopedTestDialogAutoConfirm> auto_confirm_install_;
DISALLOW_COPY_AND_ASSIGN(ExtensionWebstorePrivateApiTest);
};
@@ -308,7 +308,7 @@
std::string extensionId = "enfkhcelefdadlmkffamgdlgplcionje";
ASSERT_TRUE(RunInstallTest("begin_install.html", "extension.crx"));
- scoped_ptr<WebstoreInstaller::Approval> approval =
+ std::unique_ptr<WebstoreInstaller::Approval> approval =
WebstorePrivateApi::PopApprovalForTesting(browser()->profile(), appId);
EXPECT_EQ(appId, approval->extension_id);
EXPECT_TRUE(approval->use_app_installed_bubble);
@@ -358,8 +358,8 @@
static const char kWebGLStatusBlocked[] = "webgl_blocked";
scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function =
new WebstorePrivateGetWebGLStatusFunction();
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
- function.get(), kEmptyArgs, browser()));
+ std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ function.get(), kEmptyArgs, browser()));
ASSERT_TRUE(result);
EXPECT_EQ(base::Value::TYPE_STRING, result->GetType());
std::string webgl_status;
diff --git a/chrome/browser/extensions/api/webstore_widget_private/app_installer.cc b/chrome/browser/extensions/api/webstore_widget_private/app_installer.cc
index ea5e34b..3c1af84 100644
--- a/chrome/browser/extensions/api/webstore_widget_private/app_installer.cc
+++ b/chrome/browser/extensions/api/webstore_widget_private/app_installer.cc
@@ -56,12 +56,12 @@
return GURL::EmptyGURL();
}
-scoped_ptr<ExtensionInstallPrompt::Prompt> AppInstaller::CreateInstallPrompt()
- const {
+std::unique_ptr<ExtensionInstallPrompt::Prompt>
+AppInstaller::CreateInstallPrompt() const {
if (silent_installation_)
return nullptr;
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::INLINE_INSTALL_PROMPT));
diff --git a/chrome/browser/extensions/api/webstore_widget_private/app_installer.h b/chrome/browser/extensions/api/webstore_widget_private/app_installer.h
index 8df3bf8e..b142bf7 100644
--- a/chrome/browser/extensions/api/webstore_widget_private/app_installer.h
+++ b/chrome/browser/extensions/api/webstore_widget_private/app_installer.h
@@ -41,7 +41,7 @@
bool ShouldShowPostInstallUI() const override;
bool ShouldShowAppInstalledBubble() const override;
content::WebContents* GetWebContents() const override;
- scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const override;
bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data,
std::string* error) const override;
@@ -54,7 +54,7 @@
bool silent_installation_;
Callback callback_;
content::WebContents* web_contents_;
- scoped_ptr<WebContentsObserver> web_contents_observer_;
+ std::unique_ptr<WebContentsObserver> web_contents_observer_;
DISALLOW_IMPLICIT_CONSTRUCTORS(AppInstaller);
};
diff --git a/chrome/browser/extensions/api/webstore_widget_private/webstore_widget_private_api.cc b/chrome/browser/extensions/api/webstore_widget_private/webstore_widget_private_api.cc
index e9d4408..cb530c54 100644
--- a/chrome/browser/extensions/api/webstore_widget_private/webstore_widget_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_widget_private/webstore_widget_private_api.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/api/webstore_widget_private/webstore_widget_private_api.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
@@ -70,8 +71,9 @@
ExtensionFunction::ResponseAction
WebstoreWidgetPrivateInstallWebstoreItemFunction::Run() {
- const scoped_ptr<webstore_widget_private::InstallWebstoreItem::Params> params(
- webstore_widget_private::InstallWebstoreItem::Params::Create(*args_));
+ const std::unique_ptr<webstore_widget_private::InstallWebstoreItem::Params>
+ params(
+ webstore_widget_private::InstallWebstoreItem::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
if (params->item_id.empty())
diff --git a/chrome/browser/extensions/app_data_migrator.cc b/chrome/browser/extensions/app_data_migrator.cc
index 8d13908..1ff4d1f2 100644
--- a/chrome/browser/extensions/app_data_migrator.cc
+++ b/chrome/browser/extensions/app_data_migrator.cc
@@ -41,7 +41,7 @@
GURL extension_url =
extensions::Extension::GetBaseURLFromExtensionId(extension->id());
- scoped_ptr<storage::SandboxFileSystemBackendDelegate::OriginEnumerator>
+ std::unique_ptr<storage::SandboxFileSystemBackendDelegate::OriginEnumerator>
enumerator(old_sandbox_delegate->CreateOriginEnumerator());
// Find out if there is a file system that needs migration.
diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc
index eb4b22b4..ad9f702a 100644
--- a/chrome/browser/extensions/app_data_migrator_unittest.cc
+++ b/chrome/browser/extensions/app_data_migrator_unittest.cc
@@ -27,7 +27,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
-scoped_ptr<TestingProfile> GetTestingProfile() {
+std::unique_ptr<TestingProfile> GetTestingProfile() {
TestingProfile::Builder profile_builder;
return profile_builder.Build();
}
@@ -43,7 +43,7 @@
void SetUp() override {
profile_ = GetTestingProfile();
registry_ = ExtensionRegistry::Get(profile_.get());
- migrator_ = scoped_ptr<AppDataMigrator>(
+ migrator_ = std::unique_ptr<AppDataMigrator>(
new AppDataMigrator(profile_.get(), registry_));
default_partition_ =
@@ -55,7 +55,7 @@
default_fs_context_ = default_partition_->GetFileSystemContext();
- url_request_context_ = scoped_ptr<content::MockBlobURLRequestContext>(
+ url_request_context_ = std::unique_ptr<content::MockBlobURLRequestContext>(
new content::MockBlobURLRequestContext(default_fs_context_));
}
@@ -63,13 +63,13 @@
protected:
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<TestingProfile> profile_;
- scoped_ptr<AppDataMigrator> migrator_;
+ std::unique_ptr<TestingProfile> profile_;
+ std::unique_ptr<AppDataMigrator> migrator_;
content::StoragePartition* default_partition_;
ExtensionRegistry* registry_;
storage::FileSystemContext* default_fs_context_;
content::IndexedDBContext* idb_context_;
- scoped_ptr<content::MockBlobURLRequestContext> url_request_context_;
+ std::unique_ptr<content::MockBlobURLRequestContext> url_request_context_;
};
scoped_refptr<const Extension> GetTestExtension(bool platform_app) {
@@ -183,7 +183,7 @@
void VerifyFileContents(base::File file,
const base::Closure& on_close_callback) {
ASSERT_EQ(14, file.GetLength());
- scoped_ptr<char[]> buffer(new char[15]);
+ std::unique_ptr<char[]> buffer(new char[15]);
file.Read(0, buffer.get(), 14);
buffer.get()[14] = 0;
diff --git a/chrome/browser/extensions/background_app_browsertest.cc b/chrome/browser/extensions/background_app_browsertest.cc
index 5c0907e..f704c2b 100644
--- a/chrome/browser/extensions/background_app_browsertest.cc
+++ b/chrome/browser/extensions/background_app_browsertest.cc
@@ -50,11 +50,10 @@
// telling us that a new background app has been installed.
IN_PROC_BROWSER_TEST_F(BackgroundAppBrowserTest, ReloadBackgroundApp) {
// Pass this in to the browser test.
- scoped_ptr<BackgroundModeManager> test_background_mode_manager(
- new TestBackgroundModeManager(
- *base::CommandLine::ForCurrentProcess(),
- &(g_browser_process->profile_manager()->
- GetProfileAttributesStorage())));
+ std::unique_ptr<BackgroundModeManager> test_background_mode_manager(
+ new TestBackgroundModeManager(*base::CommandLine::ForCurrentProcess(),
+ &(g_browser_process->profile_manager()
+ ->GetProfileAttributesStorage())));
g_browser_process->set_background_mode_manager_for_test(
std::move(test_background_mode_manager));
TestBackgroundModeManager* manager =
diff --git a/chrome/browser/extensions/background_xhr_browsertest.cc b/chrome/browser/extensions/background_xhr_browsertest.cc
index 8f6deae..3431e150 100644
--- a/chrome/browser/extensions/background_xhr_browsertest.cc
+++ b/chrome/browser/extensions/background_xhr_browsertest.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile.h"
@@ -22,7 +23,7 @@
namespace {
-scoped_ptr<net::ClientCertStore> CreateNullCertStore() {
+std::unique_ptr<net::ClientCertStore> CreateNullCertStore() {
return nullptr;
}
diff --git a/chrome/browser/extensions/blacklist.h b/chrome/browser/extensions/blacklist.h
index 649052d..6c50f7b 100644
--- a/chrome/browser/extensions/blacklist.h
+++ b/chrome/browser/extensions/blacklist.h
@@ -7,13 +7,13 @@
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -146,7 +146,7 @@
// The cached BlacklistState's, received from BlacklistStateFetcher.
BlacklistStateMap blacklist_state_cache_;
- scoped_ptr<BlacklistStateFetcher> state_fetcher_;
+ std::unique_ptr<BlacklistStateFetcher> state_fetcher_;
typedef std::list<std::pair<std::vector<std::string>,
base::Callback<void()> > >
diff --git a/chrome/browser/extensions/blacklist_state_fetcher.cc b/chrome/browser/extensions/blacklist_state_fetcher.cc
index c92279d..1c90410 100644
--- a/chrome/browser/extensions/blacklist_state_fetcher.cc
+++ b/chrome/browser/extensions/blacklist_state_fetcher.cc
@@ -115,7 +115,7 @@
return;
}
- scoped_ptr<const net::URLFetcher> fetcher;
+ std::unique_ptr<const net::URLFetcher> fetcher;
fetcher.reset(it->first);
std::string id = it->second;
diff --git a/chrome/browser/extensions/blacklist_state_fetcher.h b/chrome/browser/extensions/blacklist_state_fetcher.h
index 6c69c86..52de5ba 100644
--- a/chrome/browser/extensions/blacklist_state_fetcher.h
+++ b/chrome/browser/extensions/blacklist_state_fetcher.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_BLACKLIST_STATE_FETCHER_H_
#define CHROME_BROWSER_EXTENSIONS_BLACKLIST_STATE_FETCHER_H_
+#include <memory>
#include <set>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/safe_browsing/protocol_manager_helper.h"
#include "extensions/browser/blacklist_state.h"
@@ -53,7 +53,8 @@
// ID for URLFetchers for testing.
int url_fetcher_id_;
- scoped_ptr<safe_browsing::SafeBrowsingProtocolConfig> safe_browsing_config_;
+ std::unique_ptr<safe_browsing::SafeBrowsingProtocolConfig>
+ safe_browsing_config_;
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
scoped_refptr<net::URLRequestContextGetter> parent_request_context_for_test_;
diff --git a/chrome/browser/extensions/blob_reader.cc b/chrome/browser/extensions/blob_reader.cc
index 2427c3f..eca646e 100644
--- a/chrome/browser/extensions/blob_reader.cc
+++ b/chrome/browser/extensions/blob_reader.cc
@@ -60,7 +60,7 @@
// Overridden from net::URLFetcherDelegate.
void BlobReader::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<std::string> response(new std::string);
+ std::unique_ptr<std::string> response(new std::string);
int64_t first = 0, last = 0, length = 0;
source->GetResponseAsString(response.get());
source->GetResponseHeaders()->GetContentRange(&first, &last, &length);
diff --git a/chrome/browser/extensions/blob_reader.h b/chrome/browser/extensions/blob_reader.h
index 1cf464b8..4c0076a9c 100644
--- a/chrome/browser/extensions/blob_reader.h
+++ b/chrome/browser/extensions/blob_reader.h
@@ -7,11 +7,11 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "net/base/io_buffer.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request.h"
@@ -28,8 +28,9 @@
// |blob_data| contains the portion of the Blob requested. |blob_total_size|
// is the total size of the Blob, and may be larger than |blob_data->size()|.
// |blob_total_size| is -1 if it cannot be determined.
- typedef base::Callback<void(scoped_ptr<std::string> blob_data,
- int64_t blob_total_size)> BlobReadCallback;
+ typedef base::Callback<void(std::unique_ptr<std::string> blob_data,
+ int64_t blob_total_size)>
+ BlobReadCallback;
BlobReader(Profile* profile,
const std::string& blob_uuid,
@@ -45,7 +46,7 @@
void OnURLFetchComplete(const net::URLFetcher* source) override;
BlobReadCallback callback_;
- scoped_ptr<net::URLFetcher> fetcher_;
+ std::unique_ptr<net::URLFetcher> fetcher_;
DISALLOW_COPY_AND_ASSIGN(BlobReader);
};
diff --git a/chrome/browser/extensions/bookmark_app_helper.cc b/chrome/browser/extensions/bookmark_app_helper.cc
index ddb1d78..7376035 100644
--- a/chrome/browser/extensions/bookmark_app_helper.cc
+++ b/chrome/browser/extensions/bookmark_app_helper.cc
@@ -325,8 +325,8 @@
ExtensionService* service_;
WebApplicationInfo web_app_info_;
- scoped_ptr<content::WebContents> web_contents_;
- scoped_ptr<FaviconDownloader> favicon_downloader_;
+ std::unique_ptr<content::WebContents> web_contents_;
+ std::unique_ptr<FaviconDownloader> favicon_downloader_;
std::vector<GURL> urls_to_download_;
std::vector<BookmarkAppHelper::BitmapAndSource> downloaded_bitmaps_;
};
diff --git a/chrome/browser/extensions/bookmark_app_helper.h b/chrome/browser/extensions/bookmark_app_helper.h
index 431ca52..ff260ae 100644
--- a/chrome/browser/extensions/bookmark_app_helper.h
+++ b/chrome/browser/extensions/bookmark_app_helper.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_
#include <map>
+#include <memory>
#include <set>
#include <vector>
#include "base/callback.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/common/web_application_info.h"
#include "content/public/browser/notification_observer.h"
@@ -149,7 +149,7 @@
// Downloads icons from the given WebApplicationInfo using the given
// WebContents.
- scoped_ptr<FaviconDownloader> favicon_downloader_;
+ std::unique_ptr<FaviconDownloader> favicon_downloader_;
// Used to install the created bookmark app.
scoped_refptr<extensions::CrxInstaller> crx_installer_;
diff --git a/chrome/browser/extensions/browser_action_test_util.h b/chrome/browser/extensions/browser_action_test_util.h
index a95bef6..dfb7a53 100644
--- a/chrome/browser/extensions/browser_action_test_util.h
+++ b/chrome/browser/extensions/browser_action_test_util.h
@@ -7,10 +7,10 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "ui/gfx/native_widget_types.h"
class Browser;
@@ -99,7 +99,7 @@
// Creates and returns a BrowserActionTestUtil with an "overflow" container,
// with this object's container as the main bar.
- scoped_ptr<BrowserActionTestUtil> CreateOverflowBar();
+ std::unique_ptr<BrowserActionTestUtil> CreateOverflowBar();
// Returns the minimum allowed size of an extension popup.
static gfx::Size GetMinPopupSize();
@@ -115,7 +115,7 @@
// Our test helper, which constructs and owns the views if we don't have a
// real browser window, or if this is an overflow version.
- scoped_ptr<TestToolbarActionsBarHelper> test_helper_;
+ std::unique_ptr<TestToolbarActionsBarHelper> test_helper_;
DISALLOW_COPY_AND_ASSIGN(BrowserActionTestUtil);
};
diff --git a/chrome/browser/extensions/browser_extension_window_controller.cc b/chrome/browser/extensions/browser_extension_window_controller.cc
index 06cec7b..2b49a19 100644
--- a/chrome/browser/extensions/browser_extension_window_controller.cc
+++ b/chrome/browser/extensions/browser_extension_window_controller.cc
@@ -70,7 +70,7 @@
return result;
}
-scoped_ptr<extensions::api::tabs::Tab>
+std::unique_ptr<extensions::api::tabs::Tab>
BrowserExtensionWindowController::CreateTabObject(
const extensions::Extension* extension,
int tab_index) const {
diff --git a/chrome/browser/extensions/browser_extension_window_controller.h b/chrome/browser/extensions/browser_extension_window_controller.h
index c69bb970..0106a77a 100644
--- a/chrome/browser/extensions/browser_extension_window_controller.h
+++ b/chrome/browser/extensions/browser_extension_window_controller.h
@@ -27,7 +27,7 @@
const extensions::Extension* extension) const override;
base::DictionaryValue* CreateTabValue(const extensions::Extension* extension,
int tab_index) const override;
- scoped_ptr<extensions::api::tabs::Tab> CreateTabObject(
+ std::unique_ptr<extensions::api::tabs::Tab> CreateTabObject(
const extensions::Extension* extension,
int tab_index) const override;
bool CanClose(Reason* reason) const override;
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc
index 1e66c13c..0813b165 100644
--- a/chrome/browser/extensions/bundle_installer.cc
+++ b/chrome/browser/extensions/bundle_installer.cc
@@ -11,6 +11,7 @@
#include "base/command_line.h"
#include "base/i18n/rtl.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/crx_installer.h"
@@ -175,11 +176,10 @@
// Since we've already confirmed the permissions, create an approval that
// lets CrxInstaller bypass the prompt.
- scoped_ptr<WebstoreInstaller::Approval> approval(
+ std::unique_ptr<WebstoreInstaller::Approval> approval(
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
- profile_,
- entry.first,
- make_scoped_ptr(parsed_manifests_[entry.first]->DeepCopy()),
+ profile_, entry.first,
+ base::WrapUnique(parsed_manifests_[entry.first]->DeepCopy()),
true));
approval->use_app_installed_bubble = false;
approval->skip_post_install_ui = true;
@@ -261,7 +261,7 @@
return;
}
- scoped_ptr<const PermissionSet> permissions;
+ std::unique_ptr<const PermissionSet> permissions;
PermissionSet empty;
for (size_t i = 0; i < dummy_extensions_.size(); ++i) {
// Using "permissions ? *permissions : PermissionSet()" tries to do a copy,
@@ -286,7 +286,7 @@
if (browser)
web_contents = browser->tab_strip_model()->GetActiveWebContents();
install_ui_.reset(new ExtensionInstallPrompt(web_contents));
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt;
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt;
if (delegated_username_.empty()) {
prompt.reset(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT));
diff --git a/chrome/browser/extensions/bundle_installer.h b/chrome/browser/extensions/bundle_installer.h
index 9c3888b..075c633a 100644
--- a/chrome/browser/extensions/bundle_installer.h
+++ b/chrome/browser/extensions/bundle_installer.h
@@ -7,13 +7,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
@@ -203,7 +203,7 @@
Profile* profile_;
// The UI that shows the confirmation prompt.
- scoped_ptr<ExtensionInstallPrompt> install_ui_;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui_;
ApprovalCallback approval_callback_;
base::Closure install_callback_;
diff --git a/chrome/browser/extensions/chrome_app_api_browsertest.cc b/chrome/browser/extensions/chrome_app_api_browsertest.cc
index 108d57b..8bbc52e 100644
--- a/chrome/browser/extensions/chrome_app_api_browsertest.cc
+++ b/chrome/browser/extensions/chrome_app_api_browsertest.cc
@@ -2,11 +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 <string>
#include "base/command_line.h"
#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -137,7 +137,7 @@
browser()->tab_strip_model()->GetActiveWebContents(),
kGetAppDetails,
&result));
- scoped_ptr<base::DictionaryValue> app_details(
+ std::unique_ptr<base::DictionaryValue> app_details(
static_cast<base::DictionaryValue*>(
base::JSONReader::Read(result).release()));
// extension->manifest() does not contain the id.
diff --git a/chrome/browser/extensions/chrome_component_extension_resource_manager_unittest.cc b/chrome/browser/extensions/chrome_component_extension_resource_manager_unittest.cc
index d4948f9..2e47fd77 100644
--- a/chrome/browser/extensions/chrome_component_extension_resource_manager_unittest.cc
+++ b/chrome/browser/extensions/chrome_component_extension_resource_manager_unittest.cc
@@ -39,7 +39,7 @@
// Load the manifest data.
std::string error;
- scoped_ptr<base::DictionaryValue> manifest(file_util::LoadManifest(
+ std::unique_ptr<base::DictionaryValue> manifest(file_util::LoadManifest(
test_path, FILE_PATH_LITERAL("app.json"), &error));
ASSERT_TRUE(manifest.get()) << error;
diff --git a/chrome/browser/extensions/chrome_extension_host_delegate.cc b/chrome/browser/extensions/chrome_extension_host_delegate.cc
index 1a1de87f..1661a8f 100644
--- a/chrome/browser/extensions/chrome_extension_host_delegate.cc
+++ b/chrome/browser/extensions/chrome_extension_host_delegate.cc
@@ -24,9 +24,9 @@
struct QueueWrapper {
QueueWrapper() {
queue.reset(new LoadMonitoringExtensionHostQueue(
- scoped_ptr<ExtensionHostQueue>(new SerialExtensionHostQueue())));
+ std::unique_ptr<ExtensionHostQueue>(new SerialExtensionHostQueue())));
}
- scoped_ptr<ExtensionHostQueue> queue;
+ std::unique_ptr<ExtensionHostQueue> queue;
};
base::LazyInstance<QueueWrapper> g_queue = LAZY_INSTANCE_INITIALIZER;
diff --git a/chrome/browser/extensions/chrome_extension_web_contents_observer.cc b/chrome/browser/extensions/chrome_extension_web_contents_observer.cc
index 4168b349..466ac32 100644
--- a/chrome/browser/extensions/chrome_extension_web_contents_observer.cc
+++ b/chrome/browser/extensions/chrome_extension_web_contents_observer.cc
@@ -119,7 +119,7 @@
extension_id = GURL(source).host();
ErrorConsole::Get(browser_context())
- ->ReportError(scoped_ptr<ExtensionError>(new RuntimeError(
+ ->ReportError(std::unique_ptr<ExtensionError>(new RuntimeError(
extension_id, browser_context()->IsOffTheRecord(), source, message,
stack_trace, web_contents()->GetLastCommittedURL(),
static_cast<logging::LogSeverity>(severity_level),
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc
index 6739b325..b08507db 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
@@ -189,9 +190,10 @@
return process_manager_delegate_.get();
}
-scoped_ptr<ExtensionHostDelegate>
+std::unique_ptr<ExtensionHostDelegate>
ChromeExtensionsBrowserClient::CreateExtensionHostDelegate() {
- return scoped_ptr<ExtensionHostDelegate>(new ChromeExtensionHostDelegate);
+ return std::unique_ptr<ExtensionHostDelegate>(
+ new ChromeExtensionHostDelegate);
}
bool ChromeExtensionsBrowserClient::DidVersionUpdate(
@@ -282,10 +284,11 @@
RegisterChromeServicesForFrame(render_frame_host, extension);
}
-scoped_ptr<RuntimeAPIDelegate>
+std::unique_ptr<RuntimeAPIDelegate>
ChromeExtensionsBrowserClient::CreateRuntimeAPIDelegate(
content::BrowserContext* context) const {
- return scoped_ptr<RuntimeAPIDelegate>(new ChromeRuntimeAPIDelegate(context));
+ return std::unique_ptr<RuntimeAPIDelegate>(
+ new ChromeRuntimeAPIDelegate(context));
}
const ComponentExtensionResourceManager*
@@ -296,7 +299,7 @@
void ChromeExtensionsBrowserClient::BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
g_browser_process->extension_event_router_forwarder()
->BroadcastEventToRenderers(histogram_value, event_name, std::move(args),
GURL());
@@ -310,7 +313,7 @@
if (!extension_cache_.get()) {
#if defined(OS_CHROMEOS)
extension_cache_.reset(new ExtensionCacheImpl(
- make_scoped_ptr(new ChromeOSExtensionCacheDelegate())));
+ base::WrapUnique(new ChromeOSExtensionCacheDelegate())));
#else
extension_cache_.reset(new NullExtensionCache());
#endif
@@ -343,7 +346,7 @@
void ChromeExtensionsBrowserClient::ReportError(
content::BrowserContext* context,
- scoped_ptr<ExtensionError> error) {
+ std::unique_ptr<ExtensionError> error) {
ErrorConsole::Get(context)->ReportError(std::move(error));
}
@@ -402,7 +405,7 @@
std::unique_ptr<ExtensionApiFrameIdMapHelper>
ChromeExtensionsBrowserClient::CreateExtensionApiFrameIdMapHelper(
ExtensionApiFrameIdMap* map) {
- return make_scoped_ptr(new ChromeExtensionApiFrameIdMapHelper(map));
+ return base::WrapUnique(new ChromeExtensionApiFrameIdMapHelper(map));
}
} // namespace extensions
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.h b/chrome/browser/extensions/chrome_extensions_browser_client.h
index 40ace29..772fa2bf 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.h
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.h
@@ -13,7 +13,6 @@
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_notification_observer.h"
#include "extensions/browser/extensions_browser_client.h"
@@ -83,7 +82,7 @@
content::BrowserContext* context,
std::vector<ExtensionPrefsObserver*>* observers) const override;
ProcessManagerDelegate* GetProcessManagerDelegate() const override;
- scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
+ std::unique_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsRunningInForcedAppMode() override;
@@ -95,13 +94,14 @@
ExtensionFunctionRegistry* registry) const override;
void RegisterMojoServices(content::RenderFrameHost* render_frame_host,
const Extension* extension) const override;
- scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
+ std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
content::BrowserContext* context) const override;
const ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() override;
- void BroadcastEventToRenderers(events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> args) override;
+ void BroadcastEventToRenderers(
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> args) override;
net::NetLog* GetNetLog() override;
ExtensionCache* GetExtensionCache() override;
bool IsBackgroundUpdateAllowed() override;
@@ -109,7 +109,7 @@
ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
content::WebContents* web_contents) override;
void ReportError(content::BrowserContext* context,
- scoped_ptr<ExtensionError> error) override;
+ std::unique_ptr<ExtensionError> error) override;
void CleanUpWebView(content::BrowserContext* browser_context,
int embedder_process_id,
int view_instance_id) override;
@@ -128,14 +128,14 @@
ChromeNotificationObserver notification_observer_;
// Support for ProcessManager.
- scoped_ptr<ChromeProcessManagerDelegate> process_manager_delegate_;
+ std::unique_ptr<ChromeProcessManagerDelegate> process_manager_delegate_;
// Client for API implementations.
- scoped_ptr<ChromeExtensionsAPIClient> api_client_;
+ std::unique_ptr<ChromeExtensionsAPIClient> api_client_;
- scoped_ptr<ChromeComponentExtensionResourceManager> resource_manager_;
+ std::unique_ptr<ChromeComponentExtensionResourceManager> resource_manager_;
- scoped_ptr<ExtensionCache> extension_cache_;
+ std::unique_ptr<ExtensionCache> extension_cache_;
DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient);
};
diff --git a/chrome/browser/extensions/chrome_info_map_unittest.cc b/chrome/browser/extensions/chrome_info_map_unittest.cc
index afa7bef..a22a1c1 100644
--- a/chrome/browser/extensions/chrome_info_map_unittest.cc
+++ b/chrome/browser/extensions/chrome_info_map_unittest.cc
@@ -25,7 +25,7 @@
path = path.AppendASCII("extensions").AppendASCII(dir).AppendASCII(test_file);
JSONFileValueDeserializer deserializer(path);
- scoped_ptr<base::Value> result = deserializer.Deserialize(NULL, NULL);
+ std::unique_ptr<base::Value> result = deserializer.Deserialize(NULL, NULL);
if (!result)
return NULL;
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index d386f9d..932ebbd 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -92,13 +92,12 @@
}
#if defined(OS_CHROMEOS)
-scoped_ptr<base::DictionaryValue>
-LoadManifestOnFileThread(
+std::unique_ptr<base::DictionaryValue> LoadManifestOnFileThread(
const base::FilePath& root_directory,
const base::FilePath::CharType* manifest_filename) {
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
std::string error;
- scoped_ptr<base::DictionaryValue> manifest(
+ std::unique_ptr<base::DictionaryValue> manifest(
file_util::LoadManifest(root_directory, manifest_filename, &error));
if (!manifest) {
LOG(ERROR) << "Can't load "
@@ -163,7 +162,7 @@
base::DictionaryValue* ComponentLoader::ParseManifest(
const std::string& manifest_contents) const {
JSONStringValueDeserializer deserializer(manifest_contents);
- scoped_ptr<base::Value> manifest = deserializer.Deserialize(NULL, NULL);
+ std::unique_ptr<base::Value> manifest = deserializer.Deserialize(NULL, NULL);
if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) {
LOG(ERROR) << "Failed to parse extension manifest.";
@@ -242,7 +241,7 @@
std::string ComponentLoader::AddOrReplace(const base::FilePath& path) {
base::FilePath absolute_path = base::MakeAbsoluteFilePath(path);
std::string error;
- scoped_ptr<base::DictionaryValue> manifest(
+ std::unique_ptr<base::DictionaryValue> manifest(
file_util::LoadManifest(absolute_path, &error));
if (!manifest) {
LOG(ERROR) << "Could not load extension from '" <<
@@ -784,7 +783,7 @@
const base::FilePath& root_directory,
const char* extension_id,
const base::Closure& done_cb,
- scoped_ptr<base::DictionaryValue> manifest) {
+ std::unique_ptr<base::DictionaryValue> manifest) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!manifest)
return; // Error already logged.
diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h
index 047ad96..0415235e 100644
--- a/chrome/browser/extensions/component_loader.h
+++ b/chrome/browser/extensions/component_loader.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -194,7 +194,7 @@
const base::FilePath& root_directory,
const char* extension_id,
const base::Closure& done_cb,
- scoped_ptr<base::DictionaryValue> manifest);
+ std::unique_ptr<base::DictionaryValue> manifest);
#endif
PrefService* profile_prefs_;
diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc
index 7a05b8b4..5b21dd4 100644
--- a/chrome/browser/extensions/component_loader_unittest.cc
+++ b/chrome/browser/extensions/component_loader_unittest.cc
@@ -131,7 +131,7 @@
};
TEST_F(ComponentLoaderTest, ParseManifest) {
- scoped_ptr<base::DictionaryValue> manifest;
+ std::unique_ptr<base::DictionaryValue> manifest;
// Test invalid JSON.
manifest.reset(
diff --git a/chrome/browser/extensions/component_migration_helper_unittest.cc b/chrome/browser/extensions/component_migration_helper_unittest.cc
index a16ae61..8168c77 100644
--- a/chrome/browser/extensions/component_migration_helper_unittest.cc
+++ b/chrome/browser/extensions/component_migration_helper_unittest.cc
@@ -96,8 +96,8 @@
}
StrictMock<MockComponentActionDelegate> mock_delegate_;
- scoped_ptr<StrictMock<MockComponentMigrationHelper>> mock_helper_;
- scoped_ptr<FeatureSwitch::ScopedOverride> extension_action_redesign_;
+ std::unique_ptr<StrictMock<MockComponentMigrationHelper>> mock_helper_;
+ std::unique_ptr<FeatureSwitch::ScopedOverride> extension_action_redesign_;
// Migrated extensions with browser actions.
scoped_refptr<const Extension> migrated_extension_a_;
diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc
index 6abe51fd..b13f9430 100644
--- a/chrome/browser/extensions/content_script_apitest.cc
+++ b/chrome/browser/extensions/content_script_apitest.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -168,7 +169,7 @@
DCHECK_EQ(dialog_manager_impl, dialog_manager_);
client_ = new DialogClient(this);
- dialog_manager_impl->SetExtensionsClient(make_scoped_ptr(client_));
+ dialog_manager_impl->SetExtensionsClient(base::WrapUnique(client_));
}
DialogHelper::~DialogHelper() {
diff --git a/chrome/browser/extensions/content_verifier_browsertest.cc b/chrome/browser/extensions/content_verifier_browsertest.cc
index c0f2c8bf..d51c3c92 100644
--- a/chrome/browser/extensions/content_verifier_browsertest.cc
+++ b/chrome/browser/extensions/content_verifier_browsertest.cc
@@ -306,7 +306,7 @@
protected:
JobDelegate delegate_;
- scoped_ptr<UnloadObserver> unload_observer_;
+ std::unique_ptr<UnloadObserver> unload_observer_;
GURL page_url_;
};
diff --git a/chrome/browser/extensions/context_menu_matcher.cc b/chrome/browser/extensions/context_menu_matcher.cc
index 211932e6..02e4ba1 100644
--- a/chrome/browser/extensions/context_menu_matcher.cc
+++ b/chrome/browser/extensions/context_menu_matcher.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/context_menu_matcher.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/extension_util.h"
@@ -113,7 +114,7 @@
menu_model_->AddItem(menu_id, title);
} else {
ui::SimpleMenuModel* submenu = new ui::SimpleMenuModel(delegate_);
- extension_menu_models_.push_back(make_scoped_ptr(submenu));
+ extension_menu_models_.push_back(base::WrapUnique(submenu));
menu_model_->AddSubMenu(menu_id, title, submenu);
RecursivelyAppendExtensionItems(submenu_items, can_cross_incognito,
selection_text, submenu, index,
@@ -266,7 +267,7 @@
menu_model->AddItem(menu_id, title);
} else {
ui::SimpleMenuModel* submenu = new ui::SimpleMenuModel(delegate_);
- extension_menu_models_.push_back(make_scoped_ptr(submenu));
+ extension_menu_models_.push_back(base::WrapUnique(submenu));
menu_model->AddSubMenu(menu_id, title, submenu);
RecursivelyAppendExtensionItems(children, can_cross_incognito,
selection_text, submenu, index,
diff --git a/chrome/browser/extensions/context_menu_matcher.h b/chrome/browser/extensions/context_menu_matcher.h
index 19e921c0..492573c 100644
--- a/chrome/browser/extensions/context_menu_matcher.h
+++ b/chrome/browser/extensions/context_menu_matcher.h
@@ -8,11 +8,11 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/menu_manager.h"
#include "ui/base/models/simple_menu_model.h"
@@ -107,7 +107,7 @@
std::map<int, extensions::MenuItem::Id> extension_item_map_;
// Keep track of and clean up menu models for submenus.
- std::vector<scoped_ptr<ui::SimpleMenuModel>> extension_menu_models_;
+ std::vector<std::unique_ptr<ui::SimpleMenuModel>> extension_menu_models_;
DISALLOW_COPY_AND_ASSIGN(ContextMenuMatcher);
};
diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc
index 42133ab..fdd2b9a 100644
--- a/chrome/browser/extensions/convert_user_script.cc
+++ b/chrome/browser/extensions/convert_user_script.cc
@@ -66,7 +66,7 @@
}
// Create the manifest
- scoped_ptr<base::DictionaryValue> root(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> root(new base::DictionaryValue);
std::string script_name;
if (!script.name().empty() && !script.name_space().empty())
script_name = script.name_space() + "/" + script.name();
diff --git a/chrome/browser/extensions/convert_user_script_unittest.cc b/chrome/browser/extensions/convert_user_script_unittest.cc
index 4afbc1d..ad65bdd 100644
--- a/chrome/browser/extensions/convert_user_script_unittest.cc
+++ b/chrome/browser/extensions/convert_user_script_unittest.cc
@@ -2,16 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/convert_user_script.h"
+
+#include <memory>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/extensions/convert_user_script.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
#include "extensions/common/constants.h"
diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc
index e920b45..409eb9b 100644
--- a/chrome/browser/extensions/convert_web_app.cc
+++ b/chrome/browser/extensions/convert_web_app.cc
@@ -102,7 +102,7 @@
}
// Create the manifest
- scoped_ptr<base::DictionaryValue> root(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> root(new base::DictionaryValue);
root->SetString(keys::kPublicKey, GenerateKey(web_app.app_url));
root->SetString(keys::kName, base::UTF16ToUTF8(web_app.title));
root->SetString(keys::kVersion, ConvertTimeToExtensionVersion(create_time));
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 3159771..0f25ae4f 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -13,6 +13,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_util.h"
@@ -89,27 +90,26 @@
scoped_refptr<CrxInstaller> CrxInstaller::CreateSilent(
ExtensionService* frontend) {
return new CrxInstaller(frontend->AsWeakPtr(),
- scoped_ptr<ExtensionInstallPrompt>(),
- NULL);
+ std::unique_ptr<ExtensionInstallPrompt>(), NULL);
}
// static
scoped_refptr<CrxInstaller> CrxInstaller::Create(
ExtensionService* frontend,
- scoped_ptr<ExtensionInstallPrompt> client) {
+ std::unique_ptr<ExtensionInstallPrompt> client) {
return new CrxInstaller(frontend->AsWeakPtr(), std::move(client), NULL);
}
// static
scoped_refptr<CrxInstaller> CrxInstaller::Create(
ExtensionService* service,
- scoped_ptr<ExtensionInstallPrompt> client,
+ std::unique_ptr<ExtensionInstallPrompt> client,
const WebstoreInstaller::Approval* approval) {
return new CrxInstaller(service->AsWeakPtr(), std::move(client), approval);
}
CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> service_weak,
- scoped_ptr<ExtensionInstallPrompt> client,
+ std::unique_ptr<ExtensionInstallPrompt> client,
const WebstoreInstaller::Approval* approval)
: install_directory_(service_weak->install_directory()),
install_source_(Manifest::INTERNAL),
@@ -448,7 +448,7 @@
if (original_manifest)
original_manifest_.reset(new Manifest(
Manifest::INVALID_LOCATION,
- scoped_ptr<base::DictionaryValue>(original_manifest->DeepCopy())));
+ std::unique_ptr<base::DictionaryValue>(original_manifest->DeepCopy())));
// We don't have to delete the unpack dir explicity since it is a child of
// the temp dir.
@@ -918,7 +918,7 @@
service->profile(), extension());
client_->ShowDialog(
base::Bind(&CrxInstaller::OnInstallPromptDone, this), extension(),
- nullptr, make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
+ nullptr, base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
}
}
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index 23efc03..005fc6e5 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -86,13 +86,13 @@
// Same as above, but use |client| to generate a confirmation prompt.
static scoped_refptr<CrxInstaller> Create(
ExtensionService* service,
- scoped_ptr<ExtensionInstallPrompt> client);
+ std::unique_ptr<ExtensionInstallPrompt> client);
// Same as the previous method, except use the |approval| to bypass the
// prompt. Note that the caller retains ownership of |approval|.
static scoped_refptr<CrxInstaller> Create(
ExtensionService* service,
- scoped_ptr<ExtensionInstallPrompt> client,
+ std::unique_ptr<ExtensionInstallPrompt> client,
const WebstoreInstaller::Approval* approval);
// Install the crx in |source_file|.
@@ -215,7 +215,7 @@
friend class ExtensionCrxInstallerTest;
CrxInstaller(base::WeakPtr<ExtensionService> service_weak,
- scoped_ptr<ExtensionInstallPrompt> client,
+ std::unique_ptr<ExtensionInstallPrompt> client,
const WebstoreInstaller::Approval* approval);
~CrxInstaller() override;
@@ -321,7 +321,7 @@
// A parsed copy of the expected manifest, before any transformations like
// localization have taken place. If |approved_| is true, then the
// extension's manifest must match this for the install to proceed.
- scoped_ptr<Manifest> expected_manifest_;
+ std::unique_ptr<Manifest> expected_manifest_;
// The level of checking when comparing the actual manifest against
// the |expected_manifest_|.
@@ -361,14 +361,14 @@
// A parsed copy of the unmodified original manifest, before any
// transformations like localization have taken place.
- scoped_ptr<Manifest> original_manifest_;
+ std::unique_ptr<Manifest> original_manifest_;
// If valid, contains the current version of the extension we're
// installing (for upgrades).
base::Version current_version_;
// The icon we will display in the installation UI, if any.
- scoped_ptr<SkBitmap> install_icon_;
+ std::unique_ptr<SkBitmap> install_icon_;
// The temp directory extension resources were unpacked to. We own this and
// must delete it when we are done with it.
@@ -379,7 +379,7 @@
// The client we will work with to do the installation. This can be NULL, in
// which case the install is silent.
- scoped_ptr<ExtensionInstallPrompt> client_;
+ std::unique_ptr<ExtensionInstallPrompt> client_;
// The root of the unpacked extension directory. This is a subdirectory of
// temp_dir_, so we don't have to delete it explicitly.
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc
index a485443..1b39305 100644
--- a/chrome/browser/extensions/crx_installer_browsertest.cc
+++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -5,11 +5,13 @@
#include "chrome/browser/extensions/crx_installer.h"
#include <stddef.h>
+
#include <utility>
#include "base/at_exit.h"
#include "base/files/file_path.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -96,7 +98,7 @@
}
void set_error(const base::string16& error) { error_ = error; }
- scoped_ptr<ExtensionInstallPrompt> CreatePrompt();
+ std::unique_ptr<ExtensionInstallPrompt> CreatePrompt();
private:
@@ -108,7 +110,7 @@
std::string extension_id_;
base::string16 error_;
- scoped_ptr<ScopedTestDialogAutoConfirm> auto_confirm;
+ std::unique_ptr<ScopedTestDialogAutoConfirm> auto_confirm;
DISALLOW_COPY_AND_ASSIGN(MockPromptProxy);
};
@@ -176,16 +178,15 @@
MockPromptProxy::~MockPromptProxy() {}
-scoped_ptr<ExtensionInstallPrompt> MockPromptProxy::CreatePrompt() {
- return scoped_ptr<MockInstallPrompt>(
+std::unique_ptr<ExtensionInstallPrompt> MockPromptProxy::CreatePrompt() {
+ return std::unique_ptr<MockInstallPrompt>(
new MockInstallPrompt(web_contents_, this));
}
-
-scoped_ptr<MockPromptProxy> CreateMockPromptProxyForBrowser(
+std::unique_ptr<MockPromptProxy> CreateMockPromptProxyForBrowser(
Browser* browser) {
- return make_scoped_ptr(new MockPromptProxy(
- browser->tab_strip_model()->GetActiveWebContents()));
+ return base::WrapUnique(
+ new MockPromptProxy(browser->tab_strip_model()->GetActiveWebContents()));
}
class ManagementPolicyMock : public extensions::ManagementPolicy::Provider {
@@ -207,15 +208,15 @@
class ExtensionCrxInstallerTest : public ExtensionBrowserTest {
protected:
- scoped_ptr<WebstoreInstaller::Approval> GetApproval(
+ std::unique_ptr<WebstoreInstaller::Approval> GetApproval(
const char* manifest_dir,
const std::string& id,
bool strict_manifest_checks) {
- scoped_ptr<WebstoreInstaller::Approval> result;
+ std::unique_ptr<WebstoreInstaller::Approval> result;
base::FilePath ext_path = test_data_dir_.AppendASCII(manifest_dir);
std::string error;
- scoped_ptr<base::DictionaryValue> parsed_manifest(
+ std::unique_ptr<base::DictionaryValue> parsed_manifest(
file_util::LoadManifest(ext_path, &error));
if (!parsed_manifest.get() || !error.empty())
return result;
@@ -226,7 +227,7 @@
}
void RunCrxInstaller(const WebstoreInstaller::Approval* approval,
- scoped_ptr<ExtensionInstallPrompt> prompt,
+ std::unique_ptr<ExtensionInstallPrompt> prompt,
const base::FilePath& crx_path) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
@@ -245,7 +246,7 @@
MockPromptProxy* mock_install_prompt) {
base::FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath);
- scoped_ptr<WebstoreInstaller::Approval> approval;
+ std::unique_ptr<WebstoreInstaller::Approval> approval;
if (!id.empty())
approval = GetApproval(ext_relpath, id, true);
@@ -261,12 +262,12 @@
// |record_oauth2_grant| is true.
void CheckHasEmptyScopesAfterInstall(const std::string& ext_relpath,
bool record_oauth2_grant) {
- scoped_ptr<MockPromptProxy> mock_prompt =
+ std::unique_ptr<MockPromptProxy> mock_prompt =
CreateMockPromptProxyForBrowser(browser());
InstallWithPrompt("browsertest/scopes", std::string(), mock_prompt.get());
- scoped_ptr<const PermissionSet> permissions =
+ std::unique_ptr<const PermissionSet> permissions =
ExtensionPrefs::Get(browser()->profile())
->GetGrantedPermissions(mock_prompt->extension_id());
ASSERT_TRUE(permissions.get());
@@ -357,7 +358,7 @@
std::string crx_path_string(crx_path.value().begin(), crx_path.value().end());
GURL url = GURL(std::string("file:///").append(crx_path_string));
- scoped_ptr<MockPromptProxy> mock_prompt =
+ std::unique_ptr<MockPromptProxy> mock_prompt =
CreateMockPromptProxyForBrowser(browser());
download_crx_util::SetMockInstallPromptForTesting(
mock_prompt->CreatePrompt());
@@ -367,7 +368,7 @@
content::BrowserContext::GetDownloadManager(browser()->profile());
LOG(ERROR) << "PackAndInstallExtension: Setting observer";
- scoped_ptr<content::DownloadTestObserver> observer(
+ std::unique_ptr<content::DownloadTestObserver> observer(
new content::DownloadTestObserverTerminal(
download_manager, kNumDownloadsExpected,
content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT));
@@ -406,7 +407,7 @@
const bool kTestData[] = {false, true};
for (size_t i = 0; i < arraysize(kTestData); ++i) {
- scoped_ptr<MockPromptProxy> mock_prompt =
+ std::unique_ptr<MockPromptProxy> mock_prompt =
CreateMockPromptProxyForBrowser(browser());
scoped_refptr<CrxInstaller> crx_installer(
@@ -530,7 +531,7 @@
#endif
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, NonStrictManifestCheck) {
- scoped_ptr<MockPromptProxy> mock_prompt =
+ std::unique_ptr<MockPromptProxy> mock_prompt =
CreateMockPromptProxyForBrowser(browser());
// We want to simulate the case where the webstore sends a more recent
@@ -538,7 +539,7 @@
// the newly published version hasn't fully propagated to all the download
// servers yet. So load the v2 manifest, but then install the v1 crx file.
std::string id = "lhnaeclnpobnlbjbgogdanmhadigfnjp";
- scoped_ptr<WebstoreInstaller::Approval> approval =
+ std::unique_ptr<WebstoreInstaller::Approval> approval =
GetApproval("crx_installer/v2_no_permission_change/", id, false);
RunCrxInstaller(approval.get(), mock_prompt->CreatePrompt(),
diff --git a/chrome/browser/extensions/default_apps_unittest.cc b/chrome/browser/extensions/default_apps_unittest.cc
index 0e4f8a4..3251ee42 100644
--- a/chrome/browser/extensions/default_apps_unittest.cc
+++ b/chrome/browser/extensions/default_apps_unittest.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/default_apps.h"
+
+#include <memory>
+
#include "base/message_loop/message_loop.h"
#include "build/build_config.h"
-#include "chrome/browser/extensions/default_apps.h"
#include "chrome/browser/extensions/external_pref_loader.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
@@ -43,7 +45,7 @@
// Chrome OS has different way of installing default apps.
// Android does not currently support installing apps via Chrome.
TEST_F(DefaultAppsTest, Install) {
- scoped_ptr<TestingProfile> profile(new TestingProfile());
+ std::unique_ptr<TestingProfile> profile(new TestingProfile());
ExternalLoader* loader = new MockExternalLoader();
Provider provider(profile.get(), NULL, loader, Manifest::INTERNAL,
diff --git a/chrome/browser/extensions/display_info_provider_chromeos.cc b/chrome/browser/extensions/display_info_provider_chromeos.cc
index ff18c3a..a80c3c9 100644
--- a/chrome/browser/extensions/display_info_provider_chromeos.cc
+++ b/chrome/browser/extensions/display_info_provider_chromeos.cc
@@ -168,7 +168,7 @@
placement.display_id = target_display_id;
placement.parent_display_id = primary_display_id;
- scoped_ptr<display::DisplayLayout> layout(new display::DisplayLayout);
+ std::unique_ptr<display::DisplayLayout> layout(new display::DisplayLayout);
layout->placement_list.push_back(placement);
layout->primary_id = primary_display_id;
diff --git a/chrome/browser/extensions/error_console/error_console.cc b/chrome/browser/extensions/error_console/error_console.cc
index 36ad4167..088f553 100644
--- a/chrome/browser/extensions/error_console/error_console.cc
+++ b/chrome/browser/extensions/error_console/error_console.cc
@@ -136,7 +136,7 @@
prefs_->UpdateExtensionPref(extension_id, kStoreExtensionErrorsPref, NULL);
}
-void ErrorConsole::ReportError(scoped_ptr<ExtensionError> error) {
+void ErrorConsole::ReportError(std::unique_ptr<ExtensionError> error) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!enabled_ || !crx_file::id_util::IdIsValid(error->extension_id()))
return;
@@ -263,11 +263,9 @@
extension->install_warnings();
for (std::vector<InstallWarning>::const_iterator iter = warnings.begin();
iter != warnings.end(); ++iter) {
- ReportError(scoped_ptr<ExtensionError>(new ManifestError(
- extension->id(),
- base::UTF8ToUTF16(iter->message),
- base::UTF8ToUTF16(iter->key),
- base::UTF8ToUTF16(iter->specific))));
+ ReportError(std::unique_ptr<ExtensionError>(new ManifestError(
+ extension->id(), base::UTF8ToUTF16(iter->message),
+ base::UTF8ToUTF16(iter->key), base::UTF8ToUTF16(iter->specific))));
}
}
diff --git a/chrome/browser/extensions/error_console/error_console.h b/chrome/browser/extensions/error_console/error_console.h
index df2ad4f..06974fee 100644
--- a/chrome/browser/extensions/error_console/error_console.h
+++ b/chrome/browser/extensions/error_console/error_console.h
@@ -8,8 +8,9 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/scoped_observer.h"
#include "base/threading/thread_checker.h"
@@ -87,7 +88,7 @@
void UseDefaultReportingForExtension(const std::string& extension_id);
// Report an extension error, and add it to the list.
- void ReportError(scoped_ptr<ExtensionError> error);
+ void ReportError(std::unique_ptr<ExtensionError> error);
// Removes errors from the map according to the given |filter|.
void RemoveErrors(const ErrorMap::Filter& filter);
diff --git a/chrome/browser/extensions/error_console/error_console_unittest.cc b/chrome/browser/extensions/error_console/error_console_unittest.cc
index c2ea399..6794b951a 100644
--- a/chrome/browser/extensions/error_console/error_console_unittest.cc
+++ b/chrome/browser/extensions/error_console/error_console_unittest.cc
@@ -6,9 +6,10 @@
#include <stddef.h>
+#include <memory>
+
#include "base/logging.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/common/pref_names.h"
@@ -50,14 +51,14 @@
protected:
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ErrorConsole* error_console_;
};
// Test that the error console is enabled/disabled appropriately.
TEST_F(ErrorConsoleUnitTest, EnableAndDisableErrorConsole) {
// Start in Dev Channel, without the feature switch.
- scoped_ptr<ScopedCurrentChannel> channel_override(
+ std::unique_ptr<ScopedCurrentChannel> channel_override(
new ScopedCurrentChannel(version_info::Channel::DEV));
ASSERT_EQ(version_info::Channel::DEV, GetCurrentChannel());
FeatureSwitch::error_console()->SetOverrideValue(
diff --git a/chrome/browser/extensions/event_router_forwarder.cc b/chrome/browser/extensions/event_router_forwarder.cc
index dd31a78..8b781da 100644
--- a/chrome/browser/extensions/event_router_forwarder.cc
+++ b/chrome/browser/extensions/event_router_forwarder.cc
@@ -29,7 +29,7 @@
void EventRouterForwarder::BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
const GURL& event_url) {
HandleEvent(std::string(), histogram_value, event_name, std::move(event_args),
0, true, event_url);
@@ -38,7 +38,7 @@
void EventRouterForwarder::DispatchEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
void* profile,
bool use_profile_to_restrict_events,
const GURL& event_url) {
@@ -52,7 +52,7 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
const GURL& event_url) {
HandleEvent(extension_id, histogram_value, event_name, std::move(event_args),
0, true, event_url);
@@ -62,7 +62,7 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
void* profile,
bool use_profile_to_restrict_events,
const GURL& event_url) {
@@ -72,13 +72,14 @@
profile, use_profile_to_restrict_events, event_url);
}
-void EventRouterForwarder::HandleEvent(const std::string& extension_id,
- events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
- void* profile_ptr,
- bool use_profile_to_restrict_events,
- const GURL& event_url) {
+void EventRouterForwarder::HandleEvent(
+ const std::string& extension_id,
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args,
+ void* profile_ptr,
+ bool use_profile_to_restrict_events,
+ const GURL& event_url) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -105,7 +106,7 @@
} else {
std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles());
for (size_t i = 0; i < profiles.size(); ++i) {
- scoped_ptr<base::ListValue> per_profile_event_args(
+ std::unique_ptr<base::ListValue> per_profile_event_args(
event_args->DeepCopy());
CallEventRouter(profiles[i], extension_id, histogram_value, event_name,
std::move(per_profile_event_args),
@@ -120,7 +121,7 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
Profile* restrict_to_profile,
const GURL& event_url) {
#if defined(OS_CHROMEOS)
@@ -131,7 +132,7 @@
return;
#endif
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(event_args)));
event->restrict_to_browser_context = restrict_to_profile;
event->event_url = event_url;
diff --git a/chrome/browser/extensions/event_router_forwarder.h b/chrome/browser/extensions/event_router_forwarder.h
index ed25673..ad4a90f1 100644
--- a/chrome/browser/extensions/event_router_forwarder.h
+++ b/chrome/browser/extensions/event_router_forwarder.h
@@ -37,7 +37,7 @@
// May be called on any thread.
void BroadcastEventToRenderers(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
const GURL& event_url);
// Calls
@@ -48,7 +48,7 @@
void BroadcastEventToExtension(const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
const GURL& event_url);
// Calls
@@ -57,7 +57,7 @@
// on |profile|'s EventRouter. May be called on any thread.
void DispatchEventToRenderers(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
void* profile,
bool use_profile_to_restrict_events,
const GURL& event_url);
@@ -69,7 +69,7 @@
void DispatchEventToExtension(const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
void* profile,
bool use_profile_to_restrict_events,
const GURL& event_url);
@@ -83,7 +83,7 @@
virtual void HandleEvent(const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
void* profile,
bool use_profile_to_restrict_events,
const GURL& event_url);
@@ -96,7 +96,7 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
Profile* restrict_to_profile,
const GURL& event_url);
diff --git a/chrome/browser/extensions/event_router_forwarder_unittest.cc b/chrome/browser/extensions/event_router_forwarder_unittest.cc
index 2ca555e98..11d47c0 100644
--- a/chrome/browser/extensions/event_router_forwarder_unittest.cc
+++ b/chrome/browser/extensions/event_router_forwarder_unittest.cc
@@ -46,7 +46,7 @@
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
Profile* restrict_to_profile,
const GURL& event_url) {
CallEventRouter(profile, extension_id, histogram_value, event_name,
@@ -61,7 +61,7 @@
events::HistogramValue histogram_value,
const std::string& event_name,
const GURL& url) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
event_router->BroadcastEventToRenderers(histogram_value, event_name,
std::move(args), url);
}
@@ -72,7 +72,7 @@
void* profile,
bool use_profile_to_restrict_events,
const GURL& url) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
event_router->DispatchEventToRenderers(histogram_value, event_name,
std::move(args), profile,
use_profile_to_restrict_events, url);
@@ -83,7 +83,7 @@
events::HistogramValue histogram_value,
const std::string& event_name,
const GURL& url) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
event_router->BroadcastEventToExtension(extension, histogram_value,
event_name, std::move(args), url);
}
@@ -95,7 +95,7 @@
void* profile,
bool use_profile_to_restrict_events,
const GURL& url) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
event_router->DispatchEventToExtension(extension, histogram_value, event_name,
std::move(args), profile,
use_profile_to_restrict_events, url);
@@ -112,8 +112,8 @@
#if defined(OS_MACOSX)
base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
#endif
- scoped_ptr<base::PowerMonitorSource> power_monitor_source(
- new base::PowerMonitorDeviceSource());
+ std::unique_ptr<base::PowerMonitorSource> power_monitor_source(
+ new base::PowerMonitorDeviceSource());
dummy.reset(new base::PowerMonitor(std::move(power_monitor_source)));
}
@@ -127,7 +127,7 @@
content::TestBrowserThreadBundle thread_bundle_;
TestingProfileManager profile_manager_;
- scoped_ptr<base::PowerMonitor> dummy;
+ std::unique_ptr<base::PowerMonitor> dummy;
// Profiles are weak pointers, owned by ProfileManager in |browser_process_|.
TestingProfile* profile1_;
TestingProfile* profile2_;
diff --git a/chrome/browser/extensions/extension_action.cc b/chrome/browser/extensions/extension_action.cc
index 8661985..64e4eabf 100644
--- a/chrome/browser/extensions/extension_action.cc
+++ b/chrome/browser/extensions/extension_action.cc
@@ -291,7 +291,7 @@
}
void ExtensionAction::SetDefaultIconForTest(
- scoped_ptr<ExtensionIconSet> default_icon) {
+ std::unique_ptr<ExtensionIconSet> default_icon) {
default_icon_ = std::move(default_icon);
}
diff --git a/chrome/browser/extensions/extension_action.h b/chrome/browser/extensions/extension_action.h
index 70ceceb..dabf4d4 100644
--- a/chrome/browser/extensions/extension_action.h
+++ b/chrome/browser/extensions/extension_action.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "extensions/common/constants.h"
@@ -201,7 +201,7 @@
bool HasIsVisible(int tab_id) const;
bool HasIcon(int tab_id) const;
- void SetDefaultIconForTest(scoped_ptr<ExtensionIconSet> default_icon);
+ void SetDefaultIconForTest(std::unique_ptr<ExtensionIconSet> default_icon);
private:
// Populates the action from the |extension| and |manifest_data|, filling in
@@ -283,11 +283,11 @@
// ExtensionIconSet containing paths to bitmaps from which default icon's
// image representations will be selected.
- scoped_ptr<ExtensionIconSet> default_icon_;
+ std::unique_ptr<ExtensionIconSet> default_icon_;
// The default icon image, if |default_icon_| exists.
// Lazily initialized via LoadDefaultIconImage().
- scoped_ptr<extensions::IconImage> default_icon_image_;
+ std::unique_ptr<extensions::IconImage> default_icon_image_;
// The lazily-initialized image for a placeholder icon, in the event that the
// extension doesn't have its own icon. (Mutable to allow lazy init in
diff --git a/chrome/browser/extensions/extension_action_icon_factory.h b/chrome/browser/extensions/extension_action_icon_factory.h
index ac1d2b4..1365b780 100644
--- a/chrome/browser/extensions/extension_action_icon_factory.h
+++ b/chrome/browser/extensions/extension_action_icon_factory.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_ICON_FACTORY_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "extensions/browser/extension_icon_image.h"
diff --git a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc
index 5a1eb3e..d307a54f 100644
--- a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc
+++ b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc
@@ -115,8 +115,9 @@
std::string error;
JSONFileValueDeserializer deserializer(
test_file.AppendASCII("manifest.json"));
- scoped_ptr<base::DictionaryValue> valid_value = base::DictionaryValue::From(
- deserializer.Deserialize(&error_code, &error));
+ std::unique_ptr<base::DictionaryValue> valid_value =
+ base::DictionaryValue::From(
+ deserializer.Deserialize(&error_code, &error));
EXPECT_EQ(0, error_code) << error;
if (error_code != 0)
return NULL;
@@ -179,7 +180,7 @@
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
content::TestBrowserThread io_thread_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ExtensionService* extension_service_;
#if defined OS_CHROMEOS
@@ -280,7 +281,7 @@
EnsureImageSize(LoadIcon("browser_action/no_icon/icon.png"), icon_size);
ASSERT_FALSE(default_icon.IsEmpty());
- scoped_ptr<ExtensionIconSet> default_icon_set(new ExtensionIconSet());
+ std::unique_ptr<ExtensionIconSet> default_icon_set(new ExtensionIconSet());
default_icon_set->Add(icon_size, "icon.png");
browser_action->SetDefaultIconForTest(std::move(default_icon_set));
diff --git a/chrome/browser/extensions/extension_action_manager.cc b/chrome/browser/extensions/extension_action_manager.cc
index 4fd90e8..fe476fad 100644
--- a/chrome/browser/extensions/extension_action_manager.cc
+++ b/chrome/browser/extensions/extension_action_manager.cc
@@ -132,7 +132,7 @@
profile_);
}
-scoped_ptr<ExtensionAction> ExtensionActionManager::GetBestFitAction(
+std::unique_ptr<ExtensionAction> ExtensionActionManager::GetBestFitAction(
const Extension& extension,
ActionInfo::Type type) const {
const ActionInfo* info = ActionInfo::GetBrowserActionInfo(&extension);
@@ -143,8 +143,8 @@
// If no ActionInfo exists for |extension|, create and return a new action
// with a blank ActionInfo.
// Populate any missing values from |extension|'s manifest.
- scoped_ptr<ExtensionAction> new_action(new ExtensionAction(
- extension, type, info ? *info : ActionInfo()));
+ std::unique_ptr<ExtensionAction> new_action(
+ new ExtensionAction(extension, type, info ? *info : ActionInfo()));
return new_action;
}
diff --git a/chrome/browser/extensions/extension_action_manager.h b/chrome/browser/extensions/extension_action_manager.h
index 53451d5..3e65696 100644
--- a/chrome/browser/extensions/extension_action_manager.h
+++ b/chrome/browser/extensions/extension_action_manager.h
@@ -51,8 +51,9 @@
// Gets the best fit ExtensionAction for the given |extension|. This takes
// into account |extension|'s browser or page actions, if any, along with its
// name and any declared icons.
- scoped_ptr<ExtensionAction> GetBestFitAction(
- const Extension& extension, ActionInfo::Type type) const;
+ std::unique_ptr<ExtensionAction> GetBestFitAction(
+ const Extension& extension,
+ ActionInfo::Type type) const;
private:
// Implement ExtensionRegistryObserver.
diff --git a/chrome/browser/extensions/extension_action_manager_unittest.cc b/chrome/browser/extensions/extension_action_manager_unittest.cc
index 74c5e67b..ea58006 100644
--- a/chrome/browser/extensions/extension_action_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_action_manager_unittest.cc
@@ -31,8 +31,8 @@
// Build an extension, populating |action_type| key with |action|, and
// "icons" key with |extension_icons|.
scoped_refptr<Extension> BuildExtension(
- scoped_ptr<base::DictionaryValue> extension_icons,
- scoped_ptr<base::DictionaryValue> action,
+ std::unique_ptr<base::DictionaryValue> extension_icons,
+ std::unique_ptr<base::DictionaryValue> action,
const char* action_type);
// Returns true if |action|'s title matches |extension|'s name.
@@ -61,7 +61,7 @@
ExtensionRegistry* registry_;
int curr_id_;
ExtensionActionManager* manager_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
};
ExtensionActionManagerTest::ExtensionActionManagerTest()
@@ -72,8 +72,8 @@
}
scoped_refptr<Extension> ExtensionActionManagerTest::BuildExtension(
- scoped_ptr<base::DictionaryValue> extension_icons,
- scoped_ptr<base::DictionaryValue> action,
+ std::unique_ptr<base::DictionaryValue> extension_icons,
+ std::unique_ptr<base::DictionaryValue> action,
const char* action_type) {
std::string id = base::IntToString(curr_id_++);
scoped_refptr<Extension> extension =
@@ -207,7 +207,7 @@
ASSERT_TRUE(extension.get());
// Get a "best fit" browser action for |extension|.
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
manager()->GetBestFitAction(*extension.get(), ActionInfo::TYPE_BROWSER);
ASSERT_TRUE(action.get());
ASSERT_EQ(action->action_type(), ActionInfo::TYPE_BROWSER);
diff --git a/chrome/browser/extensions/extension_action_runner.cc b/chrome/browser/extensions/extension_action_runner.cc
index 8be229b2..a903610 100644
--- a/chrome/browser/extensions/extension_action_runner.cc
+++ b/chrome/browser/extensions/extension_action_runner.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/extensions/extension_action_runner.h"
+#include <memory>
+
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/stl_util.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
@@ -352,7 +354,7 @@
FROM_HERE,
base::Bind(callback, *default_bubble_close_action_for_testing_));
} else {
- toolbar_actions_bar->ShowToolbarActionBubble(make_scoped_ptr(
+ toolbar_actions_bar->ShowToolbarActionBubble(base::WrapUnique(
new BlockedActionBubbleDelegate(callback, extension->id())));
}
}
diff --git a/chrome/browser/extensions/extension_action_runner.h b/chrome/browser/extensions/extension_action_runner.h
index d260ee0..16e90970 100644
--- a/chrome/browser/extensions/extension_action_runner.h
+++ b/chrome/browser/extensions/extension_action_runner.h
@@ -85,7 +85,7 @@
int num_page_requests() const { return num_page_requests_; }
void set_default_bubble_close_action_for_testing(
- scoped_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> action) {
+ std::unique_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> action) {
default_bubble_close_action_for_testing_ = std::move(action);
}
@@ -202,7 +202,7 @@
bool ignore_active_tab_granted_;
// If non-null, the bubble action to simulate for testing.
- scoped_ptr<ToolbarActionsBarBubbleDelegate::CloseAction>
+ std::unique_ptr<ToolbarActionsBarBubbleDelegate::CloseAction>
default_bubble_close_action_for_testing_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
diff --git a/chrome/browser/extensions/extension_action_runner_browsertest.cc b/chrome/browser/extensions/extension_action_runner_browsertest.cc
index 5428c3c..ba151a7 100644
--- a/chrome/browser/extensions/extension_action_runner_browsertest.cc
+++ b/chrome/browser/extensions/extension_action_runner_browsertest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/extension_action_runner.h"
+
#include <stddef.h>
+#include <memory>
#include <utility>
#include <vector>
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_action.h"
-#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/tab_helper.h"
@@ -98,7 +100,7 @@
InjectionType injection_type);
private:
- std::vector<scoped_ptr<TestExtensionDir>> test_extension_dirs_;
+ std::vector<std::unique_ptr<TestExtensionDir>> test_extension_dirs_;
std::vector<const Extension*> extensions_;
};
@@ -155,7 +157,7 @@
"}",
name.c_str(), permissions.c_str(), scripts.c_str());
- scoped_ptr<TestExtensionDir> dir(new TestExtensionDir);
+ std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir);
dir->WriteManifest(manifest);
dir->WriteFile(FILE_PATH_LITERAL("script.js"),
injection_type == CONTENT_SCRIPT ? kContentScriptSource
@@ -470,7 +472,7 @@
// Wire up the runner to automatically accept the bubble to prompt for page
// refresh.
runner->set_default_bubble_close_action_for_testing(
- make_scoped_ptr(new ToolbarActionsBarBubbleDelegate::CloseAction(
+ base::WrapUnique(new ToolbarActionsBarBubbleDelegate::CloseAction(
ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE)));
content::NavigationEntry* entry =
@@ -506,7 +508,7 @@
const int next_nav_id =
web_contents->GetController().GetLastCommittedEntry()->GetUniqueID();
runner->set_default_bubble_close_action_for_testing(
- make_scoped_ptr(new ToolbarActionsBarBubbleDelegate::CloseAction(
+ base::WrapUnique(new ToolbarActionsBarBubbleDelegate::CloseAction(
ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION)));
// Try running the extension. Nothing should happen, because the user
@@ -521,7 +523,7 @@
// Repeat with a dismissal from bubble deactivation - same story.
runner->set_default_bubble_close_action_for_testing(
- make_scoped_ptr(new ToolbarActionsBarBubbleDelegate::CloseAction(
+ base::WrapUnique(new ToolbarActionsBarBubbleDelegate::CloseAction(
ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION)));
runner->RunAction(extension, true);
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/extensions/extension_action_storage_manager.cc b/chrome/browser/extensions/extension_action_storage_manager.cc
index acb0c38..a00a595 100644
--- a/chrome/browser/extensions/extension_action_storage_manager.cc
+++ b/chrome/browser/extensions/extension_action_storage_manager.cc
@@ -5,11 +5,12 @@
#include "chrome/browser/extensions/extension_action_storage_manager.h"
#include <stdint.h>
+
+#include <memory>
#include <utility>
#include "base/base64.h"
#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_action.h"
@@ -159,9 +160,10 @@
// Store |action|'s default values in a DictionaryValue for use in storing to
// disk.
-scoped_ptr<base::DictionaryValue> DefaultsToValue(ExtensionAction* action) {
+std::unique_ptr<base::DictionaryValue> DefaultsToValue(
+ ExtensionAction* action) {
const int kDefaultTabId = ExtensionAction::kDefaultTabId;
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString(kPopupUrlStorageKey,
action->GetPopupUrl(kDefaultTabId).spec());
@@ -178,7 +180,8 @@
gfx::ImageSkia icon =
action->GetExplicitlySetIcon(kDefaultTabId).AsImageSkia();
if (!icon.isNull()) {
- scoped_ptr<base::DictionaryValue> icon_value(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> icon_value(
+ new base::DictionaryValue());
std::vector<gfx::ImageSkiaRep> image_reps = icon.image_reps();
for (const gfx::ImageSkiaRep& rep : image_reps) {
int size = static_cast<int>(rep.scale() * icon.width());
@@ -244,7 +247,7 @@
ExtensionAction* extension_action) {
StateStore* store = GetStateStore();
if (store) {
- scoped_ptr<base::DictionaryValue> defaults =
+ std::unique_ptr<base::DictionaryValue> defaults =
DefaultsToValue(extension_action);
store->SetExtensionValue(extension_action->extension_id(),
kBrowserActionStorageKey, std::move(defaults));
@@ -252,7 +255,8 @@
}
void ExtensionActionStorageManager::ReadFromStorage(
- const std::string& extension_id, scoped_ptr<base::Value> value) {
+ const std::string& extension_id,
+ std::unique_ptr<base::Value> value) {
const Extension* extension = ExtensionRegistry::Get(browser_context_)->
enabled_extensions().GetByID(extension_id);
if (!extension)
diff --git a/chrome/browser/extensions/extension_action_storage_manager.h b/chrome/browser/extensions/extension_action_storage_manager.h
index de1d63b9..a11ecf6 100644
--- a/chrome/browser/extensions/extension_action_storage_manager.h
+++ b/chrome/browser/extensions/extension_action_storage_manager.h
@@ -44,8 +44,8 @@
// Reads/Writes the ExtensionAction's default values to/from storage.
void WriteToStorage(ExtensionAction* extension_action);
- void ReadFromStorage(
- const std::string& extension_id, scoped_ptr<base::Value> value);
+ void ReadFromStorage(const std::string& extension_id,
+ std::unique_ptr<base::Value> value);
// Returns the Extensions StateStore for the |browser_context_|.
// May return NULL.
diff --git a/chrome/browser/extensions/extension_action_test_util.cc b/chrome/browser/extensions/extension_action_test_util.cc
index e622d8e..b5104ff 100644
--- a/chrome/browser/extensions/extension_action_test_util.cc
+++ b/chrome/browser/extensions/extension_action_test_util.cc
@@ -4,7 +4,9 @@
#include "chrome/browser/extensions/extension_action_test_util.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_manager.h"
@@ -77,8 +79,9 @@
}
// Creates a new ToolbarActionsModel for the given |context|.
-scoped_ptr<KeyedService> BuildToolbarModel(content::BrowserContext* context) {
- return make_scoped_ptr(
+std::unique_ptr<KeyedService> BuildToolbarModel(
+ content::BrowserContext* context) {
+ return base::WrapUnique(
new ToolbarActionsModel(Profile::FromBrowserContext(context),
extensions::ExtensionPrefs::Get(context)));
}
diff --git a/chrome/browser/extensions/extension_action_unittest.cc b/chrome/browser/extensions/extension_action_unittest.cc
index 17840da..87180af 100644
--- a/chrome/browser/extensions/extension_action_unittest.cc
+++ b/chrome/browser/extensions/extension_action_unittest.cc
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/message_loop/message_loop.h"
#include "chrome/browser/extensions/extension_action.h"
+
+#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_loop.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "extensions/common/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -13,10 +15,10 @@
namespace {
-scoped_ptr<ExtensionAction> CreateAction(ActionInfo::Type type,
- const ActionInfo& action_info) {
+std::unique_ptr<ExtensionAction> CreateAction(ActionInfo::Type type,
+ const ActionInfo& action_info) {
scoped_refptr<const Extension> extension = test_util::CreateEmptyExtension();
- return make_scoped_ptr(new ExtensionAction(*extension, type, action_info));
+ return base::WrapUnique(new ExtensionAction(*extension, type, action_info));
}
} // namespace
@@ -24,7 +26,7 @@
TEST(ExtensionActionTest, Title) {
ActionInfo action_info;
action_info.default_title = "Initial Title";
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
CreateAction(ActionInfo::TYPE_PAGE, action_info);
ASSERT_EQ("Initial Title", action->GetTitle(1));
@@ -41,7 +43,7 @@
}
TEST(ExtensionActionTest, Visibility) {
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
CreateAction(ActionInfo::TYPE_PAGE, ActionInfo());
ASSERT_FALSE(action->GetIsVisible(1));
@@ -60,7 +62,7 @@
ASSERT_FALSE(action->GetIsVisible(1));
ASSERT_FALSE(action->GetIsVisible(100));
- scoped_ptr<ExtensionAction> browser_action =
+ std::unique_ptr<ExtensionAction> browser_action =
CreateAction(ActionInfo::TYPE_BROWSER, ActionInfo());
ASSERT_TRUE(browser_action->GetIsVisible(1));
}
@@ -68,7 +70,7 @@
TEST(ExtensionActionTest, Icon) {
ActionInfo action_info;
action_info.default_icon.Add(16, "icon16.png");
- scoped_ptr<ExtensionAction> page_action =
+ std::unique_ptr<ExtensionAction> page_action =
CreateAction(ActionInfo::TYPE_PAGE, action_info);
ASSERT_TRUE(page_action->default_icon());
EXPECT_EQ("icon16.png",
@@ -80,7 +82,7 @@
}
TEST(ExtensionActionTest, Badge) {
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
CreateAction(ActionInfo::TYPE_PAGE, ActionInfo());
ASSERT_EQ("", action->GetBadgeText(1));
action->SetBadgeText(ExtensionAction::kDefaultTabId, "foo");
@@ -96,7 +98,7 @@
}
TEST(ExtensionActionTest, BadgeTextColor) {
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
CreateAction(ActionInfo::TYPE_PAGE, ActionInfo());
ASSERT_EQ(0x00000000u, action->GetBadgeTextColor(1));
action->SetBadgeTextColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u);
@@ -112,7 +114,7 @@
}
TEST(ExtensionActionTest, BadgeBackgroundColor) {
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
CreateAction(ActionInfo::TYPE_PAGE, ActionInfo());
ASSERT_EQ(0x00000000u, action->GetBadgeBackgroundColor(1));
action->SetBadgeBackgroundColor(ExtensionAction::kDefaultTabId,
@@ -137,7 +139,7 @@
ActionInfo action_info;
action_info.default_popup_url = url_foo;
- scoped_ptr<ExtensionAction> action =
+ std::unique_ptr<ExtensionAction> action =
CreateAction(ActionInfo::TYPE_PAGE, action_info);
ASSERT_EQ(url_foo, action->GetPopupUrl(1));
diff --git a/chrome/browser/extensions/extension_api_unittest.cc b/chrome/browser/extensions/extension_api_unittest.cc
index 814a98473..4cf82724 100644
--- a/chrome/browser/extensions/extension_api_unittest.cc
+++ b/chrome/browser/extensions/extension_api_unittest.cc
@@ -29,16 +29,18 @@
Manifest::UNPACKED);
}
-scoped_ptr<base::Value> ExtensionApiUnittest::RunFunctionAndReturnValue(
- UIThreadExtensionFunction* function, const std::string& args) {
+std::unique_ptr<base::Value> ExtensionApiUnittest::RunFunctionAndReturnValue(
+ UIThreadExtensionFunction* function,
+ const std::string& args) {
function->set_extension(extension());
- return scoped_ptr<base::Value>(
+ return std::unique_ptr<base::Value>(
utils::RunFunctionAndReturnSingleResult(function, args, browser()));
}
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
ExtensionApiUnittest::RunFunctionAndReturnDictionary(
- UIThreadExtensionFunction* function, const std::string& args) {
+ UIThreadExtensionFunction* function,
+ const std::string& args) {
base::Value* value = RunFunctionAndReturnValue(function, args).release();
base::DictionaryValue* dict = NULL;
@@ -48,11 +50,12 @@
// We expect to either have successfuly retrieved a dictionary from the value,
// or the value to have been NULL.
EXPECT_TRUE(dict || !value);
- return scoped_ptr<base::DictionaryValue>(dict);
+ return std::unique_ptr<base::DictionaryValue>(dict);
}
-scoped_ptr<base::ListValue> ExtensionApiUnittest::RunFunctionAndReturnList(
- UIThreadExtensionFunction* function, const std::string& args) {
+std::unique_ptr<base::ListValue> ExtensionApiUnittest::RunFunctionAndReturnList(
+ UIThreadExtensionFunction* function,
+ const std::string& args) {
base::Value* value = RunFunctionAndReturnValue(function, args).release();
base::ListValue* list = NULL;
@@ -62,7 +65,7 @@
// We expect to either have successfuly retrieved a list from the value,
// or the value to have been NULL.
EXPECT_TRUE(list);
- return scoped_ptr<base::ListValue>(list);
+ return std::unique_ptr<base::ListValue>(list);
}
std::string ExtensionApiUnittest::RunFunctionAndReturnError(
diff --git a/chrome/browser/extensions/extension_api_unittest.h b/chrome/browser/extensions/extension_api_unittest.h
index 85df0ff..74fe1ce 100644
--- a/chrome/browser/extensions/extension_api_unittest.h
+++ b/chrome/browser/extensions/extension_api_unittest.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/test/base/browser_with_test_window_test.h"
namespace base {
@@ -53,18 +53,21 @@
// See also the RunFunction* methods in extension_function_test_utils.h.
// Return the function result as a base::Value.
- scoped_ptr<base::Value> RunFunctionAndReturnValue(
- UIThreadExtensionFunction* function, const std::string& args);
+ std::unique_ptr<base::Value> RunFunctionAndReturnValue(
+ UIThreadExtensionFunction* function,
+ const std::string& args);
// Return the function result as a base::DictionaryValue, or NULL.
// This will EXPECT-fail if the result is not a DictionaryValue.
- scoped_ptr<base::DictionaryValue> RunFunctionAndReturnDictionary(
- UIThreadExtensionFunction* function, const std::string& args);
+ std::unique_ptr<base::DictionaryValue> RunFunctionAndReturnDictionary(
+ UIThreadExtensionFunction* function,
+ const std::string& args);
// Return the function result as a base::ListValue, or NULL.
// This will EXPECT-fail if the result is not a ListValue.
- scoped_ptr<base::ListValue> RunFunctionAndReturnList(
- UIThreadExtensionFunction* function, const std::string& args);
+ std::unique_ptr<base::ListValue> RunFunctionAndReturnList(
+ UIThreadExtensionFunction* function,
+ const std::string& args);
// Return an error thrown from the function, if one exists.
// This will EXPECT-fail if any result is returned from the function.
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc
index 7eb080c..b10215d 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -44,7 +44,7 @@
const char kFtpServerPort[] = "ftpServer.port";
const char kEmbeddedTestServerPort[] = "testServer.port";
-scoped_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest(
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(request.relative_url, "/server-redirect?",
base::CompareCase::SENSITIVE))
@@ -54,14 +54,14 @@
std::string redirect_target =
request.relative_url.substr(query_string_pos + 1);
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_MOVED_PERMANENTLY);
http_response->AddCustomHeader("Location", redirect_target);
return std::move(http_response);
}
-scoped_ptr<net::test_server::HttpResponse> HandleEchoHeaderRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleEchoHeaderRequest(
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(request.relative_url, "/echoheader?",
base::CompareCase::SENSITIVE))
@@ -76,20 +76,20 @@
if (it != request.headers.end())
header_value = it->second;
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_OK);
http_response->set_content(header_value);
return std::move(http_response);
}
-scoped_ptr<net::test_server::HttpResponse> HandleSetCookieRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleSetCookieRequest(
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(request.relative_url, "/set-cookie?",
base::CompareCase::SENSITIVE))
return nullptr;
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_OK);
@@ -104,7 +104,7 @@
return std::move(http_response);
}
-scoped_ptr<net::test_server::HttpResponse> HandleSetHeaderRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleSetHeaderRequest(
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(request.relative_url, "/set-header?",
base::CompareCase::SENSITIVE))
@@ -122,13 +122,13 @@
size_t colon_pos = header.find(':');
if (colon_pos == std::string::npos)
- return scoped_ptr<net::test_server::HttpResponse>();
+ return std::unique_ptr<net::test_server::HttpResponse>();
std::string header_name = header.substr(0, colon_pos);
// Skip space after colon.
std::string header_value = header.substr(colon_pos + 2);
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_OK);
http_response->AddCustomHeader(header_name, header_value);
diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h
index 5415365..009ffdc 100644
--- a/chrome/browser/extensions/extension_apitest.h
+++ b/chrome/browser/extensions/extension_apitest.h
@@ -171,13 +171,13 @@
// Hold details of the test, set in C++, which can be accessed by
// javascript using chrome.test.getConfig().
- scoped_ptr<base::DictionaryValue> test_config_;
+ std::unique_ptr<base::DictionaryValue> test_config_;
// Hold the test WebSocket server.
- scoped_ptr<net::SpawnedTestServer> websocket_server_;
+ std::unique_ptr<net::SpawnedTestServer> websocket_server_;
// Hold the test FTP server.
- scoped_ptr<net::SpawnedTestServer> ftp_server_;
+ std::unique_ptr<net::SpawnedTestServer> ftp_server_;
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
diff --git a/chrome/browser/extensions/extension_app_icon_loader.cc b/chrome/browser/extensions/extension_app_icon_loader.cc
index 992568e..4d292ba 100644
--- a/chrome/browser/extensions/extension_app_icon_loader.cc
+++ b/chrome/browser/extensions/extension_app_icon_loader.cc
@@ -54,13 +54,9 @@
if (!extension)
return;
- scoped_ptr<extensions::IconImage> image(new extensions::IconImage(
- profile(),
- extension,
- extensions::IconsInfo::GetIcons(extension),
- icon_size(),
- extensions::util::GetDefaultAppIcon(),
- this));
+ std::unique_ptr<extensions::IconImage> image(new extensions::IconImage(
+ profile(), extension, extensions::IconsInfo::GetIcons(extension),
+ icon_size(), extensions::util::GetDefaultAppIcon(), this));
// Triggers image loading now instead of depending on paint message. This
// makes the temp blank image be shown for shorter time and improves user
diff --git a/chrome/browser/extensions/extension_app_icon_loader.h b/chrome/browser/extensions/extension_app_icon_loader.h
index 6ce5fb0..e0a2c90 100644
--- a/chrome/browser/extensions/extension_app_icon_loader.h
+++ b/chrome/browser/extensions/extension_app_icon_loader.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_APP_ICON_LOADER_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/ui/app_icon_loader.h"
#include "extensions/browser/extension_icon_image.h"
@@ -38,7 +38,7 @@
private:
using ExtensionIDToImageMap =
- std::map<std::string, scoped_ptr<extensions::IconImage>>;
+ std::map<std::string, std::unique_ptr<extensions::IconImage>>;
// Builds image for given |id| and |icon|.
void BuildImage(const std::string& id, const gfx::ImageSkia& icon);
diff --git a/chrome/browser/extensions/extension_assets_manager_chromeos.cc b/chrome/browser/extensions/extension_assets_manager_chromeos.cc
index 78e047a..74694c5 100644
--- a/chrome/browser/extensions/extension_assets_manager_chromeos.cc
+++ b/chrome/browser/extensions/extension_assets_manager_chromeos.cc
@@ -548,7 +548,7 @@
if (!extension_prefs || extension_prefs->pref_service()->ReadOnly())
return false;
- scoped_ptr<ExtensionInfo> info =
+ std::unique_ptr<ExtensionInfo> info =
extension_prefs->GetInstalledExtensionInfo(id);
if (!info || info->extension_path != base::FilePath(shared_path)) {
info = extension_prefs->GetDelayedInstallInfo(id);
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index 3476574..0758fbc 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -365,7 +365,7 @@
return base::FilePath();
}
- scoped_ptr<ExtensionCreator> creator(new ExtensionCreator());
+ std::unique_ptr<ExtensionCreator> creator(new ExtensionCreator());
if (!creator->Run(dir_path,
crx_path,
pem_path,
@@ -469,7 +469,7 @@
size_t num_before = registry->enabled_extensions().size();
{
- scoped_ptr<ScopedTestDialogAutoConfirm> prompt_auto_confirm;
+ std::unique_ptr<ScopedTestDialogAutoConfirm> prompt_auto_confirm;
if (ui_type == INSTALL_UI_TYPE_CANCEL) {
prompt_auto_confirm.reset(new ScopedTestDialogAutoConfirm(
ScopedTestDialogAutoConfirm::CANCEL));
@@ -490,7 +490,7 @@
if (crx_path.empty())
return NULL;
- scoped_ptr<ExtensionInstallPrompt> install_ui;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui;
if (prompt_auto_confirm) {
install_ui.reset(new ExtensionInstallPrompt(
browser->tab_strip_model()->GetActiveWebContents()));
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h
index a09cff4..cdb9714 100644
--- a/chrome/browser/extensions/extension_browsertest.h
+++ b/chrome/browser/extensions/extension_browsertest.h
@@ -318,7 +318,7 @@
// test_data/extensions.
base::FilePath test_data_dir_;
- scoped_ptr<ExtensionTestNotificationObserver> observer_;
+ std::unique_ptr<ExtensionTestNotificationObserver> observer_;
private:
// Temporary directory for testing.
@@ -381,7 +381,7 @@
Profile* profile_;
// Cache cache implementation.
- scoped_ptr<extensions::ExtensionCacheFake> test_extension_cache_;
+ std::unique_ptr<extensions::ExtensionCacheFake> test_extension_cache_;
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_
diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc
index f9ce770..14cc2d4 100644
--- a/chrome/browser/extensions/extension_context_menu_browsertest.cc
+++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc
@@ -106,9 +106,9 @@
const GURL& link_url,
const GURL& frame_url,
const std::string& label) {
- scoped_ptr<TestRenderViewContextMenu> menu(
- TestRenderViewContextMenu::Create(
- GetWebContents(), page_url, link_url, frame_url));
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ TestRenderViewContextMenu::Create(GetWebContents(), page_url, link_url,
+ frame_url));
return MenuHasExtensionItemWithLabel(menu.get(), label);
}
@@ -162,9 +162,9 @@
GURL page_url("http://www.google.com");
// Create and build our test context menu.
- scoped_ptr<TestRenderViewContextMenu> menu(
- TestRenderViewContextMenu::Create(
- GetWebContents(), page_url, GURL(), GURL()));
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ TestRenderViewContextMenu::Create(GetWebContents(), page_url, GURL(),
+ GURL()));
// Look for the extension item in the menu, and make sure it's |enabled|.
int command_id = ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0);
@@ -238,8 +238,9 @@
GURL page_url("http://www.google.com");
// Create and build our test context menu.
- scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create(
- GetWebContents(), page_url, GURL(), GURL()));
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ TestRenderViewContextMenu::Create(GetWebContents(), page_url, GURL(),
+ GURL()));
// Look for the extension item in the menu, and execute it.
int command_id = ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0);
@@ -269,8 +270,9 @@
GURL page_url("http://www.google.com");
// Create and build our test context menu.
- scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create(
- GetWebContents(), page_url, GURL(), GURL()));
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ TestRenderViewContextMenu::Create(GetWebContents(), page_url, GURL(),
+ GURL()));
// Look for the extension item in the menu, and execute it.
MenuItem::Id id(false, MenuItem::ExtensionKey(extension->id()));
@@ -350,7 +352,7 @@
// Create a context menu, then find the item's label. It should be properly
// truncated.
GURL url("http://foo.com/");
- scoped_ptr<TestRenderViewContextMenu> menu(
+ std::unique_ptr<TestRenderViewContextMenu> menu(
TestRenderViewContextMenu::Create(GetWebContents(), url, GURL(), GURL()));
base::string16 label;
@@ -402,7 +404,7 @@
ASSERT_TRUE(listener5.WaitUntilSatisfied());
GURL url("http://foo.com/");
- scoped_ptr<TestRenderViewContextMenu> menu(
+ std::unique_ptr<TestRenderViewContextMenu> menu(
TestRenderViewContextMenu::Create(GetWebContents(), url, GURL(), GURL()));
int index = 0;
@@ -487,7 +489,7 @@
listener1.WaitUntilSatisfied();
GURL url("http://www.google.com/");
- scoped_ptr<TestRenderViewContextMenu> menu(
+ std::unique_ptr<TestRenderViewContextMenu> menu(
TestRenderViewContextMenu::Create(GetWebContents(), url, GURL(), GURL()));
// The top-level item should be an "automagic parent" with the extension's
@@ -581,13 +583,14 @@
GURL page_url("http://www.google.com");
// Create and build our test context menu.
- scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create(
- GetWebContents(), page_url, GURL(), GURL()));
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ TestRenderViewContextMenu::Create(GetWebContents(), page_url, GURL(),
+ GURL()));
WebContents* incognito_web_contents =
browser_incognito->tab_strip_model()->GetActiveWebContents();
- scoped_ptr<TestRenderViewContextMenu> menu_incognito(
- TestRenderViewContextMenu::Create(
- incognito_web_contents, page_url, GURL(), GURL()));
+ std::unique_ptr<TestRenderViewContextMenu> menu_incognito(
+ TestRenderViewContextMenu::Create(incognito_web_contents, page_url,
+ GURL(), GURL()));
// Look for the extension item in the menu, and execute it.
int command_id = ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0);
@@ -684,8 +687,9 @@
// Test that checked menu items retain their checkedness.
LazyBackgroundObserver checkbox_checked;
- scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create(
- GetWebContents(), about_blank, GURL(), GURL()));
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ TestRenderViewContextMenu::Create(GetWebContents(), about_blank, GURL(),
+ GURL()));
MenuItem::Id id(false, MenuItem::ExtensionKey(extension->id()));
id.string_uid = "checkbox1";
diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc
index 768ca6a..849956d 100644
--- a/chrome/browser/extensions/extension_context_menu_model.cc
+++ b/chrome/browser/extensions/extension_context_menu_model.cc
@@ -142,7 +142,7 @@
delete this;
}
- scoped_ptr<ExtensionUninstallDialog> uninstall_dialog_;
+ std::unique_ptr<ExtensionUninstallDialog> uninstall_dialog_;
DISALLOW_COPY_AND_ASSIGN(UninstallDialogHelper);
};
diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h
index 50acfbb..7543dc3 100644
--- a/chrome/browser/extensions/extension_context_menu_model.h
+++ b/chrome/browser/extensions/extension_context_menu_model.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "ui/base/models/simple_menu_model.h"
class Browser;
@@ -133,9 +133,9 @@
ButtonVisibility button_visibility_;
// Menu matcher for context menu items specified by the extension.
- scoped_ptr<ContextMenuMatcher> extension_items_;
+ std::unique_ptr<ContextMenuMatcher> extension_items_;
- scoped_ptr<ui::SimpleMenuModel> page_access_submenu_;
+ std::unique_ptr<ui::SimpleMenuModel> page_access_submenu_;
DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
};
diff --git a/chrome/browser/extensions/extension_context_menu_model_unittest.cc b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
index b5258506..0ddd220 100644
--- a/chrome/browser/extensions/extension_context_menu_model_unittest.cc
+++ b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
@@ -66,8 +67,8 @@
cur_id_(0) {}
~MenuBuilder() {}
- scoped_ptr<ExtensionContextMenuModel> BuildMenu() {
- return make_scoped_ptr(new ExtensionContextMenuModel(
+ std::unique_ptr<ExtensionContextMenuModel> BuildMenu() {
+ return base::WrapUnique(new ExtensionContextMenuModel(
extension_.get(), browser_, ExtensionContextMenuModel::VISIBLE,
nullptr));
}
@@ -134,8 +135,8 @@
Browser* GetBrowser();
private:
- scoped_ptr<TestBrowserWindow> test_window_;
- scoped_ptr<Browser> browser_;
+ std::unique_ptr<TestBrowserWindow> test_window_;
+ std::unique_ptr<Browser> browser_;
DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModelTest);
};
@@ -227,7 +228,7 @@
InitializeEmptyExtensionService();
std::string name("component");
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
DictionaryBuilder()
.Set("name", name)
.Set("version", "1")
@@ -238,7 +239,7 @@
{
scoped_refptr<const Extension> extension =
ExtensionBuilder()
- .SetManifest(make_scoped_ptr(manifest->DeepCopy()))
+ .SetManifest(base::WrapUnique(manifest->DeepCopy()))
.SetID(crx_file::id_util::GenerateId("component"))
.SetLocation(Manifest::COMPONENT)
.Build();
@@ -324,7 +325,7 @@
// context menu without the toolbar redesign.
TEST_F(ExtensionContextMenuModelTest, ExtensionContextMenuShowAndHideLegacy) {
// Start with the toolbar redesign disabled.
- scoped_ptr<FeatureSwitch::ScopedOverride> toolbar_redesign_override(
+ std::unique_ptr<FeatureSwitch::ScopedOverride> toolbar_redesign_override(
new FeatureSwitch::ScopedOverride(
FeatureSwitch::extension_action_redesign(), false));
@@ -391,7 +392,7 @@
// context menu with the toolbar redesign.
TEST_F(ExtensionContextMenuModelTest, ExtensionContextMenuShowAndHideRedesign) {
// Start with the toolbar redesign disabled.
- scoped_ptr<FeatureSwitch::ScopedOverride> toolbar_redesign_override(
+ std::unique_ptr<FeatureSwitch::ScopedOverride> toolbar_redesign_override(
new FeatureSwitch::ScopedOverride(
FeatureSwitch::extension_action_redesign(), true));
@@ -489,7 +490,7 @@
TEST_F(ExtensionContextMenuModelTest, TestPageAccessSubmenu) {
// This test relies on the click-to-script feature.
- scoped_ptr<FeatureSwitch::ScopedOverride> enable_scripts_require_action(
+ std::unique_ptr<FeatureSwitch::ScopedOverride> enable_scripts_require_action(
new FeatureSwitch::ScopedOverride(FeatureSwitch::scripts_require_action(),
true));
InitializeEmptyExtensionService();
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index 1991cc3..1076db5 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -148,7 +148,7 @@
crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const base::FilePath&
output_private_key_path) {
- scoped_ptr<crypto::RSAPrivateKey> key_pair(
+ std::unique_ptr<crypto::RSAPrivateKey> key_pair(
crypto::RSAPrivateKey::Create(kRSAKeySize));
if (!key_pair) {
error_message_ =
@@ -212,12 +212,12 @@
bool ExtensionCreator::SignZip(const base::FilePath& zip_path,
crypto::RSAPrivateKey* private_key,
std::vector<uint8_t>* signature) {
- scoped_ptr<crypto::SignatureCreator> signature_creator(
+ std::unique_ptr<crypto::SignatureCreator> signature_creator(
crypto::SignatureCreator::Create(private_key,
crypto::SignatureCreator::SHA1));
base::ScopedFILE zip_handle(base::OpenFile(zip_path, "rb"));
size_t buffer_size = 1 << 16;
- scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
int bytes_read = -1;
while ((bytes_read = fread(buffer.get(), 1, buffer_size,
zip_handle.get())) > 0) {
@@ -253,7 +253,7 @@
CHECK(private_key->ExportPublicKey(&public_key));
crx_file::CrxFile::Error error;
- scoped_ptr<crx_file::CrxFile> crx(
+ std::unique_ptr<crx_file::CrxFile> crx(
crx_file::CrxFile::Create(public_key.size(), signature.size(), &error));
if (!crx) {
LOG(ERROR) << "cannot create CrxFileHeader: " << error;
@@ -273,7 +273,7 @@
}
size_t buffer_size = 1 << 16;
- scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
size_t bytes_read = 0;
base::ScopedFILE zip_handle(base::OpenFile(zip_path, "rb"));
while ((bytes_read = fread(buffer.get(), 1, buffer_size,
@@ -299,7 +299,7 @@
}
// Initialize Key Pair
- scoped_ptr<crypto::RSAPrivateKey> key_pair;
+ std::unique_ptr<crypto::RSAPrivateKey> key_pair;
if (!private_key_path.value().empty())
key_pair.reset(ReadInputKey(private_key_path));
else
diff --git a/chrome/browser/extensions/extension_creator_filter_unittest.cc b/chrome/browser/extensions/extension_creator_filter_unittest.cc
index af333029..f50c607 100644
--- a/chrome/browser/extensions/extension_creator_filter_unittest.cc
+++ b/chrome/browser/extensions/extension_creator_filter_unittest.cc
@@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/extension_creator_filter.h"
+
#include <stddef.h>
+#include <memory>
+
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
-#include "chrome/browser/extensions/extension_creator_filter.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc
index bf81cb5..1773714 100644
--- a/chrome/browser/extensions/extension_disabled_ui.cc
+++ b/chrome/browser/extensions/extension_disabled_ui.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/extension_disabled_ui.h"
#include <bitset>
+#include <memory>
#include <string>
#include <utility>
@@ -12,8 +13,8 @@
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/scoped_observer.h"
#include "base/single_thread_task_runner.h"
@@ -71,9 +72,10 @@
class ExtensionDisabledDialogDelegate {
public:
- ExtensionDisabledDialogDelegate(ExtensionService* service,
- scoped_ptr<ExtensionInstallPrompt> install_ui,
- const Extension* extension);
+ ExtensionDisabledDialogDelegate(
+ ExtensionService* service,
+ std::unique_ptr<ExtensionInstallPrompt> install_ui,
+ const Extension* extension);
private:
~ExtensionDisabledDialogDelegate();
@@ -81,7 +83,7 @@
void InstallPromptDone(ExtensionInstallPrompt::Result result);
// The UI for showing the install dialog when enabling.
- scoped_ptr<ExtensionInstallPrompt> install_ui_;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui_;
ExtensionService* service_;
const Extension* extension_;
@@ -91,7 +93,7 @@
ExtensionDisabledDialogDelegate::ExtensionDisabledDialogDelegate(
ExtensionService* service,
- scoped_ptr<ExtensionInstallPrompt> install_ui,
+ std::unique_ptr<ExtensionInstallPrompt> install_ui,
const Extension* extension)
: install_ui_(std::move(install_ui)),
service_(service),
@@ -105,7 +107,7 @@
base::Bind(&ExtensionDisabledDialogDelegate::InstallPromptDone,
base::Unretained(this)),
extension_, nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
}
@@ -191,7 +193,7 @@
};
UserResponse user_response_;
- scoped_ptr<extensions::ExtensionUninstallDialog> uninstall_dialog_;
+ std::unique_ptr<extensions::ExtensionUninstallDialog> uninstall_dialog_;
// Helper to get menu command ID assigned for this extension's error.
extensions::ExtensionInstallErrorMenuItemIdProvider id_provider_;
@@ -494,7 +496,7 @@
void ShowExtensionDisabledDialog(ExtensionService* service,
content::WebContents* web_contents,
const Extension* extension) {
- scoped_ptr<ExtensionInstallPrompt> install_ui(
+ std::unique_ptr<ExtensionInstallPrompt> install_ui(
new ExtensionInstallPrompt(web_contents));
// This object manages its own lifetime.
new ExtensionDisabledDialogDelegate(service, std::move(install_ui),
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
index 823ea85..912a772f 100644
--- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/memory/ptr_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -217,8 +218,8 @@
sync_service->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
extensions::TestExtensionRegistryObserver install_observer(registry_);
sync_service->ProcessSyncChanges(
FROM_HERE,
@@ -274,8 +275,8 @@
ExtensionSyncService* sync_service = ExtensionSyncService::Get(profile());
sync_service->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
extensions::TestExtensionRegistryObserver install_observer(registry_);
sync_service->ProcessSyncChanges(
FROM_HERE,
diff --git a/chrome/browser/extensions/extension_error_controller.h b/chrome/browser/extensions/extension_error_controller.h
index 784f78d..356f6652 100644
--- a/chrome/browser/extensions/extension_error_controller.h
+++ b/chrome/browser/extensions/extension_error_controller.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_CONTROLLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_CONTROLLER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_error_ui.h"
#include "extensions/common/extension_set.h"
@@ -52,7 +53,7 @@
ExtensionSet blacklisted_extensions_;
// The UI component of this controller.
- scoped_ptr<ExtensionErrorUI> error_ui_;
+ std::unique_ptr<ExtensionErrorUI> error_ui_;
// The BrowserContext with which we are associated.
content::BrowserContext* browser_context_;
diff --git a/chrome/browser/extensions/extension_error_ui_default.h b/chrome/browser/extensions/extension_error_ui_default.h
index 2a33491..eb65122 100644
--- a/chrome/browser/extensions/extension_error_ui_default.h
+++ b/chrome/browser/extensions/extension_error_ui_default.h
@@ -57,7 +57,7 @@
// The browser the bubble view was shown into.
Browser* browser_;
- scoped_ptr<ExtensionGlobalError> global_error_;
+ std::unique_ptr<ExtensionGlobalError> global_error_;
DISALLOW_COPY_AND_ASSIGN(ExtensionErrorUIDefault);
};
diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc
index 0446ff3..8c5d3e0 100644
--- a/chrome/browser/extensions/extension_function_test_utils.cc
+++ b/chrome/browser/extensions/extension_function_test_utils.cc
@@ -50,7 +50,7 @@
namespace extension_function_test_utils {
base::ListValue* ParseList(const std::string& data) {
- scoped_ptr<base::Value> result = base::JSONReader::Read(data);
+ std::unique_ptr<base::Value> result = base::JSONReader::Read(data);
base::ListValue* list = NULL;
result->GetAsList(&list);
ignore_result(result.release());
@@ -155,7 +155,7 @@
}
private:
- scoped_ptr<bool> response_;
+ std::unique_ptr<bool> response_;
bool should_post_quit_;
};
@@ -163,18 +163,18 @@
const std::string& args,
Browser* browser,
RunFunctionFlags flags) {
- scoped_ptr<base::ListValue> parsed_args(ParseList(args));
+ std::unique_ptr<base::ListValue> parsed_args(ParseList(args));
EXPECT_TRUE(parsed_args.get())
<< "Could not parse extension function arguments: " << args;
return RunFunction(function, std::move(parsed_args), browser, flags);
}
bool RunFunction(UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
Browser* browser,
RunFunctionFlags flags) {
TestFunctionDispatcherDelegate dispatcher_delegate(browser);
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher(
new extensions::ExtensionFunctionDispatcher(browser->profile()));
dispatcher->set_delegate(&dispatcher_delegate);
// TODO(yoz): The cast is a hack; these flags should be defined in
diff --git a/chrome/browser/extensions/extension_function_test_utils.h b/chrome/browser/extensions/extension_function_test_utils.h
index f19d506f..230d7397 100644
--- a/chrome/browser/extensions/extension_function_test_utils.h
+++ b/chrome/browser/extensions/extension_function_test_utils.h
@@ -23,7 +23,7 @@
class Extension;
}
-// TODO(ckehoe): Accept args as scoped_ptr<base::Value>,
+// TODO(ckehoe): Accept args as std::unique_ptr<base::Value>,
// and migrate existing users to the new API.
// This file is DEPRECATED. New tests should use the versions in
// extensions/browser/api_test_utils.h.
@@ -88,7 +88,7 @@
Browser* browser,
RunFunctionFlags flags);
bool RunFunction(UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
Browser* browser,
RunFunctionFlags flags);
diff --git a/chrome/browser/extensions/extension_garbage_collector.cc b/chrome/browser/extensions/extension_garbage_collector.cc
index ff9e72a..e24e5ad 100644
--- a/chrome/browser/extensions/extension_garbage_collector.cc
+++ b/chrome/browser/extensions/extension_garbage_collector.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/extension_garbage_collector.h"
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -12,7 +14,6 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
@@ -184,7 +185,7 @@
return;
}
- scoped_ptr<ExtensionPrefs::ExtensionsInfo> info(
+ std::unique_ptr<ExtensionPrefs::ExtensionsInfo> info(
extension_prefs->GetInstalledExtensionsInfo());
std::multimap<std::string, base::FilePath> extension_paths;
for (size_t i = 0; i < info->size(); ++i) {
@@ -218,9 +219,9 @@
return;
extension_prefs->SetNeedsStorageGarbageCollection(false);
- scoped_ptr<base::hash_set<base::FilePath> > active_paths(
+ std::unique_ptr<base::hash_set<base::FilePath>> active_paths(
new base::hash_set<base::FilePath>());
- scoped_ptr<ExtensionSet> extensions =
+ std::unique_ptr<ExtensionSet> extensions =
ExtensionRegistry::Get(context_)->GenerateInstalledExtensionsSet();
for (ExtensionSet::const_iterator iter = extensions->begin();
iter != extensions->end();
diff --git a/chrome/browser/extensions/extension_garbage_collector_chromeos_unittest.cc b/chrome/browser/extensions/extension_garbage_collector_chromeos_unittest.cc
index 69eebcb..7088af28 100644
--- a/chrome/browser/extensions/extension_garbage_collector_chromeos_unittest.cc
+++ b/chrome/browser/extensions/extension_garbage_collector_chromeos_unittest.cc
@@ -143,7 +143,7 @@
}
private:
- scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
+ std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
base::ScopedTempDir cache_dir_;
};
diff --git a/chrome/browser/extensions/extension_garbage_collector_factory.cc b/chrome/browser/extensions/extension_garbage_collector_factory.cc
index a9d2583..3c2982b1 100644
--- a/chrome/browser/extensions/extension_garbage_collector_factory.cc
+++ b/chrome/browser/extensions/extension_garbage_collector_factory.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/extension_garbage_collector_factory.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_garbage_collector.h"
@@ -43,12 +44,13 @@
ExtensionGarbageCollectorFactory::~ExtensionGarbageCollectorFactory() {}
// static
-scoped_ptr<KeyedService> ExtensionGarbageCollectorFactory::BuildInstanceFor(
+std::unique_ptr<KeyedService>
+ExtensionGarbageCollectorFactory::BuildInstanceFor(
content::BrowserContext* context) {
#if defined(OS_CHROMEOS)
- return make_scoped_ptr(new ExtensionGarbageCollectorChromeOS(context));
+ return base::WrapUnique(new ExtensionGarbageCollectorChromeOS(context));
#else
- return make_scoped_ptr(new ExtensionGarbageCollector(context));
+ return base::WrapUnique(new ExtensionGarbageCollector(context));
#endif
}
diff --git a/chrome/browser/extensions/extension_garbage_collector_factory.h b/chrome/browser/extensions/extension_garbage_collector_factory.h
index 6f49f30..5cbbb60 100644
--- a/chrome/browser/extensions/extension_garbage_collector_factory.h
+++ b/chrome/browser/extensions/extension_garbage_collector_factory.h
@@ -27,7 +27,7 @@
static ExtensionGarbageCollectorFactory* GetInstance();
- static scoped_ptr<KeyedService> BuildInstanceFor(
+ static std::unique_ptr<KeyedService> BuildInstanceFor(
content::BrowserContext* context);
private:
diff --git a/chrome/browser/extensions/extension_gcm_app_handler.h b/chrome/browser/extensions/extension_gcm_app_handler.h
index 81d6efcd..8b43c68 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler.h
+++ b/chrome/browser/extensions/extension_gcm_app_handler.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_GCM_APP_HANDLER_H_
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "components/gcm_driver/common/gcm_messages.h"
@@ -100,7 +100,7 @@
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
- scoped_ptr<extensions::GcmJsEventRouter> js_event_router_;
+ std::unique_ptr<extensions::GcmJsEventRouter> js_event_router_;
base::WeakPtrFactory<ExtensionGCMAppHandler> weak_factory_;
diff --git a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
index c0777dd9..30024f8 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
+++ b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/extension_gcm_app_handler.h"
+#include <memory>
#include <vector>
#include "base/bind.h"
@@ -15,8 +16,8 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
@@ -129,7 +130,7 @@
base::Bind(&Waiter::PumpIOLoopCompleted, base::Unretained(this)));
}
- scoped_ptr<base::RunLoop> run_loop_;
+ std::unique_ptr<base::RunLoop> run_loop_;
DISALLOW_COPY_AND_ASSIGN(Waiter);
};
@@ -195,7 +196,7 @@
class ExtensionGCMAppHandlerTest : public testing::Test {
public:
- static scoped_ptr<KeyedService> BuildGCMProfileService(
+ static std::unique_ptr<KeyedService> BuildGCMProfileService(
content::BrowserContext* context) {
Profile* profile = Profile::FromBrowserContext(context);
scoped_refptr<base::SequencedTaskRunner> ui_thread =
@@ -210,15 +211,15 @@
worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
worker_pool->GetSequenceToken(),
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
- return make_scoped_ptr(new gcm::GCMProfileService(
+ return base::WrapUnique(new gcm::GCMProfileService(
profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(),
chrome::GetChannel(),
- scoped_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider(
+ std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider(
SigninManagerFactory::GetForProfile(profile),
ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(
profile))),
- make_scoped_ptr(new gcm::FakeGCMClientFactory(ui_thread, io_thread)),
+ base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)),
ui_thread, io_thread, blocking_task_runner));
}
@@ -396,10 +397,10 @@
}
private:
- scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
- scoped_ptr<content::InProcessUtilityThreadHelper>
+ std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
+ std::unique_ptr<content::InProcessUtilityThreadHelper>
in_process_utility_thread_helper_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ExtensionService* extension_service_; // Not owned.
base::ScopedTempDir temp_dir_;
@@ -407,11 +408,11 @@
#if defined(OS_CHROMEOS)
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
Waiter waiter_;
- scoped_ptr<FakeExtensionGCMAppHandler> gcm_app_handler_;
+ std::unique_ptr<FakeExtensionGCMAppHandler> gcm_app_handler_;
gcm::GCMClient::Result registration_result_;
gcm::GCMClient::Result unregistration_result_;
diff --git a/chrome/browser/extensions/extension_icon_manager.cc b/chrome/browser/extensions/extension_icon_manager.cc
index 2202cd0..cec9a5b 100644
--- a/chrome/browser/extensions/extension_icon_manager.cc
+++ b/chrome/browser/extensions/extension_icon_manager.cc
@@ -34,11 +34,10 @@
// around the original bitmap.
static SkBitmap ApplyPadding(const SkBitmap& source,
const gfx::Insets& padding) {
- scoped_ptr<gfx::Canvas> result(
+ std::unique_ptr<gfx::Canvas> result(
new gfx::Canvas(gfx::Size(source.width() + padding.width(),
source.height() + padding.height()),
- 1.0f,
- false));
+ 1.0f, false));
result->DrawImageInt(
gfx::ImageSkia::CreateFrom1xBitmap(source),
0, 0, source.width(), source.height(),
diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc
index a2b1576..3c5ff80 100644
--- a/chrome/browser/extensions/extension_icon_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc
@@ -102,7 +102,7 @@
// Tests loading an icon for an extension, removing it, then re-loading it.
TEST_F(ExtensionIconManagerTest, LoadRemoveLoad) {
- scoped_ptr<Profile> profile(new TestingProfile());
+ std::unique_ptr<Profile> profile(new TestingProfile());
SkBitmap default_icon = GetDefaultIcon();
base::FilePath test_dir;
@@ -111,7 +111,7 @@
"extensions/image_loading_tracker/app.json");
JSONFileValueDeserializer deserializer(manifest_path);
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
base::DictionaryValue::From(deserializer.Deserialize(NULL, NULL));
ASSERT_TRUE(manifest.get() != NULL);
@@ -144,7 +144,7 @@
#if defined(OS_CHROMEOS)
// Tests loading an icon for a component extension.
TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) {
- scoped_ptr<Profile> profile(new TestingProfile());
+ std::unique_ptr<Profile> profile(new TestingProfile());
SkBitmap default_icon = GetDefaultIcon();
base::FilePath test_dir;
@@ -153,7 +153,7 @@
"extensions/file_manager/app.json");
JSONFileValueDeserializer deserializer(manifest_path);
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
base::DictionaryValue::From(deserializer.Deserialize(NULL, NULL));
ASSERT_TRUE(manifest.get() != NULL);
diff --git a/chrome/browser/extensions/extension_install_checker.h b/chrome/browser/extensions/extension_install_checker.h
index 56d7da7..b73255b 100644
--- a/chrome/browser/extensions/extension_install_checker.h
+++ b/chrome/browser/extensions/extension_install_checker.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_CHECKER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_CHECKER_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "extensions/browser/blacklist_state.h"
@@ -96,7 +96,7 @@
private:
void MaybeInvokeCallback();
- scoped_ptr<RequirementsChecker> requirements_checker_;
+ std::unique_ptr<RequirementsChecker> requirements_checker_;
// The Profile where the extension is being installed in.
Profile* profile_;
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
index 03e38b7..3712420 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -8,6 +8,7 @@
#include "base/callback_helpers.h"
#include "base/location.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -593,7 +594,7 @@
const std::string& localized_name,
const std::string& localized_description,
std::string* error) {
- scoped_ptr<base::DictionaryValue> localized_manifest;
+ std::unique_ptr<base::DictionaryValue> localized_manifest;
if (!localized_name.empty() || !localized_description.empty()) {
localized_manifest.reset(manifest->DeepCopy());
if (!localized_name.empty()) {
@@ -647,14 +648,15 @@
const SkBitmap* icon,
const ShowDialogCallback& show_dialog_callback) {
ShowDialog(done_callback, extension, icon,
- make_scoped_ptr(new Prompt(INSTALL_PROMPT)), show_dialog_callback);
+ base::WrapUnique(new Prompt(INSTALL_PROMPT)),
+ show_dialog_callback);
}
void ExtensionInstallPrompt::ShowDialog(
const DoneCallback& done_callback,
const Extension* extension,
const SkBitmap* icon,
- scoped_ptr<Prompt> prompt,
+ std::unique_ptr<Prompt> prompt,
const ShowDialogCallback& show_dialog_callback) {
ShowDialog(done_callback, extension, icon, std::move(prompt), nullptr,
show_dialog_callback);
@@ -664,8 +666,8 @@
const DoneCallback& done_callback,
const Extension* extension,
const SkBitmap* icon,
- scoped_ptr<Prompt> prompt,
- scoped_ptr<const PermissionSet> custom_permissions,
+ std::unique_ptr<Prompt> prompt,
+ std::unique_ptr<const PermissionSet> custom_permissions,
const ShowDialogCallback& show_dialog_callback) {
DCHECK(ui_loop_ == base::MessageLoop::current());
DCHECK(prompt);
@@ -757,7 +759,7 @@
}
void ExtensionInstallPrompt::ShowConfirmation() {
- scoped_ptr<const PermissionSet> permissions_wrapper;
+ std::unique_ptr<const PermissionSet> permissions_wrapper;
const PermissionSet* permissions_to_display = nullptr;
if (custom_permissions_.get()) {
permissions_to_display = custom_permissions_.get();
diff --git a/chrome/browser/extensions/extension_install_prompt.h b/chrome/browser/extensions/extension_install_prompt.h
index f095087..d5e22aa 100644
--- a/chrome/browser/extensions/extension_install_prompt.h
+++ b/chrome/browser/extensions/extension_install_prompt.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "extensions/common/permissions/permission_message.h"
@@ -263,7 +263,7 @@
typedef base::Callback<void(ExtensionInstallPromptShowParams*,
const DoneCallback&,
- scoped_ptr<ExtensionInstallPrompt::Prompt>)>
+ std::unique_ptr<ExtensionInstallPrompt::Prompt>)>
ShowDialogCallback;
// Callback to show the default extension install dialog.
@@ -320,7 +320,7 @@
void ShowDialog(const DoneCallback& install_callback,
const extensions::Extension* extension,
const SkBitmap* icon,
- scoped_ptr<Prompt> prompt,
+ std::unique_ptr<Prompt> prompt,
const ShowDialogCallback& show_dialog_callback);
// Declared virtual for testing purposes.
// Note: if all you want to do is automatically confirm or cancel, prefer
@@ -329,8 +329,8 @@
const DoneCallback& install_callback,
const extensions::Extension* extension,
const SkBitmap* icon,
- scoped_ptr<Prompt> prompt,
- scoped_ptr<const extensions::PermissionSet> custom_permissions,
+ std::unique_ptr<Prompt> prompt,
+ std::unique_ptr<const extensions::PermissionSet> custom_permissions,
const ShowDialogCallback& show_dialog_callback);
// Installation was successful. This is declared virtual for testing.
@@ -371,19 +371,19 @@
// A custom set of permissions to show in the install prompt instead of the
// extension's active permissions.
- scoped_ptr<const extensions::PermissionSet> custom_permissions_;
+ std::unique_ptr<const extensions::PermissionSet> custom_permissions_;
// The object responsible for doing the UI specific actions.
- scoped_ptr<extensions::ExtensionInstallUI> install_ui_;
+ std::unique_ptr<extensions::ExtensionInstallUI> install_ui_;
// Parameters to show the confirmation UI.
- scoped_ptr<ExtensionInstallPromptShowParams> show_params_;
+ std::unique_ptr<ExtensionInstallPromptShowParams> show_params_;
// The callback to run with the result.
DoneCallback done_callback_;
// A pre-filled prompt.
- scoped_ptr<Prompt> prompt_;
+ std::unique_ptr<Prompt> prompt_;
// Used to show the confirm dialog.
ShowDialogCallback show_dialog_callback_;
diff --git a/chrome/browser/extensions/extension_install_prompt_show_params.h b/chrome/browser/extensions/extension_install_prompt_show_params.h
index 97cc71d..9e5c676 100644
--- a/chrome/browser/extensions/extension_install_prompt_show_params.h
+++ b/chrome/browser/extensions/extension_install_prompt_show_params.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_SHOW_PARAMS_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_SHOW_PARAMS_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "ui/gfx/native_widget_types.h"
class NativeWindowTracker;
@@ -55,9 +56,10 @@
gfx::NativeWindow parent_window_;
class WebContentsDestructionObserver;
- scoped_ptr<WebContentsDestructionObserver> web_contents_destruction_observer_;
+ std::unique_ptr<WebContentsDestructionObserver>
+ web_contents_destruction_observer_;
- scoped_ptr<NativeWindowTracker> native_window_tracker_;
+ std::unique_ptr<NativeWindowTracker> native_window_tracker_;
DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPromptShowParams);
};
diff --git a/chrome/browser/extensions/extension_install_prompt_test_helper.h b/chrome/browser/extensions/extension_install_prompt_test_helper.h
index dd7d2a9..bcdefff 100644
--- a/chrome/browser/extensions/extension_install_prompt_test_helper.h
+++ b/chrome/browser/extensions/extension_install_prompt_test_helper.h
@@ -27,7 +27,7 @@
private:
void HandleResult(ExtensionInstallPrompt::Result result);
- scoped_ptr<ExtensionInstallPrompt::Result> result_;
+ std::unique_ptr<ExtensionInstallPrompt::Result> result_;
// A closure to run once HandleResult() has been called; used for exiting
// run loops in tests.
diff --git a/chrome/browser/extensions/extension_install_prompt_unittest.cc b/chrome/browser/extensions/extension_install_prompt_unittest.cc
index 64b095a7..63f35a92 100644
--- a/chrome/browser/extensions/extension_install_prompt_unittest.cc
+++ b/chrome/browser/extensions/extension_install_prompt_unittest.cc
@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/extension_install_prompt.h"
+
#include <stddef.h>
#include <utility>
#include "base/bind.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
-#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_install_prompt_show_params.h"
#include "chrome/browser/extensions/extension_service_test_with_install.h"
#include "chrome/browser/extensions/extension_util.h"
@@ -42,7 +44,7 @@
const SkBitmap& expected_bitmap,
ExtensionInstallPromptShowParams* params,
const ExtensionInstallPrompt::DoneCallback& done_callback,
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) {
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) {
EXPECT_TRUE(gfx::BitmapsAreEqual(prompt->icon().AsBitmap(), expected_bitmap));
quit_closure.Run();
}
@@ -53,7 +55,7 @@
size_t withheld_permissions_count,
ExtensionInstallPromptShowParams* params,
const ExtensionInstallPrompt::DoneCallback& done_callback,
- scoped_ptr<ExtensionInstallPrompt::Prompt> install_prompt) {
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> install_prompt) {
ASSERT_TRUE(install_prompt.get());
EXPECT_EQ(regular_permissions_count,
install_prompt->GetPermissionCount(
@@ -88,7 +90,7 @@
private:
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPromptUnitTest);
};
@@ -98,7 +100,7 @@
TEST_F(ExtensionInstallPromptUnitTest, PromptShowsPermissionWarnings) {
APIPermissionSet api_permissions;
api_permissions.insert(APIPermission::kTab);
- scoped_ptr<const PermissionSet> permission_set(
+ std::unique_ptr<const PermissionSet> permission_set(
new PermissionSet(api_permissions, ManifestPermissionSet(),
URLPatternSet(), URLPatternSet()));
scoped_refptr<const Extension> extension =
@@ -116,7 +118,7 @@
base::RunLoop run_loop;
prompt.ShowDialog(
ExtensionInstallPrompt::DoneCallback(), extension.get(), nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::PERMISSIONS_PROMPT)),
std::move(permission_set),
base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(),
@@ -180,7 +182,7 @@
ExtensionInstallPrompt prompt(factory.CreateWebContents(profile()));
base::RunLoop run_loop;
- scoped_ptr<ExtensionInstallPrompt::Prompt> sub_prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> sub_prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::DELEGATED_PERMISSIONS_PROMPT));
sub_prompt->set_delegated_username("Username");
diff --git a/chrome/browser/extensions/extension_install_ui_util.cc b/chrome/browser/extensions/extension_install_ui_util.cc
index 425e704..fe90f8d 100644
--- a/chrome/browser/extensions/extension_install_ui_util.cc
+++ b/chrome/browser/extensions/extension_install_ui_util.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/extensions/extension_install_ui_util.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "chrome/browser/ui/extensions/extension_install_ui_factory.h"
#include "extensions/browser/install/extension_install_ui.h"
@@ -14,7 +15,7 @@
void ShowPostInstallUIForApproval(content::BrowserContext* context,
const WebstoreInstaller::Approval& approval,
const Extension* extension) {
- scoped_ptr<ExtensionInstallUI> install_ui(
+ std::unique_ptr<ExtensionInstallUI> install_ui(
extensions::CreateExtensionInstallUI(context));
install_ui->SetUseAppInstalledBubble(approval.use_app_installed_bubble);
install_ui->SetSkipPostInstallUI(approval.skip_post_install_ui);
diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc
index 69e09f2..c9df30e3 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.cc
+++ b/chrome/browser/extensions/extension_keybinding_registry.cc
@@ -119,11 +119,11 @@
if (granter)
granter->GrantIfRequested(extension);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(new base::StringValue(command));
- scoped_ptr<Event> event(new Event(events::COMMANDS_ON_COMMAND,
- kOnCommandEventName, std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::COMMANDS_ON_COMMAND,
+ kOnCommandEventName, std::move(args)));
event->restrict_to_browser_context = browser_context_;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
EventRouter::Get(browser_context_)
diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc
index c3efdcb..ab812b3 100644
--- a/chrome/browser/extensions/extension_management.cc
+++ b/chrome/browser/extensions/extension_management.cc
@@ -105,9 +105,10 @@
return default_settings_->installation_mode;
}
-scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList()
- const {
- scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
+std::unique_ptr<base::DictionaryValue>
+ExtensionManagement::GetForceInstallList() const {
+ std::unique_ptr<base::DictionaryValue> install_list(
+ new base::DictionaryValue());
for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
it != settings_by_id_.end();
++it) {
@@ -119,9 +120,10 @@
return install_list;
}
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
ExtensionManagement::GetRecommendedInstallList() const {
- scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> install_list(
+ new base::DictionaryValue());
for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
it != settings_by_id_.end();
++it) {
@@ -205,10 +207,10 @@
return default_settings_->blocked_permissions;
}
-scoped_ptr<const PermissionSet> ExtensionManagement::GetBlockedPermissions(
+std::unique_ptr<const PermissionSet> ExtensionManagement::GetBlockedPermissions(
const Extension* extension) const {
// Only api permissions are supported currently.
- return scoped_ptr<const PermissionSet>(new PermissionSet(
+ return std::unique_ptr<const PermissionSet>(new PermissionSet(
GetBlockedAPIPermissions(extension), ManifestPermissionSet(),
URLPatternSet(), URLPatternSet()));
}
@@ -441,7 +443,7 @@
DCHECK(crx_file::id_util::IdIsValid(id)) << "Invalid ID: " << id;
SettingsIdMap::iterator it = settings_by_id_.find(id);
if (it == settings_by_id_.end()) {
- scoped_ptr<internal::IndividualSettings> settings(
+ std::unique_ptr<internal::IndividualSettings> settings(
new internal::IndividualSettings(default_settings_.get()));
it = settings_by_id_.add(id, std::move(settings)).first;
}
@@ -453,7 +455,7 @@
DCHECK(GURL(update_url).is_valid()) << "Invalid update URL: " << update_url;
SettingsUpdateUrlMap::iterator it = settings_by_update_url_.find(update_url);
if (it == settings_by_update_url_.end()) {
- scoped_ptr<internal::IndividualSettings> settings(
+ std::unique_ptr<internal::IndividualSettings> settings(
new internal::IndividualSettings(default_settings_.get()));
it = settings_by_update_url_.add(update_url, std::move(settings)).first;
}
diff --git a/chrome/browser/extensions/extension_management.h b/chrome/browser/extensions/extension_management.h
index c9b7204..1d85c98 100644
--- a/chrome/browser/extensions/extension_management.h
+++ b/chrome/browser/extensions/extension_management.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
@@ -93,10 +93,10 @@
// Returns the force install list, in format specified by
// ExternalPolicyLoader::AddExtension().
- scoped_ptr<base::DictionaryValue> GetForceInstallList() const;
+ std::unique_ptr<base::DictionaryValue> GetForceInstallList() const;
// Like GetForceInstallList(), but returns recommended install list instead.
- scoped_ptr<base::DictionaryValue> GetRecommendedInstallList() const;
+ std::unique_ptr<base::DictionaryValue> GetRecommendedInstallList() const;
// Returns if an extension with id |id| is explicitly allowed by enterprise
// policy or not.
@@ -114,7 +114,7 @@
APIPermissionSet GetBlockedAPIPermissions(const Extension* extension) const;
// Returns blocked permission set for |extension|.
- scoped_ptr<const PermissionSet> GetBlockedPermissions(
+ std::unique_ptr<const PermissionSet> GetBlockedPermissions(
const Extension* extension) const;
// Returns true if every permission in |perms| is allowed for |extension|.
@@ -130,10 +130,10 @@
private:
typedef base::ScopedPtrHashMap<ExtensionId,
- scoped_ptr<internal::IndividualSettings>>
+ std::unique_ptr<internal::IndividualSettings>>
SettingsIdMap;
typedef base::ScopedPtrHashMap<std::string,
- scoped_ptr<internal::IndividualSettings>>
+ std::unique_ptr<internal::IndividualSettings>>
SettingsUpdateUrlMap;
friend class ExtensionManagementServiceTest;
@@ -177,10 +177,10 @@
// URL), all unspecified part will take value from |default_settings_|.
// For all other extensions, all settings from |default_settings_| will be
// enforced.
- scoped_ptr<internal::IndividualSettings> default_settings_;
+ std::unique_ptr<internal::IndividualSettings> default_settings_;
// Extension settings applicable to all extensions.
- scoped_ptr<internal::GlobalSettings> global_settings_;
+ std::unique_ptr<internal::GlobalSettings> global_settings_;
PrefService* pref_service_;
diff --git a/chrome/browser/extensions/extension_management_internal.cc b/chrome/browser/extensions/extension_management_internal.cc
index 2673477a..a472df7 100644
--- a/chrome/browser/extensions/extension_management_internal.cc
+++ b/chrome/browser/extensions/extension_management_internal.cc
@@ -137,7 +137,7 @@
dict->GetStringWithoutPathExpansion(
schema_constants::kMinimumVersionRequired,
&minimum_version_required_str)) {
- scoped_ptr<base::Version> version(
+ std::unique_ptr<base::Version> version(
new Version(minimum_version_required_str));
// We accept a general version string here. Note that count of components in
// version string of extensions is limited to 4.
diff --git a/chrome/browser/extensions/extension_management_internal.h b/chrome/browser/extensions/extension_management_internal.h
index 36eb6ccd..d3d63be 100644
--- a/chrome/browser/extensions/extension_management_internal.h
+++ b/chrome/browser/extensions/extension_management_internal.h
@@ -91,7 +91,7 @@
// Minimum version required for an extensions, applies to per-extension
// settings only. Extension (with specified extension ID) with version older
// than the specified minimum version will be disabled.
- scoped_ptr<base::Version> minimum_version_required;
+ std::unique_ptr<base::Version> minimum_version_required;
private:
DISALLOW_COPY_AND_ASSIGN(IndividualSettings);
diff --git a/chrome/browser/extensions/extension_management_test_util.cc b/chrome/browser/extensions/extension_management_test_util.cc
index b33464f..65b75ad 100644
--- a/chrome/browser/extensions/extension_management_test_util.cc
+++ b/chrome/browser/extensions/extension_management_test_util.cc
@@ -215,7 +215,7 @@
pref_.reset(pref);
}
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
ExtensionManagementPrefUpdaterBase::TakePref() {
return std::move(pref_);
}
diff --git a/chrome/browser/extensions/extension_management_test_util.h b/chrome/browser/extensions/extension_management_test_util.h
index 1a34783..4558f7d 100644
--- a/chrome/browser/extensions/extension_management_test_util.h
+++ b/chrome/browser/extensions/extension_management_test_util.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_TEST_UTIL_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_management_constants.h"
#include "extensions/browser/pref_names.h"
@@ -88,7 +88,7 @@
// Take the preference. Caller takes ownership of it as well.
// This function must be called after accessing publicly exposed functions,
// for example in destructor of subclass.
- scoped_ptr<base::DictionaryValue> TakePref();
+ std::unique_ptr<base::DictionaryValue> TakePref();
private:
// Helper functions for manipulating sub properties like list of strings.
@@ -96,7 +96,7 @@
void AddStringToList(const std::string& path, const std::string& str);
void RemoveStringFromList(const std::string& path, const std::string& str);
- scoped_ptr<base::DictionaryValue> pref_;
+ std::unique_ptr<base::DictionaryValue> pref_;
DISALLOW_COPY_AND_ASSIGN(ExtensionManagementPrefUpdaterBase);
};
@@ -140,7 +140,7 @@
private:
policy::MockConfigurationPolicyProvider* provider_;
- scoped_ptr<policy::PolicyBundle> policies_;
+ std::unique_ptr<policy::PolicyBundle> policies_;
DISALLOW_COPY_AND_ASSIGN(ExtensionManagementPolicyUpdater);
};
diff --git a/chrome/browser/extensions/extension_management_unittest.cc b/chrome/browser/extensions/extension_management_unittest.cc
index 8fe024dd..69aae3c0 100644
--- a/chrome/browser/extensions/extension_management_unittest.cc
+++ b/chrome/browser/extensions/extension_management_unittest.cc
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/extension_management.h"
+
#include <algorithm>
+#include <memory>
#include <string>
#include <vector>
#include "base/json/json_parser.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_management_internal.h"
#include "chrome/browser/extensions/extension_management_test_util.h"
#include "chrome/browser/extensions/external_policy_loader.h"
@@ -149,7 +150,7 @@
void SetExampleDictPref() {
std::string error_msg;
- scoped_ptr<base::Value> parsed = base::JSONReader::ReadAndReturnError(
+ std::unique_ptr<base::Value> parsed = base::JSONReader::ReadAndReturnError(
kExampleDictPreference,
base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, NULL, &error_msg);
ASSERT_TRUE(parsed && parsed->IsType(base::Value::TYPE_DICTIONARY))
@@ -191,8 +192,8 @@
}
protected:
- scoped_ptr<TestingPrefServiceSimple> pref_service_;
- scoped_ptr<ExtensionManagement> extension_management_;
+ std::unique_ptr<TestingPrefServiceSimple> pref_service_;
+ std::unique_ptr<ExtensionManagement> extension_management_;
private:
// Create an extension with specified |location|, |version|, |id| and
@@ -260,7 +261,7 @@
bool MustRemainEnabled(const Extension* extension, base::string16* error);
protected:
- scoped_ptr<StandardManagementPolicyProvider> provider_;
+ std::unique_ptr<StandardManagementPolicyProvider> provider_;
scoped_refptr<Extension> extension_;
};
diff --git a/chrome/browser/extensions/extension_message_bubble_controller.cc b/chrome/browser/extensions/extension_message_bubble_controller.cc
index 7c9d2ce..28cb4ad6 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller.cc
+++ b/chrome/browser/extensions/extension_message_bubble_controller.cc
@@ -244,7 +244,7 @@
ExtensionIdList* ExtensionMessageBubbleController::GetOrCreateExtensionList() {
if (!initialized_) {
ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
- scoped_ptr<const ExtensionSet> all_extensions;
+ std::unique_ptr<const ExtensionSet> all_extensions;
if (!delegate_->ShouldLimitToEnabledExtensions())
all_extensions = registry->GenerateInstalledExtensionsSet();
const ExtensionSet& extensions_to_check =
diff --git a/chrome/browser/extensions/extension_message_bubble_controller.h b/chrome/browser/extensions/extension_message_bubble_controller.h
index c025d24..11b5836 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller.h
+++ b/chrome/browser/extensions/extension_message_bubble_controller.h
@@ -183,7 +183,7 @@
BubbleAction user_action_;
// Our delegate supplying information about what to show in the dialog.
- scoped_ptr<Delegate> delegate_;
+ std::unique_ptr<Delegate> delegate_;
// Whether this class has initialized.
bool initialized_;
diff --git a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
index 9cae7a2..1181748 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
+++ b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
@@ -9,6 +9,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -46,9 +47,9 @@
const char kId2[] = "ajjhifimiemdpmophmkkkcijegphclbl";
const char kId3[] = "ioibbbfddncmmabjmpokikkeiofalaek";
-scoped_ptr<KeyedService> BuildOverrideRegistrar(
+std::unique_ptr<KeyedService> BuildOverrideRegistrar(
content::BrowserContext* context) {
- return make_scoped_ptr(
+ return base::WrapUnique(
new extensions::ExtensionWebUIOverrideRegistrar(context));
}
@@ -330,7 +331,7 @@
Manifest::Location location,
const std::string& data,
const std::string& id) {
- scoped_ptr<base::DictionaryValue> parsed_manifest(
+ std::unique_ptr<base::DictionaryValue> parsed_manifest(
api_test_utils::ParseDictionary(data));
return api_test_utils::CreateExtension(location, parsed_manifest.get(), id);
}
@@ -338,7 +339,7 @@
ExtensionService* service_;
private:
- scoped_ptr<base::CommandLine> command_line_;
+ std::unique_ptr<base::CommandLine> command_line_;
DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleTest);
};
@@ -348,7 +349,7 @@
ASSERT_TRUE(LoadExtensionOverridingNtp("1", kId1, Manifest::INTERNAL));
ASSERT_TRUE(LoadExtensionOverridingNtp("2", kId2, Manifest::INTERNAL));
- scoped_ptr<TestExtensionMessageBubbleController> controller(
+ std::unique_ptr<TestExtensionMessageBubbleController> controller(
new TestExtensionMessageBubbleController(
new NtpOverriddenBubbleDelegate(browser()->profile()), browser()));
@@ -417,7 +418,7 @@
ASSERT_TRUE(LoadGenericExtension("2", kId2, Manifest::UNPACKED));
ASSERT_TRUE(LoadGenericExtension("3", kId3, Manifest::EXTERNAL_POLICY));
- scoped_ptr<TestExtensionMessageBubbleController> controller(
+ std::unique_ptr<TestExtensionMessageBubbleController> controller(
new TestExtensionMessageBubbleController(
new SuspiciousExtensionBubbleDelegate(browser()->profile()),
browser()));
@@ -496,10 +497,9 @@
ASSERT_TRUE(LoadGenericExtension("2", kId2, Manifest::UNPACKED));
ASSERT_TRUE(LoadGenericExtension("3", kId3, Manifest::EXTERNAL_POLICY));
- scoped_ptr<TestExtensionMessageBubbleController> controller(
+ std::unique_ptr<TestExtensionMessageBubbleController> controller(
new TestExtensionMessageBubbleController(
- new DevModeBubbleDelegate(browser()->profile()),
- browser()));
+ new DevModeBubbleDelegate(browser()->profile()), browser()));
// The list will contain one enabled unpacked extension.
EXPECT_TRUE(controller->ShouldShow());
@@ -630,7 +630,7 @@
}
SettingsApiOverrideType type = static_cast<SettingsApiOverrideType>(i);
- scoped_ptr<TestExtensionMessageBubbleController> controller(
+ std::unique_ptr<TestExtensionMessageBubbleController> controller(
new TestExtensionMessageBubbleController(
new SettingsApiBubbleDelegate(browser()->profile(), type),
browser()));
@@ -741,10 +741,9 @@
ASSERT_TRUE(LoadExtensionOverridingNtp("2", kId2, Manifest::UNPACKED));
ASSERT_TRUE(LoadExtensionOverridingStart("3", kId3, Manifest::UNPACKED));
- scoped_ptr<TestExtensionMessageBubbleController> controller(
+ std::unique_ptr<TestExtensionMessageBubbleController> controller(
new TestExtensionMessageBubbleController(
- new NtpOverriddenBubbleDelegate(browser()->profile()),
- browser()));
+ new NtpOverriddenBubbleDelegate(browser()->profile()), browser()));
// The list will contain one enabled unpacked extension (ext 2).
EXPECT_TRUE(controller->ShouldShow());
@@ -877,10 +876,9 @@
SetInstallTime(kId2, base::Time::Now(), prefs);
SetInstallTime(kId3, old_enough, prefs);
- scoped_ptr<TestExtensionMessageBubbleController> controller(
+ std::unique_ptr<TestExtensionMessageBubbleController> controller(
new TestExtensionMessageBubbleController(
- new ProxyOverriddenBubbleDelegate(browser()->profile()),
- browser()));
+ new ProxyOverriddenBubbleDelegate(browser()->profile()), browser()));
// The second extension is too new to warn about.
EXPECT_FALSE(controller->ShouldShow());
diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc
index ab7b6d0fd..5a67847 100644
--- a/chrome/browser/extensions/extension_messages_apitest.cc
+++ b/chrome/browser/extensions/extension_messages_apitest.cc
@@ -62,22 +62,23 @@
}
private:
- static scoped_ptr<base::ListValue> BuildEventArguments(
+ static std::unique_ptr<base::ListValue> BuildEventArguments(
const bool last_message,
const std::string& data) {
base::DictionaryValue* event = new base::DictionaryValue();
event->SetBoolean("lastMessage", last_message);
event->SetString("data", data);
- scoped_ptr<base::ListValue> arguments(new base::ListValue());
+ std::unique_ptr<base::ListValue> arguments(new base::ListValue());
arguments->Append(event);
return arguments;
}
- static scoped_ptr<Event> BuildEvent(scoped_ptr<base::ListValue> event_args,
- Profile* profile,
- GURL event_url) {
- scoped_ptr<Event> event(new Event(events::TEST_ON_MESSAGE, "test.onMessage",
- std::move(event_args)));
+ static std::unique_ptr<Event> BuildEvent(
+ std::unique_ptr<base::ListValue> event_args,
+ Profile* profile,
+ GURL event_url) {
+ std::unique_ptr<Event> event(new Event(
+ events::TEST_ON_MESSAGE, "test.onMessage", std::move(event_args)));
event->restrict_to_browser_context = profile;
event->event_url = event_url;
return event;
@@ -1027,7 +1028,7 @@
std::string CreateTlsChannelId() {
scoped_refptr<net::URLRequestContextGetter> request_context_getter(
profile()->GetRequestContext());
- scoped_ptr<crypto::ECPrivateKey> channel_id_key;
+ std::unique_ptr<crypto::ECPrivateKey> channel_id_key;
net::ChannelIDService::Request request;
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
@@ -1051,7 +1052,7 @@
private:
void CreateDomainBoundCertOnIOThread(
- scoped_ptr<crypto::ECPrivateKey>* channel_id_key,
+ std::unique_ptr<crypto::ECPrivateKey>* channel_id_key,
net::ChannelIDService::Request* request,
scoped_refptr<net::URLRequestContextGetter> request_context_getter) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
diff --git a/chrome/browser/extensions/extension_migrator.cc b/chrome/browser/extensions/extension_migrator.cc
index cf27b62..0a6abcd 100644
--- a/chrome/browser/extensions/extension_migrator.cc
+++ b/chrome/browser/extensions/extension_migrator.cc
@@ -29,7 +29,7 @@
const bool should_have_extension =
IsAppPresent(old_id_) || IsAppPresent(new_id_);
if (should_have_extension) {
- scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
entry->SetStringWithoutPathExpansion(
ExternalProviderImpl::kExternalUpdateUrl,
extension_urls::GetWebstoreUpdateUrl().spec());
diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc
index 882bde5a..96eee9e 100644
--- a/chrome/browser/extensions/extension_override_apitest.cc
+++ b/chrome/browser/extensions/extension_override_apitest.cc
@@ -235,7 +235,7 @@
// the file already contains dupes when an extension is loaded.
base::ListValue* list = new base::ListValue();
for (size_t i = 0; i < 3; ++i) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("entry", "http://www.google.com/");
dict->SetBoolean("active", true);
list->Append(std::move(dict));
diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc
index e24698d..151a706 100644
--- a/chrome/browser/extensions/extension_prefs_unittest.cc
+++ b/chrome/browser/extensions/extension_prefs_unittest.cc
@@ -167,10 +167,10 @@
api_perm_set1_.insert(APIPermission::kTab);
api_perm_set1_.insert(APIPermission::kBookmark);
- scoped_ptr<APIPermission> permission(
+ std::unique_ptr<APIPermission> permission(
permission_info->CreateAPIPermission());
{
- scoped_ptr<base::ListValue> value(new base::ListValue());
+ std::unique_ptr<base::ListValue> value(new base::ListValue());
value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
value->Append(new base::StringValue("udp-bind::8080"));
value->Append(new base::StringValue("udp-send-to::8888"));
@@ -217,7 +217,7 @@
extension_id_,
PermissionSet(api_perm_set1_, empty_manifest_permissions,
empty_extent, empty_extent));
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
prefs()->GetGrantedPermissions(extension_id_);
EXPECT_TRUE(granted_permissions.get());
EXPECT_FALSE(granted_permissions->IsEmpty());
@@ -231,7 +231,7 @@
prefs()->AddGrantedPermissions(
extension_id_, PermissionSet(empty_set, empty_manifest_permissions,
ehost_perm_set1_, empty_extent));
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
prefs()->GetGrantedPermissions(extension_id_);
EXPECT_FALSE(granted_permissions->IsEmpty());
EXPECT_FALSE(granted_permissions->HasEffectiveFullAccess());
@@ -245,7 +245,7 @@
prefs()->AddGrantedPermissions(
extension_id_, PermissionSet(empty_set, empty_manifest_permissions,
empty_extent, shost_perm_set1_));
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
prefs()->GetGrantedPermissions(extension_id_);
EXPECT_FALSE(granted_permissions->IsEmpty());
EXPECT_FALSE(granted_permissions->HasEffectiveFullAccess());
@@ -266,7 +266,7 @@
PermissionSet(api_perm_set2_, empty_manifest_permissions,
ehost_perm_set2_, shost_perm_set2_));
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
prefs()->GetGrantedPermissions(extension_id_);
EXPECT_TRUE(granted_permissions.get());
EXPECT_FALSE(granted_permissions->IsEmpty());
@@ -280,7 +280,7 @@
}
void Verify() override {
- scoped_ptr<const PermissionSet> permissions =
+ std::unique_ptr<const PermissionSet> permissions =
prefs()->GetGrantedPermissions(extension_id_);
EXPECT_TRUE(permissions.get());
EXPECT_FALSE(permissions->HasEffectiveFullAccess());
@@ -333,7 +333,7 @@
ehosts, shosts));
// Make sure the active permissions start empty.
- scoped_ptr<const PermissionSet> active =
+ std::unique_ptr<const PermissionSet> active =
prefs()->GetActivePermissions(extension_id_);
EXPECT_TRUE(active->IsEmpty());
@@ -347,14 +347,14 @@
}
void Verify() override {
- scoped_ptr<const PermissionSet> permissions =
+ std::unique_ptr<const PermissionSet> permissions =
prefs()->GetActivePermissions(extension_id_);
EXPECT_EQ(*active_perms_, *permissions);
}
private:
std::string extension_id_;
- scoped_ptr<const PermissionSet> active_perms_;
+ std::unique_ptr<const PermissionSet> active_perms_;
};
TEST_F(ExtensionPrefsActivePermissions, SetAndGetActivePermissions) {}
@@ -466,7 +466,7 @@
// Verifies that we get back expected idle install information previously
// set by SetIdleInfo.
void VerifyIdleInfo(const std::string& id, int num) {
- scoped_ptr<ExtensionInfo> info(prefs()->GetDelayedInstallInfo(id));
+ std::unique_ptr<ExtensionInfo> info(prefs()->GetDelayedInstallInfo(id));
ASSERT_TRUE(info);
std::string version;
ASSERT_TRUE(info->extension_manifest->GetString("version", &version));
@@ -497,7 +497,7 @@
SetIdleInfo(id2_, 2);
VerifyIdleInfo(id1_, 1);
VerifyIdleInfo(id2_, 2);
- scoped_ptr<ExtensionPrefs::ExtensionsInfo> info(
+ std::unique_ptr<ExtensionPrefs::ExtensionsInfo> info(
prefs()->GetAllDelayedInstallInfo());
EXPECT_EQ(2u, info->size());
EXPECT_TRUE(HasInfoForId(info.get(), id1_));
@@ -529,7 +529,7 @@
void Verify() override {
// Make sure the info for the 3 extensions we expect is present.
- scoped_ptr<ExtensionPrefs::ExtensionsInfo> info(
+ std::unique_ptr<ExtensionPrefs::ExtensionsInfo> info(
prefs()->GetAllDelayedInstallInfo());
EXPECT_EQ(3u, info->size());
EXPECT_TRUE(HasInfoForId(info.get(), id1_));
@@ -570,7 +570,7 @@
base::DictionaryValue manifest;
manifest.SetString(manifest_keys::kName, "test");
manifest.SetString(manifest_keys::kVersion, "0.2");
- scoped_ptr<base::ListValue> scripts(new base::ListValue);
+ std::unique_ptr<base::ListValue> scripts(new base::ListValue);
scripts->AppendString("test.js");
manifest.Set(manifest_keys::kBackgroundScripts, scripts.release());
base::FilePath path =
@@ -963,12 +963,12 @@
void Verify() override {
// Component extension can access chrome://print/*.
- scoped_ptr<const PermissionSet> component_permissions =
+ std::unique_ptr<const PermissionSet> component_permissions =
prefs()->GetActivePermissions(component_extension_->id());
EXPECT_EQ(1u, component_permissions->scriptable_hosts().size());
// Non Component extension can not access chrome://print/*.
- scoped_ptr<const PermissionSet> no_component_permissions =
+ std::unique_ptr<const PermissionSet> no_component_permissions =
prefs()->GetActivePermissions(no_component_extension_->id());
EXPECT_EQ(0u, no_component_permissions->scriptable_hosts().size());
@@ -988,7 +988,7 @@
}
private:
- scoped_ptr<const PermissionSet> active_perms_;
+ std::unique_ptr<const PermissionSet> active_perms_;
scoped_refptr<Extension> component_extension_;
scoped_refptr<Extension> no_component_extension_;
};
diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc
index 244bd65..511e8b0 100644
--- a/chrome/browser/extensions/extension_protocols_unittest.cc
+++ b/chrome/browser/extensions/extension_protocols_unittest.cc
@@ -4,11 +4,11 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -160,10 +160,9 @@
false, // incognito_enabled
false); // notifications_disabled
}
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension.GetResourceURL(relative_path),
- net::DEFAULT_PRIORITY,
+ extension.GetResourceURL(relative_path), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MAIN_FRAME);
return request->status().status();
@@ -214,10 +213,9 @@
// It doesn't matter that the resource doesn't exist. If the resource
// is blocked, we should see ADDRESS_UNREACHABLE. Otherwise, the request
// should just fail because the file doesn't exist.
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension->GetResourceURL("404.html"),
- net::DEFAULT_PRIORITY,
+ extension->GetResourceURL("404.html"), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MAIN_FRAME);
EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
@@ -233,10 +231,9 @@
// Now do a subframe request.
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension->GetResourceURL("404.html"),
- net::DEFAULT_PRIORITY,
+ extension->GetResourceURL("404.html"), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_SUB_FRAME);
EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
@@ -276,11 +273,10 @@
// First test it with the extension enabled.
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
extension->GetResourceURL("webstore_icon_16.png"),
- net::DEFAULT_PRIORITY,
- &test_delegate_));
+ net::DEFAULT_PRIORITY, &test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
CheckForContentLengthHeader(request.get());
@@ -290,11 +286,10 @@
extension_info_map_->RemoveExtension(extension->id(),
UnloadedExtensionInfo::REASON_DISABLE);
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
extension->GetResourceURL("webstore_icon_16.png"),
- net::DEFAULT_PRIORITY,
- &test_delegate_));
+ net::DEFAULT_PRIORITY, &test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
CheckForContentLengthHeader(request.get());
@@ -314,10 +309,9 @@
false);
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension->GetResourceURL("test.dat"),
- net::DEFAULT_PRIORITY,
+ extension->GetResourceURL("test.dat"), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
@@ -354,19 +348,17 @@
// All MAIN_FRAME and SUB_FRAME requests should succeed.
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension->GetResourceURL("test.dat"),
- net::DEFAULT_PRIORITY,
+ extension->GetResourceURL("test.dat"), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MAIN_FRAME);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
}
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension->GetResourceURL("test.dat"),
- net::DEFAULT_PRIORITY,
+ extension->GetResourceURL("test.dat"), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_SUB_FRAME);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
@@ -374,10 +366,9 @@
// And subresource types, such as media, should fail.
{
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
resource_context_.GetRequestContext()->CreateRequest(
- extension->GetResourceURL("test.dat"),
- net::DEFAULT_PRIORITY,
+ extension->GetResourceURL("test.dat"), net::DEFAULT_PRIORITY,
&test_delegate_));
StartRequest(request.get(), content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
diff --git a/chrome/browser/extensions/extension_reenabler.cc b/chrome/browser/extensions/extension_reenabler.cc
index 8f35226..974d307d 100644
--- a/chrome/browser/extensions/extension_reenabler.cc
+++ b/chrome/browser/extensions/extension_reenabler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/extension_reenabler.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/webstore_data_fetcher.h"
#include "chrome/browser/extensions/webstore_inline_installer.h"
@@ -23,7 +24,7 @@
}
// static
-scoped_ptr<ExtensionReenabler> ExtensionReenabler::PromptForReenable(
+std::unique_ptr<ExtensionReenabler> ExtensionReenabler::PromptForReenable(
const scoped_refptr<const Extension>& extension,
content::BrowserContext* browser_context,
content::WebContents* web_contents,
@@ -40,21 +41,21 @@
DCHECK_NE(0, disable_reasons & Extension::DISABLE_PERMISSIONS_INCREASE);
#endif // DCHECK_IS_ON()
- return make_scoped_ptr(new ExtensionReenabler(
+ return base::WrapUnique(new ExtensionReenabler(
extension, browser_context, referrer_url, callback, web_contents,
ExtensionInstallPrompt::GetDefaultShowDialogCallback()));
}
// static
-scoped_ptr<ExtensionReenabler>
+std::unique_ptr<ExtensionReenabler>
ExtensionReenabler::PromptForReenableWithCallbackForTest(
const scoped_refptr<const Extension>& extension,
content::BrowserContext* browser_context,
const Callback& callback,
const ExtensionInstallPrompt::ShowDialogCallback& show_dialog_callback) {
- return make_scoped_ptr(new ExtensionReenabler(extension, browser_context,
- GURL(), callback, nullptr,
- show_dialog_callback));
+ return base::WrapUnique(new ExtensionReenabler(extension, browser_context,
+ GURL(), callback, nullptr,
+ show_dialog_callback));
}
ExtensionReenabler::ExtensionReenabler(
@@ -94,7 +95,7 @@
base::Bind(&ExtensionReenabler::OnInstallPromptDone,
weak_factory_.GetWeakPtr()),
extension.get(), nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)),
show_dialog_callback_);
}
}
@@ -155,7 +156,7 @@
}
void ExtensionReenabler::OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) {
+ std::unique_ptr<base::DictionaryValue> webstore_data) {
DCHECK(!referrer_url_.is_empty());
std::string error;
if (!WebstoreInlineInstaller::IsRequestorPermitted(*webstore_data,
@@ -170,7 +171,7 @@
base::Bind(&ExtensionReenabler::OnInstallPromptDone,
weak_factory_.GetWeakPtr()),
extension_.get(), nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)),
show_dialog_callback_);
}
}
diff --git a/chrome/browser/extensions/extension_reenabler.h b/chrome/browser/extensions/extension_reenabler.h
index 7acd068..4c19f32 100644
--- a/chrome/browser/extensions/extension_reenabler.h
+++ b/chrome/browser/extensions/extension_reenabler.h
@@ -5,10 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_REENABLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_REENABLER_H_
+#include <memory>
+
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
@@ -48,7 +49,7 @@
// upon completion.
// If |referrer_url| is non-empty, then this will also check to make sure
// that the referrer_url is listed as a trusted url by the extension.
- static scoped_ptr<ExtensionReenabler> PromptForReenable(
+ static std::unique_ptr<ExtensionReenabler> PromptForReenable(
const scoped_refptr<const Extension>& extension,
content::BrowserContext* browser_context,
content::WebContents* web_contents,
@@ -57,7 +58,8 @@
// Like PromptForReenable, but allows tests to inject the
// ExtensionInstallPrompt.
- static scoped_ptr<ExtensionReenabler> PromptForReenableWithCallbackForTest(
+ static std::unique_ptr<ExtensionReenabler>
+ PromptForReenableWithCallbackForTest(
const scoped_refptr<const Extension>& extension,
content::BrowserContext* browser_context,
const Callback& callback,
@@ -84,7 +86,7 @@
// WebstoreDataFetcherDelegate:
void OnWebstoreRequestFailure() override;
void OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) override;
+ std::unique_ptr<base::DictionaryValue> webstore_data) override;
void OnWebstoreResponseParseFailure(const std::string& error) override;
// Sets the |finished_| bit and runs |callback_| with the given |result|.
@@ -107,13 +109,13 @@
ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_;
// The re-enable prompt.
- scoped_ptr<ExtensionInstallPrompt> install_prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> install_prompt_;
// Indicates whether the re-enable process finished.
bool finished_;
// The data fetcher for retrieving webstore data.
- scoped_ptr<WebstoreDataFetcher> webstore_data_fetcher_;
+ std::unique_ptr<WebstoreDataFetcher> webstore_data_fetcher_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
registry_observer_;
diff --git a/chrome/browser/extensions/extension_reenabler_unittest.cc b/chrome/browser/extensions/extension_reenabler_unittest.cc
index 292bb4ed..bbc3e23 100644
--- a/chrome/browser/extensions/extension_reenabler_unittest.cc
+++ b/chrome/browser/extensions/extension_reenabler_unittest.cc
@@ -81,7 +81,7 @@
// The callback to run when a test ExtensionInstallPrompt is ready to show.
void OnShow(ExtensionInstallPromptShowParams* show_params,
const ExtensionInstallPrompt::DoneCallback& done_callback,
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) {
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) {
DCHECK(!quit_closure_.is_null());
quit_closure_.Run();
quit_closure_ = base::Closure();
@@ -92,7 +92,7 @@
base::Closure quit_closure_;
// The result of the reenable process, or null if the process hasn't finished.
- scoped_ptr<ExtensionReenabler::ReenableResult> result_;
+ std::unique_ptr<ExtensionReenabler::ReenableResult> result_;
DISALLOW_COPY_AND_ASSIGN(CallbackHelper);
};
@@ -108,7 +108,7 @@
void SetUp() override;
void TearDown() override;
- scoped_ptr<TestExtensionsBrowserClient> test_browser_client_;
+ std::unique_ptr<TestExtensionsBrowserClient> test_browser_client_;
DISALLOW_COPY_AND_ASSIGN(ExtensionReenablerUnitTest);
};
@@ -163,11 +163,10 @@
ScopedTestDialogAutoConfirm::ACCEPT);
// Run the ExtensionReenabler.
- scoped_ptr<ExtensionReenabler> extension_reenabler =
- ExtensionReenabler::PromptForReenable(extension,
- profile(),
+ std::unique_ptr<ExtensionReenabler> extension_reenabler =
+ ExtensionReenabler::PromptForReenable(extension, profile(),
nullptr, // No web contents.
- GURL(), // No referrer.
+ GURL(), // No referrer.
callback_helper.GetCallback());
base::RunLoop().RunUntilIdle();
@@ -191,11 +190,10 @@
service()->DisableExtension(extension->id(),
Extension::DISABLE_PERMISSIONS_INCREASE);
- scoped_ptr<ExtensionReenabler> extension_reenabler =
- ExtensionReenabler::PromptForReenable(extension,
- profile(),
+ std::unique_ptr<ExtensionReenabler> extension_reenabler =
+ ExtensionReenabler::PromptForReenable(extension, profile(),
nullptr, // No web contents.
- GURL(), // No referrer.
+ GURL(), // No referrer.
callback_helper.GetCallback());
base::RunLoop().RunUntilIdle();
@@ -214,11 +212,10 @@
Extension::DISABLE_PERMISSIONS_INCREASE);
ScopedTestDialogAutoConfirm auto_confirm(
ScopedTestDialogAutoConfirm::CANCEL);
- scoped_ptr<ExtensionReenabler> extension_reenabler =
- ExtensionReenabler::PromptForReenable(extension,
- profile(),
+ std::unique_ptr<ExtensionReenabler> extension_reenabler =
+ ExtensionReenabler::PromptForReenable(extension, profile(),
nullptr, // No web contents.
- GURL(), // No referrer.
+ GURL(), // No referrer.
callback_helper.GetCallback());
base::RunLoop().RunUntilIdle();
@@ -232,7 +229,7 @@
// prompt exits and reports success.
{
base::RunLoop run_loop;
- scoped_ptr<ExtensionReenabler> extension_reenabler =
+ std::unique_ptr<ExtensionReenabler> extension_reenabler =
ExtensionReenabler::PromptForReenableWithCallbackForTest(
extension, profile(), callback_helper.GetCallback(),
callback_helper.CreateShowCallback(run_loop.QuitClosure()));
@@ -254,7 +251,7 @@
service()->DisableExtension(extension->id(),
Extension::DISABLE_PERMISSIONS_INCREASE);
base::RunLoop run_loop;
- scoped_ptr<ExtensionReenabler> extension_reenabler =
+ std::unique_ptr<ExtensionReenabler> extension_reenabler =
ExtensionReenabler::PromptForReenableWithCallbackForTest(
extension, profile(), callback_helper.GetCallback(),
callback_helper.CreateShowCallback(run_loop.QuitClosure()));
diff --git a/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc b/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
index 2fc28d3d3..464e975 100644
--- a/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
+++ b/chrome/browser/extensions/extension_request_limiting_throttle_browsertest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -25,13 +25,13 @@
namespace {
-scoped_ptr<net::test_server::HttpResponse> HandleRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleRequest(
bool set_cache_header_redirect_page,
bool set_cache_header_test_throttle_page,
const net::test_server::HttpRequest& request) {
if (base::StartsWith(request.relative_url, "/redirect",
base::CompareCase::SENSITIVE)) {
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse());
http_response->set_code(net::HTTP_FOUND);
http_response->set_content("Redirecting...");
@@ -44,7 +44,7 @@
if (base::StartsWith(request.relative_url, "/test_throttle",
base::CompareCase::SENSITIVE)) {
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse());
http_response->set_code(net::HTTP_SERVICE_UNAVAILABLE);
http_response->set_content("The server is overloaded right now.");
@@ -55,7 +55,7 @@
}
// Unhandled requests result in the Embedded test server sending a 404.
- return scoped_ptr<net::test_server::BasicHttpResponse>();
+ return std::unique_ptr<net::test_server::BasicHttpResponse>();
}
} // namespace
@@ -75,32 +75,34 @@
// checking of the net::LOAD_MAYBE_USER_GESTURE load flag in the manager
// in order to test the throttling logic.
manager->SetIgnoreUserGestureLoadFlagForTests(true);
- scoped_ptr<
- net::BackoffEntry::Policy> policy(new net::BackoffEntry::Policy{
- // Number of initial errors (in sequence) to ignore before applying
- // exponential back-off rules.
- 1,
+ std::unique_ptr<net::BackoffEntry::Policy> policy(
+ new net::BackoffEntry::Policy{
+ // Number of initial errors (in sequence) to ignore before
+ // applying
+ // exponential back-off rules.
+ 1,
- // Initial delay for exponential back-off in ms.
- 10 * 60 * 1000,
+ // Initial delay for exponential back-off in ms.
+ 10 * 60 * 1000,
- // Factor by which the waiting time will be multiplied.
- 10,
+ // Factor by which the waiting time will be multiplied.
+ 10,
- // Fuzzing percentage. ex: 10% will spread requests randomly
- // between 90%-100% of the calculated time.
- 0.1,
+ // Fuzzing percentage. ex: 10% will spread requests randomly
+ // between 90%-100% of the calculated time.
+ 0.1,
- // Maximum amount of time we are willing to delay our request in ms.
- 15 * 60 * 1000,
+ // Maximum amount of time we are willing to delay our request in
+ // ms.
+ 15 * 60 * 1000,
- // Time to keep an entry from being discarded even when it
- // has no significant state, -1 to never discard.
- -1,
+ // Time to keep an entry from being discarded even when it
+ // has no significant state, -1 to never discard.
+ -1,
- // Don't use initial delay unless the last request was an error.
- false,
- });
+ // Don't use initial delay unless the last request was an error.
+ false,
+ });
manager->SetBackoffPolicyForTests(std::move(policy));
}
// Requests to 127.0.0.1 bypass throttling, so set up a host resolver rule
diff --git a/chrome/browser/extensions/extension_resource_protocols.cc b/chrome/browser/extensions/extension_resource_protocols.cc
index c397681..78aa24f 100644
--- a/chrome/browser/extensions/extension_resource_protocols.cc
+++ b/chrome/browser/extensions/extension_resource_protocols.cc
@@ -6,6 +6,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/path_service.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -95,7 +96,7 @@
} // namespace
-scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
CreateExtensionResourceProtocolHandler() {
- return make_scoped_ptr(new ExtensionResourceProtocolHandler());
+ return base::WrapUnique(new ExtensionResourceProtocolHandler());
}
diff --git a/chrome/browser/extensions/extension_resource_protocols.h b/chrome/browser/extensions/extension_resource_protocols.h
index 85933a7..e0414ae 100644
--- a/chrome/browser/extensions/extension_resource_protocols.h
+++ b/chrome/browser/extensions/extension_resource_protocols.h
@@ -5,11 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_RESOURCE_PROTOCOLS_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_RESOURCE_PROTOCOLS_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "net/url_request/url_request_job_factory.h"
// Creates the handlers for the chrome-extension-resource:// scheme.
-scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
CreateExtensionResourceProtocolHandler();
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_RESOURCE_PROTOCOLS_H_
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 018b5d67..f924d0ae 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -457,7 +457,7 @@
TRACE_EVENT0("browser,startup",
"ExtensionService::MaybeFinishShutdownDelayed");
- scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> delayed_info(
+ std::unique_ptr<extensions::ExtensionPrefs::ExtensionsInfo> delayed_info(
extension_prefs_->GetAllDelayedInstallInfo());
for (size_t i = 0; i < delayed_info->size(); ++i) {
ExtensionInfo* info = delayed_info->at(i).get();
@@ -474,7 +474,7 @@
}
}
MaybeFinishDelayedInstallations();
- scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> delayed_info2(
+ std::unique_ptr<extensions::ExtensionPrefs::ExtensionsInfo> delayed_info2(
extension_prefs_->GetAllDelayedInstallInfo());
UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateOnLoad",
delayed_info2->size() - delayed_info->size());
@@ -483,7 +483,7 @@
void ExtensionService::LoadGreylistFromPrefs() {
TRACE_EVENT0("browser,startup", "ExtensionService::LoadGreylistFromPrefs");
- scoped_ptr<ExtensionSet> all_extensions =
+ std::unique_ptr<ExtensionSet> all_extensions =
registry_->GenerateInstalledExtensionsSet();
for (const auto& extension : *all_extensions) {
@@ -674,7 +674,7 @@
// Check the installed extensions to see if what we're reloading was already
// installed.
- scoped_ptr<ExtensionInfo> installed_extension(
+ std::unique_ptr<ExtensionInfo> installed_extension(
extension_prefs_->GetInstalledExtensionInfo(extension_id));
if (installed_extension.get() &&
installed_extension->extension_manifest.get()) {
@@ -941,7 +941,7 @@
block_extensions_ = true;
// Blacklisted extensions are already unloaded, need not be blocked.
- scoped_ptr<ExtensionSet> extensions =
+ std::unique_ptr<ExtensionSet> extensions =
registry_->GenerateInstalledExtensionsSet(ExtensionRegistry::ENABLED |
ExtensionRegistry::DISABLED |
ExtensionRegistry::TERMINATED);
@@ -965,7 +965,7 @@
// as appropriate.
void ExtensionService::UnblockAllExtensions() {
block_extensions_ = false;
- scoped_ptr<ExtensionSet> to_unblock =
+ std::unique_ptr<ExtensionSet> to_unblock =
registry_->GenerateInstalledExtensionsSet(ExtensionRegistry::BLOCKED);
for (const auto& extension : *to_unblock) {
@@ -1320,7 +1320,7 @@
}
// Uninstall all the unclaimed extensions.
- scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> extensions_info(
+ std::unique_ptr<extensions::ExtensionPrefs::ExtensionsInfo> extensions_info(
extension_prefs_->GetInstalledExtensionsInfo());
for (size_t i = 0; i < extensions_info->size(); ++i) {
ExtensionInfo* info = extensions_info->at(i).get();
@@ -1587,7 +1587,7 @@
if (extension->location() == Manifest::INTERNAL && !auto_grant_permission) {
// Add all the recognized permissions if the granted permissions list
// hasn't been initialized yet.
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
extension_prefs_->GetGrantedPermissions(extension->id());
CHECK(granted_permissions.get());
@@ -1828,7 +1828,7 @@
extensions::ExtensionManagement* settings =
extensions::ExtensionManagementFactory::GetForBrowserContext(profile());
CHECK(settings);
- scoped_ptr<ExtensionSet> all_extensions(
+ std::unique_ptr<ExtensionSet> all_extensions(
registry_->GenerateInstalledExtensionsSet());
for (const auto& extension : *all_extensions) {
if (!settings->IsPermissionSetAllowed(
@@ -1956,15 +1956,15 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
host_content_settings_map->RegisterProvider(
HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER,
- scoped_ptr<content_settings::ObservableProvider>(
+ std::unique_ptr<content_settings::ObservableProvider>(
new content_settings::InternalExtensionProvider(profile_)));
host_content_settings_map->RegisterProvider(
HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER,
- scoped_ptr<content_settings::ObservableProvider>(
+ std::unique_ptr<content_settings::ObservableProvider>(
new content_settings::CustomExtensionProvider(
- extensions::ContentSettingsService::Get(
- profile_)->content_settings_store(),
+ extensions::ContentSettingsService::Get(profile_)
+ ->content_settings_store(),
profile_->GetOriginalProfile() != profile_)));
}
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 9edd4ec1..5989005 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -642,7 +642,7 @@
extensions::OneShotEvent* const ready_;
// Our extension updater, if updates are turned on.
- scoped_ptr<extensions::ExtensionUpdater> updater_;
+ std::unique_ptr<extensions::ExtensionUpdater> updater_;
// Map unloaded extensions' ids to their paths. When a temporarily loaded
// extension is unloaded, we lose the information about it and don't have
@@ -659,7 +659,7 @@
content::NotificationRegistrar registrar_;
// Keeps track of loading and unloading component extensions.
- scoped_ptr<extensions::ComponentLoader> component_loader_;
+ std::unique_ptr<extensions::ComponentLoader> component_loader_;
// A collection of external extension providers. Each provider reads
// a source of external extension information. Examples include the
@@ -707,25 +707,25 @@
// The controller for the UI that alerts the user about any blacklisted
// extensions.
- scoped_ptr<extensions::ExtensionErrorController> error_controller_;
+ std::unique_ptr<extensions::ExtensionErrorController> error_controller_;
// The manager for extensions that were externally installed that is
// responsible for prompting the user about suspicious extensions.
- scoped_ptr<extensions::ExternalInstallManager> external_install_manager_;
+ std::unique_ptr<extensions::ExternalInstallManager> external_install_manager_;
// Sequenced task runner for extension related file operations.
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
- scoped_ptr<extensions::ExtensionActionStorageManager>
+ std::unique_ptr<extensions::ExtensionActionStorageManager>
extension_action_storage_manager_;
// The SharedModuleService used to check for import dependencies.
- scoped_ptr<extensions::SharedModuleService> shared_module_service_;
+ std::unique_ptr<extensions::SharedModuleService> shared_module_service_;
base::ObserverList<extensions::UpdateObserver, true> update_observers_;
// Migrates app data when upgrading a legacy packaged app to a platform app
- scoped_ptr<extensions::AppDataMigrator> app_data_migrator_;
+ std::unique_ptr<extensions::AppDataMigrator> app_data_migrator_;
FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
DestroyingProfileClearsExtensions);
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc
index a283a8e..8e9ac8d 100644
--- a/chrome/browser/extensions/extension_service_sync_unittest.cc
+++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -5,6 +5,7 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <string>
#include <utility>
@@ -12,7 +13,7 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/test/mock_entropy_provider.h"
@@ -108,13 +109,13 @@
syncer::SyncData sync_data = change.sync_data();
EXPECT_EQ(expected_type_, sync_data.GetDataType());
- scoped_ptr<ExtensionSyncData> modified =
+ std::unique_ptr<ExtensionSyncData> modified =
ExtensionSyncData::CreateFromSyncData(sync_data);
// Start by removing any existing entry for this extension id.
syncer::SyncDataList& data_list = data();
for (auto iter = data_list.begin(); iter != data_list.end(); ++iter) {
- scoped_ptr<ExtensionSyncData> existing =
+ std::unique_ptr<ExtensionSyncData> existing =
ExtensionSyncData::CreateFromSyncData(*iter);
if (existing->id() == modified->id()) {
data_list.erase(iter);
@@ -143,10 +144,12 @@
// This is a helper to vend a wrapped version of this object suitable for
// passing in to MergeDataAndStartSyncing, which takes a
- // scoped_ptr<SyncChangeProcessor>, since in tests we typically don't want to
+ // std::unique_ptr<SyncChangeProcessor>, since in tests we typically don't
+ // want to
// give up ownership of a local change processor.
- scoped_ptr<syncer::SyncChangeProcessor> GetWrapped() {
- return make_scoped_ptr(new syncer::SyncChangeProcessorWrapperForTest(this));
+ std::unique_ptr<syncer::SyncChangeProcessor> GetWrapped() {
+ return base::WrapUnique(
+ new syncer::SyncChangeProcessorWrapperForTest(this));
}
protected:
@@ -174,8 +177,8 @@
ASSERT_TRUE(type == syncer::EXTENSIONS || type == syncer::APPS);
extension_sync_service()->MergeDataAndStartSyncing(
type, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
}
protected:
@@ -268,8 +271,8 @@
// Once sync starts, flare should no longer be invoked.
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
path = data_dir().AppendASCII("page_action.crx");
InstallCRX(path, INSTALL_NEW);
EXPECT_FALSE(flare_was_called);
@@ -303,8 +306,8 @@
// Sync starts up.
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Then sync data arrives telling us to disable |good0|.
ExtensionSyncData disable_good_crx(*extension, false,
@@ -366,10 +369,9 @@
sync_data.push_back(disable_good0.GetSyncData());
sync_data.push_back(enable_good2.GetSyncData());
extension_sync_service()->MergeDataAndStartSyncing(
- syncer::EXTENSIONS,
- sync_data,
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ syncer::EXTENSIONS, sync_data,
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Both sync changes should be ignored, since the local state was changed
// before sync started, and so the local state is considered more recent.
@@ -399,10 +401,8 @@
syncer::FakeSyncChangeProcessor* processor =
new syncer::FakeSyncChangeProcessor;
extension_sync_service()->MergeDataAndStartSyncing(
- syncer::EXTENSIONS,
- syncer::SyncDataList(),
- make_scoped_ptr(processor),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ syncer::EXTENSIONS, syncer::SyncDataList(), base::WrapUnique(processor),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
processor->changes().clear();
@@ -478,13 +478,13 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_EQ(extension->id(), data->id());
@@ -507,14 +507,14 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
{
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_TRUE(data->enabled());
@@ -528,7 +528,7 @@
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_FALSE(data->enabled());
@@ -543,7 +543,7 @@
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_TRUE(data->enabled());
@@ -560,7 +560,7 @@
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_FALSE(data->enabled());
@@ -579,13 +579,13 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_EQ(extension->id(), data->id());
@@ -608,8 +608,8 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::APPS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
@@ -624,14 +624,14 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
{
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_TRUE(data->enabled());
@@ -644,7 +644,7 @@
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_FALSE(data->enabled());
@@ -659,7 +659,7 @@
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_FALSE(data->enabled());
@@ -674,7 +674,7 @@
syncer::SyncDataList list =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(data.get());
EXPECT_TRUE(data->enabled());
@@ -692,8 +692,8 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
StartSyncing(syncer::APPS);
UninstallExtension(good_crx, false);
@@ -725,8 +725,8 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::APPS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
syncer::StringOrdinal initial_ordinal =
syncer::StringOrdinal::CreateInitialOrdinal();
@@ -735,7 +735,7 @@
extension_sync_service()->GetAllSyncData(syncer::APPS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> app_sync_data =
+ std::unique_ptr<ExtensionSyncData> app_sync_data =
ExtensionSyncData::CreateFromSyncData(list[0]);
EXPECT_TRUE(initial_ordinal.Equals(app_sync_data->app_launch_ordinal()));
EXPECT_TRUE(initial_ordinal.Equals(app_sync_data->page_ordinal()));
@@ -748,7 +748,7 @@
extension_sync_service()->GetAllSyncData(syncer::APPS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> app_sync_data =
+ std::unique_ptr<ExtensionSyncData> app_sync_data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(app_sync_data.get());
EXPECT_TRUE(initial_ordinal.LessThan(app_sync_data->app_launch_ordinal()));
@@ -761,7 +761,7 @@
extension_sync_service()->GetAllSyncData(syncer::APPS);
ASSERT_EQ(list.size(), 1U);
- scoped_ptr<ExtensionSyncData> app_sync_data =
+ std::unique_ptr<ExtensionSyncData> app_sync_data =
ExtensionSyncData::CreateFromSyncData(list[0]);
ASSERT_TRUE(app_sync_data.get());
EXPECT_TRUE(initial_ordinal.LessThan(app_sync_data->app_launch_ordinal()));
@@ -787,8 +787,8 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::APPS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
ExtensionSystem::Get(service()->GetBrowserContext())
->app_sorting()
@@ -798,7 +798,7 @@
extension_sync_service()->GetAllSyncData(syncer::APPS);
ASSERT_EQ(list.size(), 3U);
- scoped_ptr<ExtensionSyncData> data[kAppCount];
+ std::unique_ptr<ExtensionSyncData> data[kAppCount];
for (size_t i = 0; i < kAppCount; ++i) {
data[i] = ExtensionSyncData::CreateFromSyncData(list[i]);
ASSERT_TRUE(data[i].get());
@@ -829,12 +829,12 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::APPS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
service()->DisableExtension(page_action, Extension::DISABLE_USER_ACTION);
TerminateExtension(theme2_crx);
@@ -848,8 +848,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
sync_pb::EntitySpecifics specifics;
sync_pb::ExtensionSpecifics* ext_specifics = specifics.mutable_extension();
@@ -922,8 +922,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW);
EXPECT_TRUE(service()->IsExtensionEnabled(good_crx));
@@ -1015,8 +1015,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
const base::FilePath path = data_dir().AppendASCII("good.crx");
const ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
@@ -1073,7 +1073,7 @@
: DISABLED);
EXPECT_EQ(test_case.expect_disable_reasons,
prefs->GetDisableReasons(good_crx));
- scoped_ptr<const PermissionSet> permissions =
+ std::unique_ptr<const PermissionSet> permissions =
prefs->GetGrantedPermissions(good_crx);
EXPECT_EQ(test_case.expect_permissions_granted, !permissions->IsEmpty());
ASSERT_FALSE(service()->pending_extension_manager()->IsIdPending(good_crx));
@@ -1089,8 +1089,8 @@
InitializeExtensionServiceWithUpdater();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW);
TerminateExtension(good_crx);
@@ -1119,8 +1119,8 @@
InitializeExtensionServiceWithUpdater();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW);
EXPECT_TRUE(service()->IsExtensionEnabled(good_crx));
@@ -1147,7 +1147,7 @@
syncer::SyncDataList data =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(1u, data.size());
- scoped_ptr<ExtensionSyncData> extension_data =
+ std::unique_ptr<ExtensionSyncData> extension_data =
ExtensionSyncData::CreateFromSyncData(data[0]);
ASSERT_TRUE(extension_data);
EXPECT_EQ(installed_version, extension_data->version());
@@ -1166,7 +1166,7 @@
syncer::SyncDataList data =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(1u, data.size());
- scoped_ptr<ExtensionSyncData> extension_data =
+ std::unique_ptr<ExtensionSyncData> extension_data =
ExtensionSyncData::CreateFromSyncData(data[0]);
ASSERT_TRUE(extension_data);
EXPECT_EQ(installed_version, extension_data->version());
@@ -1188,7 +1188,7 @@
syncer::SyncDataList data =
extension_sync_service()->GetAllSyncData(syncer::EXTENSIONS);
ASSERT_EQ(1u, data.size());
- scoped_ptr<ExtensionSyncData> extension_data =
+ std::unique_ptr<ExtensionSyncData> extension_data =
ExtensionSyncData::CreateFromSyncData(data[0]);
ASSERT_TRUE(extension_data);
EXPECT_EQ(new_version, extension_data->version());
@@ -1201,8 +1201,8 @@
InitializeExtensionServiceWithUpdater();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
sync_pb::EntitySpecifics specifics;
sync_pb::ExtensionSpecifics* ext_specifics = specifics.mutable_extension();
@@ -1235,8 +1235,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
const ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
@@ -1337,8 +1337,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
base::FilePath base_path = data_dir().AppendASCII("permissions_increase");
base::FilePath pem_path = base_path.AppendASCII("permissions.pem");
@@ -1387,8 +1387,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
const base::FilePath base_path =
data_dir().AppendASCII("permissions_increase");
@@ -1446,7 +1446,7 @@
}
ASSERT_TRUE(registry()->enabled_extensions().Contains(id));
- scoped_ptr<const PermissionSet> granted_permissions_v1 =
+ std::unique_ptr<const PermissionSet> granted_permissions_v1 =
prefs->GetGrantedPermissions(id);
// Update to a new version with increased permissions.
@@ -1463,7 +1463,7 @@
id, Extension::DISABLE_PERMISSIONS_INCREASE));
// No new permissions should have been granted.
- scoped_ptr<const PermissionSet> granted_permissions_v2 =
+ std::unique_ptr<const PermissionSet> granted_permissions_v2 =
prefs->GetGrantedPermissions(id);
ASSERT_EQ(*granted_permissions_v1, *granted_permissions_v2);
@@ -1485,10 +1485,10 @@
const bool expect_enabled = !test_case.expect_disable_reasons;
EXPECT_EQ(expect_enabled, service()->IsExtensionEnabled(id));
EXPECT_EQ(test_case.expect_disable_reasons, prefs->GetDisableReasons(id));
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
prefs->GetGrantedPermissions(id);
if (test_case.expect_permissions_granted) {
- scoped_ptr<const PermissionSet> active_permissions =
+ std::unique_ptr<const PermissionSet> active_permissions =
prefs->GetActivePermissions(id);
EXPECT_EQ(*granted_permissions, *active_permissions);
} else {
@@ -1516,10 +1516,8 @@
syncer::FakeSyncChangeProcessor* processor =
new syncer::FakeSyncChangeProcessor;
extension_sync_service()->MergeDataAndStartSyncing(
- syncer::EXTENSIONS,
- syncer::SyncDataList(),
- make_scoped_ptr(processor),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock));
+ syncer::EXTENSIONS, syncer::SyncDataList(), base::WrapUnique(processor),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock));
processor->changes().clear();
@@ -1721,7 +1719,7 @@
MockPermissionRequestCreator* creator = new MockPermissionRequestCreator;
supervised_user_service()->AddPermissionRequestCreator(
- make_scoped_ptr(creator));
+ base::WrapUnique(creator));
std::string id = InstallPermissionsTestExtension();
@@ -1743,7 +1741,7 @@
MockPermissionRequestCreator* creator = new MockPermissionRequestCreator;
supervised_user_service()->AddPermissionRequestCreator(
- make_scoped_ptr(creator));
+ base::WrapUnique(creator));
const std::string version1("1");
const std::string version2("2");
@@ -1791,7 +1789,7 @@
MockPermissionRequestCreator* creator = new MockPermissionRequestCreator;
supervised_user_service()->AddPermissionRequestCreator(
- make_scoped_ptr(creator));
+ base::WrapUnique(creator));
std::string id = InstallPermissionsTestExtension();
@@ -1827,7 +1825,7 @@
MockPermissionRequestCreator* creator = new MockPermissionRequestCreator;
supervised_user_service()->AddPermissionRequestCreator(
- make_scoped_ptr(creator));
+ base::WrapUnique(creator));
std::string id = InstallPermissionsTestExtension();
@@ -1871,8 +1869,8 @@
InitializeEmptyExtensionService();
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
- make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Install two extensions.
base::FilePath path1 = data_dir().AppendASCII("good.crx");
@@ -1991,10 +1989,10 @@
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, syncer::SyncDataList(),
extensions_processor.GetWrapped(),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
extension_sync_service()->MergeDataAndStartSyncing(
syncer::APPS, syncer::SyncDataList(), apps_processor.GetWrapped(),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Check the app/extension change processors to be sure the right data was
// added.
@@ -2004,7 +2002,7 @@
ASSERT_EQ(1u, apps_processor.changes().size());
const SyncChange& app_change = apps_processor.changes()[0];
EXPECT_EQ(SyncChange::ACTION_ADD, app_change.change_type());
- scoped_ptr<ExtensionSyncData> app_data =
+ std::unique_ptr<ExtensionSyncData> app_data =
ExtensionSyncData::CreateFromSyncData(app_change.sync_data());
EXPECT_TRUE(app_data->is_app());
EXPECT_EQ(id, app_data->id());
@@ -2022,7 +2020,7 @@
ASSERT_EQ(1u, extensions_processor.changes().size());
const SyncChange& extension_change = extensions_processor.changes()[0];
EXPECT_EQ(SyncChange::ACTION_ADD, extension_change.change_type());
- scoped_ptr<ExtensionSyncData> extension_data =
+ std::unique_ptr<ExtensionSyncData> extension_data =
ExtensionSyncData::CreateFromSyncData(extension_change.sync_data());
EXPECT_FALSE(extension_data->is_app());
EXPECT_EQ(id, extension_data->id());
@@ -2040,16 +2038,16 @@
extension_sync_service()->StopSyncing(syncer::APPS);
extension_sync_service()->MergeDataAndStartSyncing(
syncer::EXTENSIONS, extensions_data, extensions_processor.GetWrapped(),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
extension_sync_service()->MergeDataAndStartSyncing(
syncer::APPS, apps_data, apps_processor.GetWrapped(),
- make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
+ base::WrapUnique(new syncer::SyncErrorFactoryMock()));
// Make sure we saw an app item deleted.
bool found_delete = false;
for (const auto& change : apps_processor.changes()) {
if (change.change_type() == SyncChange::ACTION_DELETE) {
- scoped_ptr<ExtensionSyncData> data =
+ std::unique_ptr<ExtensionSyncData> data =
ExtensionSyncData::CreateFromSyncChange(change);
if (data->id() == id) {
found_delete = true;
diff --git a/chrome/browser/extensions/extension_service_test_base.cc b/chrome/browser/extensions/extension_service_test_base.cc
index ab739a44..d9c0401e 100644
--- a/chrome/browser/extensions/extension_service_test_base.cc
+++ b/chrome/browser/extensions/extension_service_test_base.cc
@@ -44,7 +44,7 @@
const int kThreadOptions = content::TestBrowserThreadBundle::IO_MAINLOOP;
// Create a testing profile according to |params|.
-scoped_ptr<TestingProfile> BuildTestingProfile(
+std::unique_ptr<TestingProfile> BuildTestingProfile(
const ExtensionServiceTestBase::ExtensionServiceInitParams& params) {
TestingProfile::Builder profile_builder;
// Create a PrefService that only contains user defined preference values.
@@ -56,7 +56,7 @@
base::ThreadTaskRunnerHandle::Get().get());
scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
new user_prefs::PrefRegistrySyncable);
- scoped_ptr<syncable_prefs::PrefServiceSyncable> prefs(
+ std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs(
factory.CreateSyncable(registry.get()));
chrome::RegisterUserProfilePrefs(registry.get());
profile_builder.SetPrefService(std::move(prefs));
diff --git a/chrome/browser/extensions/extension_service_test_base.h b/chrome/browser/extensions/extension_service_test_base.h
index 03f164cc..62812cd 100644
--- a/chrome/browser/extensions/extension_service_test_base.h
+++ b/chrome/browser/extensions/extension_service_test_base.h
@@ -7,13 +7,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/at_exit.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -134,7 +134,7 @@
// after thread_bundle_ in the destruction order.
base::ShadowingAtExitManager at_exit_manager_;
- scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
+ std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
protected:
// It's unfortunate that these are exposed to subclasses (rather than used
@@ -142,7 +142,7 @@
// directly.
// The associated testing profile.
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
// The ExtensionService, whose lifetime is managed by |profile|'s
// ExtensionSystem.
diff --git a/chrome/browser/extensions/extension_service_test_with_install.cc b/chrome/browser/extensions/extension_service_test_with_install.cc
index f2cedef..fda8c4ba 100644
--- a/chrome/browser/extensions/extension_service_test_with_install.cc
+++ b/chrome/browser/extensions/extension_service_test_with_install.cc
@@ -87,7 +87,7 @@
ASSERT_TRUE(base::DeleteFile(crx_path, false));
- scoped_ptr<ExtensionCreator> creator(new ExtensionCreator());
+ std::unique_ptr<ExtensionCreator> creator(new ExtensionCreator());
ASSERT_TRUE(creator->Run(dir_path,
crx_path,
pem_path,
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index bf358f86..1bda609 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -6,8 +6,10 @@
#include <stddef.h>
#include <stdint.h>
+
#include <algorithm>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -24,7 +26,7 @@
#include "base/json/json_string_value_serializer.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
@@ -282,9 +284,9 @@
visit_count_++;
for (DataMap::const_iterator i = extension_map_.begin();
i != extension_map_.end(); ++i) {
- scoped_ptr<Version> version(new Version(i->second.first));
+ std::unique_ptr<Version> version(new Version(i->second.first));
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
i->first, std::move(version), i->second.second, location_,
Extension::NO_FLAGS, false, false));
visitor_->OnExternalExtensionFileFound(*info);
@@ -298,7 +300,7 @@
bool GetExtensionDetails(const std::string& id,
Manifest::Location* location,
- scoped_ptr<Version>* version) const override {
+ std::unique_ptr<Version>* version) const override {
DataMap::const_iterator it = extension_map_.find(id);
if (it == extension_map_.end())
return false;
@@ -406,13 +408,13 @@
// Ask provider if the extension we got back is registered.
Manifest::Location location = Manifest::INVALID_LOCATION;
- scoped_ptr<Version> v1;
+ std::unique_ptr<Version> v1;
base::FilePath crx_path;
EXPECT_TRUE(provider_->GetExtensionDetails(info.extension_id, NULL, &v1));
EXPECT_STREQ(info.version->GetString().c_str(), v1->GetString().c_str());
- scoped_ptr<Version> v2;
+ std::unique_ptr<Version> v2;
EXPECT_TRUE(
provider_->GetExtensionDetails(info.extension_id, &location, &v2));
EXPECT_STREQ(info.version->GetString().c_str(), v1->GetString().c_str());
@@ -442,7 +444,7 @@
EXPECT_TRUE(provider_->HasExtension(info.extension_id));
// External extensions with update URLs do not have versions.
- scoped_ptr<Version> v1;
+ std::unique_ptr<Version> v1;
Manifest::Location location1 = Manifest::INVALID_LOCATION;
EXPECT_TRUE(
provider_->GetExtensionDetails(info.extension_id, &location1, &v1));
@@ -477,18 +479,19 @@
Profile* profile() { return profile_.get(); }
protected:
- scoped_ptr<extensions::ExternalProviderImpl> provider_;
+ std::unique_ptr<extensions::ExternalProviderImpl> provider_;
- scoped_ptr<base::DictionaryValue> GetDictionaryFromJSON(
+ std::unique_ptr<base::DictionaryValue> GetDictionaryFromJSON(
const std::string& json_data) {
// We also parse the file into a dictionary to compare what we get back
// from the provider.
JSONStringValueDeserializer deserializer(json_data);
- scoped_ptr<base::Value> json_value = deserializer.Deserialize(NULL, NULL);
+ std::unique_ptr<base::Value> json_value =
+ deserializer.Deserialize(NULL, NULL);
if (!json_value || !json_value->IsType(base::Value::TYPE_DICTIONARY)) {
ADD_FAILURE() << "Unable to deserialize json data";
- return scoped_ptr<base::DictionaryValue>();
+ return std::unique_ptr<base::DictionaryValue>();
} else {
return base::DictionaryValue::From(std::move(json_value));
}
@@ -499,8 +502,8 @@
base::FilePath fake_base_path_;
int expected_creation_flags_;
Manifest::Location crx_location_;
- scoped_ptr<base::DictionaryValue> prefs_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<base::DictionaryValue> prefs_;
+ std::unique_ptr<TestingProfile> profile_;
DISALLOW_COPY_AND_ASSIGN(MockProviderVisitor);
};
@@ -520,7 +523,7 @@
file_extension_ids_.clear();
removed_extension_ids_.clear();
- scoped_ptr<base::DictionaryValue> new_prefs =
+ std::unique_ptr<base::DictionaryValue> new_prefs =
GetDictionaryFromJSON(json_data);
if (!new_prefs)
return;
@@ -633,7 +636,7 @@
}
testing::AssertionResult IsBlocked(const std::string& id) {
- scoped_ptr<extensions::ExtensionSet> all_unblocked_extensions =
+ std::unique_ptr<extensions::ExtensionSet> all_unblocked_extensions =
registry()->GenerateInstalledExtensionsSet(
ExtensionRegistry::EVERYTHING & ~ExtensionRegistry::BLOCKED);
if (all_unblocked_extensions.get()->Contains(id))
@@ -1146,11 +1149,11 @@
service()->set_extensions_enabled(true);
// Register and install an external extension.
- scoped_ptr<Version> version(new Version("1.0.0.0"));
+ std::unique_ptr<Version> version(new Version("1.0.0.0"));
content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
good_crx, std::move(version), path, Manifest::EXTERNAL_PREF,
Extension::FROM_BOOKMARK, false /* mark_acknowledged */,
false /* install_immediately */));
@@ -1182,8 +1185,8 @@
content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
- scoped_ptr<Version> version(new Version("1.0.0.0"));
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<Version> version(new Version("1.0.0.0"));
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
good_crx, std::move(version), path, Manifest::EXTERNAL_PREF,
Extension::NO_FLAGS, false, false));
if (service()->OnExternalExtensionFileFound(*info))
@@ -1260,7 +1263,7 @@
base::FilePath path = data_dir().AppendASCII("good.crx");
service()->set_extensions_enabled(true);
- scoped_ptr<Version> version(new Version("1.0.0.0"));
+ std::unique_ptr<Version> version(new Version("1.0.0.0"));
const std::string wrong_id = all_zero;
const std::string correct_id = good_crx;
@@ -1271,7 +1274,7 @@
content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
wrong_id, std::move(version), path, Manifest::EXTERNAL_PREF,
Extension::NO_FLAGS, false, false));
service()->OnExternalExtensionFileFound(*info);
@@ -1300,8 +1303,8 @@
content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources());
- scoped_ptr<Version> wrong_version(new Version("1.2.3.4"));
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<Version> wrong_version(new Version("1.2.3.4"));
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
good_crx, std::move(wrong_version), path, Manifest::EXTERNAL_PREF,
Extension::NO_FLAGS, false, false));
service()->OnExternalExtensionFileFound(*info);
@@ -1311,7 +1314,7 @@
// Try again with the right version. Expect success.
service()->pending_extension_manager()->Remove(good_crx);
- scoped_ptr<Version> correct_version(new Version("1.0.0.0"));
+ std::unique_ptr<Version> correct_version(new Version("1.0.0.0"));
info->version = std::move(correct_version);
content::WindowedNotificationObserver observer2(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
@@ -1405,7 +1408,7 @@
AddPattern(&expected_host_perms, "http://*.google.com.hk/*");
AddPattern(&expected_host_perms, "http://www.example.com/*");
- scoped_ptr<const PermissionSet> known_perms =
+ std::unique_ptr<const PermissionSet> known_perms =
prefs->GetGrantedPermissions(extension->id());
EXPECT_TRUE(known_perms.get());
EXPECT_FALSE(known_perms->IsEmpty());
@@ -1447,7 +1450,7 @@
// Verify that the valid API permissions have been recognized.
expected_api_perms.insert(APIPermission::kTab);
- scoped_ptr<const PermissionSet> known_perms =
+ std::unique_ptr<const PermissionSet> known_perms =
prefs->GetGrantedPermissions(extension->id());
EXPECT_TRUE(known_perms.get());
EXPECT_FALSE(known_perms->IsEmpty());
@@ -1471,7 +1474,7 @@
EXPECT_EQ(1u, registry()->enabled_extensions().size());
ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
- scoped_ptr<const PermissionSet> permissions =
+ std::unique_ptr<const PermissionSet> permissions =
prefs->GetGrantedPermissions(extension->id());
EXPECT_FALSE(permissions->IsEmpty());
EXPECT_TRUE(permissions->HasEffectiveFullAccess());
@@ -1534,7 +1537,7 @@
ASSERT_TRUE(service()->IsExtensionEnabled(extension_id));
ASSERT_FALSE(prefs->DidExtensionEscalatePermissions(extension_id));
- scoped_ptr<const PermissionSet> current_perms =
+ std::unique_ptr<const PermissionSet> current_perms =
prefs->GetGrantedPermissions(extension_id);
ASSERT_TRUE(current_perms.get());
ASSERT_FALSE(current_perms->IsEmpty());
@@ -1601,7 +1604,7 @@
base::FilePath crx_path(output_directory.AppendASCII("ex1.crx"));
base::FilePath privkey_path(output_directory.AppendASCII("privkey.pem"));
- scoped_ptr<ExtensionCreator> creator(new ExtensionCreator());
+ std::unique_ptr<ExtensionCreator> creator(new ExtensionCreator());
ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(),
privkey_path, ExtensionCreator::kNoRunFlags));
ASSERT_TRUE(base::PathExists(crx_path));
@@ -1748,7 +1751,7 @@
base::FilePath privkey_path(output_directory.AppendASCII("privkey.pem"));
// Pack the extension once to get a private key.
- scoped_ptr<ExtensionCreator> creator(new ExtensionCreator());
+ std::unique_ptr<ExtensionCreator> creator(new ExtensionCreator());
ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(),
privkey_path, ExtensionCreator::kNoRunFlags))
<< creator->error_message();
@@ -1792,7 +1795,7 @@
base::FilePath crx_path(output_directory.AppendASCII("ex1.crx"));
- scoped_ptr<ExtensionCreator> creator(new ExtensionCreator());
+ std::unique_ptr<ExtensionCreator> creator(new ExtensionCreator());
ASSERT_TRUE(creator->Run(input_directory, crx_path, privkey_path,
base::FilePath(), ExtensionCreator::kOverwriteCRX));
@@ -2391,7 +2394,7 @@
service()->set_show_extensions_prompts(true);
// Start by canceling any install prompts.
- scoped_ptr<extensions::ScopedTestDialogAutoConfirm> auto_confirm(
+ std::unique_ptr<extensions::ScopedTestDialogAutoConfirm> auto_confirm(
new extensions::ScopedTestDialogAutoConfirm(
extensions::ScopedTestDialogAutoConfirm::CANCEL));
@@ -2432,7 +2435,7 @@
EXPECT_TRUE(registry()->enabled_extensions().Contains(good2));
// Make sure the granted permissions have been setup.
- scoped_ptr<const PermissionSet> permissions =
+ std::unique_ptr<const PermissionSet> permissions =
ExtensionPrefs::Get(profile())->GetGrantedPermissions(good1);
ASSERT_TRUE(permissions);
EXPECT_FALSE(permissions->IsEmpty());
@@ -3822,7 +3825,7 @@
GrantAllOptionalPermissions(ext2);
GrantAllOptionalPermissions(ext2_forced);
- scoped_ptr<const PermissionSet> active_permissions =
+ std::unique_ptr<const PermissionSet> active_permissions =
ExtensionPrefs::Get(profile())->GetActivePermissions(ext1);
EXPECT_TRUE(active_permissions->HasAPIPermission(
extensions::APIPermission::kDownloads));
@@ -5295,14 +5298,14 @@
ExtensionErrorReporter::Init(false); // no noisy errors
ExtensionsReadyRecorder recorder;
- scoped_ptr<TestingProfile> profile(new TestingProfile());
+ std::unique_ptr<TestingProfile> profile(new TestingProfile());
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService device_settings_service;
chromeos::ScopedTestCrosSettings cros_settings;
- scoped_ptr<chromeos::ScopedTestUserManager> user_manager(
+ std::unique_ptr<chromeos::ScopedTestUserManager> user_manager(
new chromeos::ScopedTestUserManager);
#endif
- scoped_ptr<base::CommandLine> command_line;
+ std::unique_ptr<base::CommandLine> command_line;
base::FilePath install_dir = profile->GetPath()
.AppendASCII(extensions::kInstallDirectoryName);
@@ -5461,8 +5464,8 @@
EXPECT_FALSE(pending->IsIdPending(kGoodId));
// Skip install when the location is the same.
- scoped_ptr<GURL> good_update_url(new GURL(kGoodUpdateURL));
- scoped_ptr<ExternalInstallInfoUpdateUrl> info(
+ std::unique_ptr<GURL> good_update_url(new GURL(kGoodUpdateURL));
+ std::unique_ptr<ExternalInstallInfoUpdateUrl> info(
new ExternalInstallInfoUpdateUrl(
kGoodId, std::string(), std::move(good_update_url),
Manifest::INTERNAL, Extension::NO_FLAGS, false));
@@ -5524,8 +5527,8 @@
service()->pending_extension_manager();
EXPECT_FALSE(pending->IsIdPending(kGoodId));
- scoped_ptr<Version> older_version_ptr(new Version(older_version));
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<Version> older_version_ptr(new Version(older_version));
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
kGoodId, std::move(older_version_ptr), kInvalidPathToCrx,
Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged,
kDontInstallImmediately));
@@ -5660,8 +5663,8 @@
EXPECT_FALSE(pending->IsIdPending(kGoodId));
// An external provider starts installing from a local crx.
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
- kGoodId, make_scoped_ptr(new Version(kVersion123)), kInvalidPathToCrx,
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ kGoodId, base::WrapUnique(new Version(kVersion123)), kInvalidPathToCrx,
Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged,
kDontInstallImmediately));
EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
@@ -5695,9 +5698,9 @@
// Adding the latest version from the webstore overrides a specific version.
GURL kUpdateUrl("http://example.com/update");
- scoped_ptr<ExternalInstallInfoUpdateUrl> update_info(
+ std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info(
new ExternalInstallInfoUpdateUrl(
- kGoodId, std::string(), make_scoped_ptr(new GURL(kUpdateUrl)),
+ kGoodId, std::string(), base::WrapUnique(new GURL(kUpdateUrl)),
Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false));
EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true));
EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
@@ -5752,8 +5755,8 @@
// Fake an external file from external_extensions.json.
bool AddPendingExternalPrefFileInstall() {
- scoped_ptr<Version> version(new Version("1.0.0.0"));
- scoped_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
+ std::unique_ptr<Version> version(new Version("1.0.0.0"));
+ std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
crx_id_, std::move(version), crx_path_, Manifest::EXTERNAL_PREF,
Extension::NO_FLAGS, false, false));
return service()->OnExternalExtensionFileFound(*info);
@@ -5773,8 +5776,8 @@
// Fake a policy install.
bool AddPendingPolicyInstall() {
// Get path to the CRX with id |kGoodId|.
- scoped_ptr<GURL> empty_url(new GURL());
- scoped_ptr<ExternalInstallInfoUpdateUrl> info(
+ std::unique_ptr<GURL> empty_url(new GURL());
+ std::unique_ptr<ExternalInstallInfoUpdateUrl> info(
new ExternalInstallInfoUpdateUrl(
crx_id_, std::string(), std::move(empty_url),
Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false));
diff --git a/chrome/browser/extensions/extension_storage_monitor.cc b/chrome/browser/extensions/extension_storage_monitor.cc
index 93b12f41..347e8e8 100644
--- a/chrome/browser/extensions/extension_storage_monitor.cc
+++ b/chrome/browser/extensions/extension_storage_monitor.cc
@@ -432,7 +432,7 @@
: gfx::Image(util::GetDefaultExtensionIcon());
}
- scoped_ptr<message_center::Notification> notification;
+ std::unique_ptr<message_center::Notification> notification;
notification.reset(new message_center::Notification(
message_center::NOTIFICATION_TYPE_SIMPLE, notification_id,
l10n_util::GetStringUTF16(IDS_EXTENSION_STORAGE_MONITOR_TITLE),
diff --git a/chrome/browser/extensions/extension_storage_monitor.h b/chrome/browser/extensions/extension_storage_monitor.h
index 237b98b..31f4a9ef 100644
--- a/chrome/browser/extensions/extension_storage_monitor.h
+++ b/chrome/browser/extensions/extension_storage_monitor.h
@@ -143,7 +143,7 @@
scoped_refptr<StorageEventObserver> storage_observer_;
// Modal dialog used to confirm removal of an extension.
- scoped_ptr<ExtensionUninstallDialog> uninstall_dialog_;
+ std::unique_ptr<ExtensionUninstallDialog> uninstall_dialog_;
// The ID of the extension that is the subject of the uninstall confirmation
// dialog.
diff --git a/chrome/browser/extensions/extension_sync_data.cc b/chrome/browser/extensions/extension_sync_data.cc
index 3e88aa6..242aba84 100644
--- a/chrome/browser/extensions/extension_sync_data.cc
+++ b/chrome/browser/extensions/extension_sync_data.cc
@@ -139,18 +139,18 @@
ExtensionSyncData::~ExtensionSyncData() {}
// static
-scoped_ptr<ExtensionSyncData> ExtensionSyncData::CreateFromSyncData(
+std::unique_ptr<ExtensionSyncData> ExtensionSyncData::CreateFromSyncData(
const syncer::SyncData& sync_data) {
- scoped_ptr<ExtensionSyncData> data(new ExtensionSyncData);
+ std::unique_ptr<ExtensionSyncData> data(new ExtensionSyncData);
if (data->PopulateFromSyncData(sync_data))
return data;
return nullptr;
}
// static
-scoped_ptr<ExtensionSyncData> ExtensionSyncData::CreateFromSyncChange(
+std::unique_ptr<ExtensionSyncData> ExtensionSyncData::CreateFromSyncChange(
const syncer::SyncChange& sync_change) {
- scoped_ptr<ExtensionSyncData> data(
+ std::unique_ptr<ExtensionSyncData> data(
CreateFromSyncData(sync_change.sync_data()));
if (!data.get())
return nullptr;
diff --git a/chrome/browser/extensions/extension_sync_data.h b/chrome/browser/extensions/extension_sync_data.h
index 0feefeb..d033626 100644
--- a/chrome/browser/extensions/extension_sync_data.h
+++ b/chrome/browser/extensions/extension_sync_data.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_
+#include <memory>
#include <string>
#include "base/gtest_prod_util.h"
-#include "base/memory/scoped_ptr.h"
#include "base/version.h"
#include "extensions/common/constants.h"
#include "sync/api/string_ordinal.h"
@@ -69,9 +69,9 @@
// For constructing an ExtensionSyncData from received sync data.
// May return null if the sync data was invalid.
- static scoped_ptr<ExtensionSyncData> CreateFromSyncData(
+ static std::unique_ptr<ExtensionSyncData> CreateFromSyncData(
const syncer::SyncData& sync_data);
- static scoped_ptr<ExtensionSyncData> CreateFromSyncChange(
+ static std::unique_ptr<ExtensionSyncData> CreateFromSyncChange(
const syncer::SyncChange& sync_change);
// Retrieve sync data from this class.
diff --git a/chrome/browser/extensions/extension_sync_data_unittest.cc b/chrome/browser/extensions/extension_sync_data_unittest.cc
index a271125..ca80d80 100644
--- a/chrome/browser/extensions/extension_sync_data_unittest.cc
+++ b/chrome/browser/extensions/extension_sync_data_unittest.cc
@@ -4,8 +4,9 @@
#include "chrome/browser/extensions/extension_sync_data.h"
+#include <memory>
+
#include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
#include "base/version.h"
#include "extensions/common/extension.h"
#include "sync/api/string_ordinal.h"
@@ -31,7 +32,7 @@
void ProtobufToSyncDataEqual(const sync_pb::EntitySpecifics& entity) {
syncer::SyncData sync_data =
syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
- scoped_ptr<ExtensionSyncData> extension_sync_data =
+ std::unique_ptr<ExtensionSyncData> extension_sync_data =
ExtensionSyncData::CreateFromSyncData(sync_data);
ASSERT_TRUE(extension_sync_data.get());
syncer::SyncData output_sync_data = extension_sync_data->GetSyncData();
@@ -59,7 +60,7 @@
// confirms that the input is the same as the output.
void SyncDataToProtobufEqual(const ExtensionSyncData& input) {
syncer::SyncData sync_data = input.GetSyncData();
- scoped_ptr<ExtensionSyncData> output =
+ std::unique_ptr<ExtensionSyncData> output =
ExtensionSyncData::CreateFromSyncData(sync_data);
ASSERT_TRUE(output.get());
@@ -174,7 +175,7 @@
syncer::SyncData sync_data =
syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
- scoped_ptr<ExtensionSyncData> app_sync_data =
+ std::unique_ptr<ExtensionSyncData> app_sync_data =
ExtensionSyncData::CreateFromSyncData(sync_data);
ASSERT_TRUE(app_sync_data.get());
EXPECT_EQ(app_specifics->app_launch_ordinal(),
@@ -195,7 +196,7 @@
syncer::SyncData sync_data =
syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
- scoped_ptr<ExtensionSyncData> app_sync_data =
+ std::unique_ptr<ExtensionSyncData> app_sync_data =
ExtensionSyncData::CreateFromSyncData(sync_data);
ASSERT_TRUE(app_sync_data.get());
@@ -221,7 +222,7 @@
syncer::SyncData::CreateLocalData("sync_tag", "non_unique_title", entity);
// There should be no issue loading the sync data.
- scoped_ptr<ExtensionSyncData> app_sync_data =
+ std::unique_ptr<ExtensionSyncData> app_sync_data =
ExtensionSyncData::CreateFromSyncData(sync_data);
ASSERT_TRUE(app_sync_data.get());
app_sync_data->GetSyncData();
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index a608f07..86824c6 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -185,8 +185,8 @@
syncer::SyncMergeResult ExtensionSyncService::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
- scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) {
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
+ std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) {
CHECK(sync_processor.get());
LOG_IF(FATAL, type != syncer::EXTENSIONS && type != syncer::APPS)
<< "Got " << type << " ModelType";
@@ -197,7 +197,7 @@
// Apply the initial sync data, filtering out any items where we have more
// recent local changes. Also tell the SyncBundle the extension IDs.
for (const syncer::SyncData& sync_data : initial_sync_data) {
- scoped_ptr<ExtensionSyncData> extension_sync_data(
+ std::unique_ptr<ExtensionSyncData> extension_sync_data(
ExtensionSyncData::CreateFromSyncData(sync_data));
// If the extension has local state that needs to be synced, ignore this
// change (we assume the local state is more recent).
@@ -251,7 +251,7 @@
const tracked_objects::Location& from_here,
const syncer::SyncChangeList& change_list) {
for (const syncer::SyncChange& sync_change : change_list) {
- scoped_ptr<ExtensionSyncData> extension_sync_data(
+ std::unique_ptr<ExtensionSyncData> extension_sync_data(
ExtensionSyncData::CreateFromSyncChange(sync_change));
if (extension_sync_data)
ApplySyncData(*extension_sync_data);
diff --git a/chrome/browser/extensions/extension_sync_service.h b/chrome/browser/extensions/extension_sync_service.h
index 4854fa9..041d1e8 100644
--- a/chrome/browser/extensions/extension_sync_service.h
+++ b/chrome/browser/extensions/extension_sync_service.h
@@ -57,8 +57,8 @@
syncer::SyncMergeResult MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
- scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) override;
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
+ std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) override;
void StopSyncing(syncer::ModelType type) override;
syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override;
syncer::SyncError ProcessSyncChanges(
diff --git a/chrome/browser/extensions/extension_sync_service_factory.h b/chrome/browser/extensions/extension_sync_service_factory.h
index d394c66..86a1d2ee 100644
--- a/chrome/browser/extensions/extension_sync_service_factory.h
+++ b/chrome/browser/extensions/extension_sync_service_factory.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_SERVICE_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_SERVICE_FACTORY_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index 8e24a2b..1a04022f 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -395,7 +395,7 @@
return shared_->content_verifier();
}
-scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions(
+std::unique_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions(
const Extension* extension) {
return extension_service()->shared_module_service()->GetDependentExtensions(
extension);
diff --git a/chrome/browser/extensions/extension_system_impl.h b/chrome/browser/extensions/extension_system_impl.h
index cb50c79..b6bb19bc 100644
--- a/chrome/browser/extensions/extension_system_impl.h
+++ b/chrome/browser/extensions/extension_system_impl.h
@@ -61,7 +61,7 @@
const OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override; // shared
- scoped_ptr<ExtensionSet> GetDependentExtensions(
+ std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
void InstallUpdate(const std::string& extension_id,
const base::FilePath& temp_dir) override;
@@ -104,32 +104,32 @@
// The services that are shared between normal and incognito profiles.
- scoped_ptr<StateStore> state_store_;
- scoped_ptr<StateStoreNotificationObserver>
+ std::unique_ptr<StateStore> state_store_;
+ std::unique_ptr<StateStoreNotificationObserver>
state_store_notification_observer_;
- scoped_ptr<StateStore> rules_store_;
+ std::unique_ptr<StateStore> rules_store_;
scoped_refptr<ValueStoreFactoryImpl> store_factory_;
- scoped_ptr<NavigationObserver> navigation_observer_;
- scoped_ptr<ServiceWorkerManager> service_worker_manager_;
+ std::unique_ptr<NavigationObserver> navigation_observer_;
+ std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
// Shared memory region manager for scripts statically declared in extension
// manifests. This region is shared between all extensions.
- scoped_ptr<SharedUserScriptMaster> shared_user_script_master_;
- scoped_ptr<RuntimeData> runtime_data_;
+ std::unique_ptr<SharedUserScriptMaster> shared_user_script_master_;
+ std::unique_ptr<RuntimeData> runtime_data_;
// ExtensionService depends on StateStore, Blacklist and RuntimeData.
- scoped_ptr<ExtensionService> extension_service_;
- scoped_ptr<ManagementPolicy> management_policy_;
+ std::unique_ptr<ExtensionService> extension_service_;
+ std::unique_ptr<ManagementPolicy> management_policy_;
// extension_info_map_ needs to outlive process_manager_.
scoped_refptr<InfoMap> extension_info_map_;
- scoped_ptr<QuotaService> quota_service_;
- scoped_ptr<AppSorting> app_sorting_;
+ std::unique_ptr<QuotaService> quota_service_;
+ std::unique_ptr<AppSorting> app_sorting_;
// For verifying the contents of extensions read from disk.
scoped_refptr<ContentVerifier> content_verifier_;
- scoped_ptr<UninstallPingSender> uninstall_ping_sender_;
+ std::unique_ptr<UninstallPingSender> uninstall_ping_sender_;
#if defined(OS_CHROMEOS)
- scoped_ptr<chromeos::DeviceLocalAccountManagementPolicyProvider>
+ std::unique_ptr<chromeos::DeviceLocalAccountManagementPolicyProvider>
device_local_account_management_policy_provider_;
#endif
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index ad3c5d4..68a27d53 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -331,7 +331,7 @@
}
// static
-scoped_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
+std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
WebContents* contents,
TabStripModel* tab_strip,
int tab_index,
@@ -343,7 +343,7 @@
(!extension || controller->IsVisibleToExtension(extension))) {
return controller->CreateTabObject(extension, tab_index);
}
- scoped_ptr<api::tabs::Tab> result =
+ std::unique_ptr<api::tabs::Tab> result =
CreateTabObject(contents, tab_strip, tab_index);
ScrubTabForExtension(extension, contents, result.get());
return result;
@@ -365,7 +365,7 @@
}
// static
-scoped_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
+std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
content::WebContents* contents,
TabStripModel* tab_strip,
int tab_index) {
@@ -378,7 +378,7 @@
if (!tab_strip)
ExtensionTabUtil::GetTabStripModel(contents, &tab_strip, &tab_index);
bool is_loading = contents->IsLoading();
- scoped_ptr<api::tabs::Tab> tab_object(new api::tabs::Tab);
+ std::unique_ptr<api::tabs::Tab> tab_object(new api::tabs::Tab);
tab_object->id.reset(new int(GetTabIdForExtensions(contents)));
tab_object->index = tab_index;
tab_object->window_id = GetWindowIdOfTab(contents);
@@ -412,10 +412,10 @@
}
// static
-scoped_ptr<api::tabs::MutedInfo> ExtensionTabUtil::CreateMutedInfo(
+std::unique_ptr<api::tabs::MutedInfo> ExtensionTabUtil::CreateMutedInfo(
content::WebContents* contents) {
DCHECK(contents);
- scoped_ptr<api::tabs::MutedInfo> info(new api::tabs::MutedInfo);
+ std::unique_ptr<api::tabs::MutedInfo> info(new api::tabs::MutedInfo);
info->muted = contents->IsAudioMuted();
switch (chrome::GetTabAudioMutedReason(contents)) {
case TabMutedReason::NONE:
@@ -627,7 +627,7 @@
// Force the options page to open in non-OTR window, because it won't be
// able to save settings from OTR.
- scoped_ptr<chrome::ScopedTabbedBrowserDisplayer> displayer;
+ std::unique_ptr<chrome::ScopedTabbedBrowserDisplayer> displayer;
if (browser->profile()->IsOffTheRecord()) {
displayer.reset(new chrome::ScopedTabbedBrowserDisplayer(
browser->profile()->GetOriginalProfile()));
diff --git a/chrome/browser/extensions/extension_tab_util.h b/chrome/browser/extensions/extension_tab_util.h
index d871ea3..3b570b8 100644
--- a/chrome/browser/extensions/extension_tab_util.h
+++ b/chrome/browser/extensions/extension_tab_util.h
@@ -46,12 +46,12 @@
~OpenTabParams();
bool create_browser_if_needed;
- scoped_ptr<int> window_id;
- scoped_ptr<int> opener_tab_id;
- scoped_ptr<std::string> url;
- scoped_ptr<bool> active;
- scoped_ptr<bool> pinned;
- scoped_ptr<int> index;
+ std::unique_ptr<int> window_id;
+ std::unique_ptr<int> opener_tab_id;
+ std::unique_ptr<std::string> url;
+ std::unique_ptr<bool> active;
+ std::unique_ptr<bool> pinned;
+ std::unique_ptr<int> index;
};
// Opens a new tab given an extension function |function| and creation
@@ -87,12 +87,12 @@
// information about the state of a browser tab. Depending on the
// permissions of the extension, the object may or may not include sensitive
// data such as the tab's URL.
- static scoped_ptr<api::tabs::Tab> CreateTabObject(
+ static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents,
const Extension* extension) {
return CreateTabObject(web_contents, nullptr, -1, extension);
}
- static scoped_ptr<api::tabs::Tab> CreateTabObject(
+ static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents,
TabStripModel* tab_strip,
int tab_index,
@@ -100,18 +100,18 @@
// Creates a Tab object but performs no extension permissions checks; the
// returned object will contain privacy-sensitive data.
- static scoped_ptr<api::tabs::Tab> CreateTabObject(
+ static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents) {
return CreateTabObject(web_contents, nullptr, -1);
}
- static scoped_ptr<api::tabs::Tab> CreateTabObject(
+ static std::unique_ptr<api::tabs::Tab> CreateTabObject(
content::WebContents* web_contents,
TabStripModel* tab_strip,
int tab_index);
// Creates a tab MutedInfo object (see chrome/common/extensions/api/tabs.json)
// with information about the mute state of a browser tab.
- static scoped_ptr<api::tabs::MutedInfo> CreateMutedInfo(
+ static std::unique_ptr<api::tabs::MutedInfo> CreateMutedInfo(
content::WebContents* contents);
// Removes any privacy-sensitive fields from a Tab object if appropriate,
diff --git a/chrome/browser/extensions/extension_test_notification_observer.cc b/chrome/browser/extensions/extension_test_notification_observer.cc
index f0d2d52..4d6c9b0f 100644
--- a/chrome/browser/extensions/extension_test_notification_observer.cc
+++ b/chrome/browser/extensions/extension_test_notification_observer.cc
@@ -284,7 +284,7 @@
new content::MessageLoopRunner);
quit_closure_ = runner->QuitClosure();
- scoped_ptr<base::CallbackList<void()>::Subscription> subscription;
+ std::unique_ptr<base::CallbackList<void()>::Subscription> subscription;
if (notification_set) {
subscription = notification_set->callback_list().Add(
base::Bind(&ExtensionTestNotificationObserver::MaybeQuit,
diff --git a/chrome/browser/extensions/extension_test_notification_observer.h b/chrome/browser/extensions/extension_test_notification_observer.h
index 08dce93..d4b8d86 100644
--- a/chrome/browser/extensions/extension_test_notification_observer.h
+++ b/chrome/browser/extensions/extension_test_notification_observer.h
@@ -108,7 +108,7 @@
Profile* profile_;
content::NotificationRegistrar registrar_;
- scoped_ptr<content::WindowedNotificationObserver> observer_;
+ std::unique_ptr<content::WindowedNotificationObserver> observer_;
std::string last_loaded_extension_id_;
int extension_installs_observed_;
diff --git a/chrome/browser/extensions/extension_user_script_loader_unittest.cc b/chrome/browser/extensions/extension_user_script_loader_unittest.cc
index e211b489..2e5db25 100644
--- a/chrome/browser/extensions/extension_user_script_loader_unittest.cc
+++ b/chrome/browser/extensions/extension_user_script_loader_unittest.cc
@@ -84,8 +84,8 @@
// MessageLoop used in tests.
base::MessageLoopForUI message_loop_;
- scoped_ptr<content::TestBrowserThread> file_thread_;
- scoped_ptr<content::TestBrowserThread> ui_thread_;
+ std::unique_ptr<content::TestBrowserThread> file_thread_;
+ std::unique_ptr<content::TestBrowserThread> ui_thread_;
// Updated to the script shared memory when we get notified.
base::SharedMemory* shared_memory_;
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 6cb221c..4f8ffbd 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -294,7 +294,7 @@
SharedModuleService* service = ExtensionSystem::Get(context)
->extension_service()
->shared_module_service();
- scoped_ptr<ExtensionSet> dependents =
+ std::unique_ptr<ExtensionSet> dependents =
service->GetDependentExtensions(extension);
for (ExtensionSet::const_iterator i = dependents->begin();
i != dependents->end();
@@ -330,9 +330,10 @@
context, Extension::GetBaseURLFromExtensionId(extension_id));
}
-scoped_ptr<base::DictionaryValue> GetExtensionInfo(const Extension* extension) {
+std::unique_ptr<base::DictionaryValue> GetExtensionInfo(
+ const Extension* extension) {
DCHECK(extension);
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetString("id", extension->id());
dict->SetString("name", extension->name());
diff --git a/chrome/browser/extensions/extension_util.h b/chrome/browser/extensions/extension_util.h
index b0d0379..7fa21e4b 100644
--- a/chrome/browser/extensions/extension_util.h
+++ b/chrome/browser/extensions/extension_util.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "url/gurl.h"
namespace base {
@@ -112,7 +112,8 @@
// Sets the name, id, and icon resource path of the given extension into the
// returned dictionary.
-scoped_ptr<base::DictionaryValue> GetExtensionInfo(const Extension* extension);
+std::unique_ptr<base::DictionaryValue> GetExtensionInfo(
+ const Extension* extension);
// Returns the default extension/app icon (for extensions or apps that don't
// have one).
diff --git a/chrome/browser/extensions/extension_view_host.h b/chrome/browser/extensions/extension_view_host.h
index a5966d2..ad4721d 100644
--- a/chrome/browser/extensions/extension_view_host.h
+++ b/chrome/browser/extensions/extension_view_host.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/notification_observer.h"
@@ -110,18 +111,20 @@
private:
// Implemented per-platform. Create the platform-specific ExtensionView.
- static scoped_ptr<ExtensionView> CreateExtensionView(ExtensionViewHost* host,
- Browser* browser);
+ static std::unique_ptr<ExtensionView> CreateExtensionView(
+ ExtensionViewHost* host,
+ Browser* browser);
// Optional view that shows the rendered content in the UI.
- scoped_ptr<ExtensionView> view_;
+ std::unique_ptr<ExtensionView> view_;
// The relevant WebContents associated with this ExtensionViewHost, if any.
content::WebContents* associated_web_contents_;
// Observer to detect when the associated web contents is destroyed.
class AssociatedWebContentsObserver;
- scoped_ptr<AssociatedWebContentsObserver> associated_web_contents_observer_;
+ std::unique_ptr<AssociatedWebContentsObserver>
+ associated_web_contents_observer_;
content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/extensions/extension_view_host_factory_browsertest.cc b/chrome/browser/extensions/extension_view_host_factory_browsertest.cc
index 83d468a3..b72cb7a 100644
--- a/chrome/browser/extensions/extension_view_host_factory_browsertest.cc
+++ b/chrome/browser/extensions/extension_view_host_factory_browsertest.cc
@@ -27,7 +27,7 @@
content::BrowserContext* browser_context = browser()->profile();
{
// Popup hosts are created with the correct type and profile.
- scoped_ptr<ExtensionViewHost> host(
+ std::unique_ptr<ExtensionViewHost> host(
ExtensionViewHostFactory::CreatePopupHost(extension->url(), browser()));
EXPECT_EQ(extension.get(), host->extension());
EXPECT_EQ(browser_context, host->browser_context());
@@ -37,7 +37,7 @@
{
// Dialog hosts are created with the correct type and profile.
- scoped_ptr<ExtensionViewHost> host(
+ std::unique_ptr<ExtensionViewHost> host(
ExtensionViewHostFactory::CreateDialogHost(extension->url(),
browser()->profile()));
EXPECT_EQ(extension.get(), host->extension());
@@ -65,9 +65,9 @@
// The ExtensionHost for a regular extension in an incognito window is
// associated with the original window's profile.
- scoped_ptr<ExtensionHost> regular_host(
- ExtensionViewHostFactory::CreatePopupHost(
- regular_extension->url(), incognito_browser));
+ std::unique_ptr<ExtensionHost> regular_host(
+ ExtensionViewHostFactory::CreatePopupHost(regular_extension->url(),
+ incognito_browser));
content::BrowserContext* browser_context = browser()->profile();
EXPECT_EQ(browser_context, regular_host->browser_context());
@@ -80,9 +80,9 @@
// The ExtensionHost for a split-mode extension is associated with the
// incognito profile.
- scoped_ptr<ExtensionHost> split_mode_host(
- ExtensionViewHostFactory::CreatePopupHost(
- split_mode_extension->url(), incognito_browser));
+ std::unique_ptr<ExtensionHost> split_mode_host(
+ ExtensionViewHostFactory::CreatePopupHost(split_mode_extension->url(),
+ incognito_browser));
content::BrowserContext* incognito_context = incognito_browser->profile();
EXPECT_EQ(incognito_context, split_mode_host->browser_context());
}
diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc
index 1c9abcd..a562789 100644
--- a/chrome/browser/extensions/extension_web_ui.cc
+++ b/chrome/browser/extensions/extension_web_ui.cc
@@ -66,7 +66,8 @@
base::ListValue migrated;
std::set<std::string> seen_entries;
for (base::Value* val : *list) {
- scoped_ptr<base::DictionaryValue> new_dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> new_dict(
+ new base::DictionaryValue());
std::string entry_name;
base::DictionaryValue* existing_dict = nullptr;
if (val->GetAsDictionary(&existing_dict)) {
@@ -108,7 +109,7 @@
}
}
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString(kEntry, override);
dict->SetBoolean(kActive, true);
// Add the entry to the front of the list.
@@ -127,7 +128,8 @@
NOTREACHED();
continue;
}
- scoped_ptr<base::DictionaryValue> new_dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> new_dict(
+ new base::DictionaryValue());
new_dict->Swap(dict);
GURL override_url(entry);
if (!override_url.is_valid())
@@ -483,9 +485,9 @@
// static
void ExtensionWebUI::ValidateChromeURLOverrides(Profile* profile) {
- scoped_ptr<extensions::ExtensionSet> all_extensions =
- extensions::ExtensionRegistry::Get(profile)->
- GenerateInstalledExtensionsSet();
+ std::unique_ptr<extensions::ExtensionSet> all_extensions =
+ extensions::ExtensionRegistry::Get(profile)
+ ->GenerateInstalledExtensionsSet();
ForEachOverrideList(profile,
base::Bind(&ValidateOverridesList, all_extensions.get()));
diff --git a/chrome/browser/extensions/extension_web_ui.h b/chrome/browser/extensions/extension_web_ui.h
index 2d32f04..3a9dbd5 100644
--- a/chrome/browser/extensions/extension_web_ui.h
+++ b/chrome/browser/extensions/extension_web_ui.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/chrome_manifest_url_handlers.h"
#include "components/favicon_base/favicon_callback.h"
#include "content/public/browser/web_ui_controller.h"
@@ -94,7 +94,7 @@
// TODO(aa): This seems out of place. Why is it not with the event routers for
// the other extension APIs?
- scoped_ptr<extensions::BookmarkManagerPrivateDragEventRouter>
+ std::unique_ptr<extensions::BookmarkManagerPrivateDragEventRouter>
bookmark_manager_private_drag_event_router_;
// The URL this WebUI was created for.
diff --git a/chrome/browser/extensions/extension_web_ui_unittest.cc b/chrome/browser/extensions/extension_web_ui_unittest.cc
index f75a531..f96b526 100644
--- a/chrome/browser/extensions/extension_web_ui_unittest.cc
+++ b/chrome/browser/extensions/extension_web_ui_unittest.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/extension_web_ui.h"
+
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_web_ui.h"
#include "chrome/browser/extensions/extension_web_ui_override_registrar.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/test/base/testing_profile.h"
@@ -27,9 +29,9 @@
namespace {
-scoped_ptr<KeyedService> BuildOverrideRegistrar(
+std::unique_ptr<KeyedService> BuildOverrideRegistrar(
content::BrowserContext* context) {
- return make_scoped_ptr(new ExtensionWebUIOverrideRegistrar(context));
+ return base::WrapUnique(new ExtensionWebUIOverrideRegistrar(context));
}
} // namespace
@@ -56,7 +58,7 @@
message_loop_.RunUntilIdle();
}
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ExtensionService* extension_service_;
base::MessageLoop message_loop_;
content::TestBrowserThread ui_thread_;
diff --git a/chrome/browser/extensions/extension_webui_apitest.cc b/chrome/browser/extensions/extension_webui_apitest.cc
index beabffd..de1a34c7 100644
--- a/chrome/browser/extensions/extension_webui_apitest.cc
+++ b/chrome/browser/extensions/extension_webui_apitest.cc
@@ -4,6 +4,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -137,7 +138,7 @@
// Tests chrome.test.sendMessage, which exercises WebUI making a
// function call and receiving a response.
IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, SendMessage) {
- scoped_ptr<ExtensionTestMessageListener> listener(
+ std::unique_ptr<ExtensionTestMessageListener> listener(
new ExtensionTestMessageListener("ping", true));
ASSERT_TRUE(RunTestOnExtensionsFrame("send_message.js"));
@@ -158,11 +159,11 @@
OnMessage::Info info;
info.data = "hi";
info.last_message = true;
- EventRouter::Get(profile())->BroadcastEvent(make_scoped_ptr(
+ EventRouter::Get(profile())->BroadcastEvent(base::WrapUnique(
new Event(events::RUNTIME_ON_MESSAGE, OnMessage::kEventName,
OnMessage::Create(info))));
- scoped_ptr<ExtensionTestMessageListener> listener(
+ std::unique_ptr<ExtensionTestMessageListener> listener(
new ExtensionTestMessageListener(false));
ASSERT_TRUE(listener->WaitUntilSatisfied());
EXPECT_EQ("true", listener->message());
@@ -171,7 +172,7 @@
// Tests chrome.runtime.lastError, which exercises WebUI accessing a property
// on an API which it doesn't actually have access to. A bindings test really.
IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, RuntimeLastError) {
- scoped_ptr<ExtensionTestMessageListener> listener(
+ std::unique_ptr<ExtensionTestMessageListener> listener(
new ExtensionTestMessageListener("ping", true));
ASSERT_TRUE(RunTestOnExtensionsFrame("runtime_last_error.js"));
@@ -185,7 +186,7 @@
}
IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, CanEmbedExtensionOptions) {
- scoped_ptr<ExtensionTestMessageListener> listener(
+ std::unique_ptr<ExtensionTestMessageListener> listener(
new ExtensionTestMessageListener("ready", true));
const Extension* extension =
@@ -202,7 +203,7 @@
}
IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, ReceivesExtensionOptionsOnClose) {
- scoped_ptr<ExtensionTestMessageListener> listener(
+ std::unique_ptr<ExtensionTestMessageListener> listener(
new ExtensionTestMessageListener("ready", true));
const Extension* extension =
@@ -224,7 +225,7 @@
// Same setup as CanEmbedExtensionOptions but disable the extension before
// embedding.
IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, EmbedDisabledExtension) {
- scoped_ptr<ExtensionTestMessageListener> listener(
+ std::unique_ptr<ExtensionTestMessageListener> listener(
new ExtensionTestMessageListener("ready", true));
std::string extension_id;
diff --git a/chrome/browser/extensions/external_install_error.cc b/chrome/browser/extensions/external_install_error.cc
index 640faa9..1a493fa 100644
--- a/chrome/browser/extensions/external_install_error.cc
+++ b/chrome/browser/extensions/external_install_error.cc
@@ -383,7 +383,7 @@
}
void ExternalInstallError::OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) {
+ std::unique_ptr<base::DictionaryValue> webstore_data) {
std::string localized_user_count;
double average_rating = 0;
int rating_count = 0;
@@ -429,7 +429,7 @@
void ExternalInstallError::OnDialogReady(
ExtensionInstallPromptShowParams* show_params,
const ExtensionInstallPrompt::DoneCallback& callback,
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt) {
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt) {
prompt_ = std::move(prompt);
if (alert_type_ == BUBBLE_ALERT) {
diff --git a/chrome/browser/extensions/external_install_error.h b/chrome/browser/extensions/external_install_error.h
index a74288b8..09c7d41 100644
--- a/chrome/browser/extensions/external_install_error.h
+++ b/chrome/browser/extensions/external_install_error.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_
#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/webstore_data_fetcher_delegate.h"
@@ -69,7 +69,7 @@
// WebstoreDataFetcherDelegate implementation.
void OnWebstoreRequestFailure() override;
void OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) override;
+ std::unique_ptr<base::DictionaryValue> webstore_data) override;
void OnWebstoreResponseParseFailure(const std::string& error) override;
// Called when data fetching has completed (either successfully or not).
@@ -79,7 +79,7 @@
// shown.
void OnDialogReady(ExtensionInstallPromptShowParams* show_params,
const ExtensionInstallPrompt::DoneCallback& done_callback,
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt);
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt);
// Removes the error.
void RemoveError();
@@ -100,17 +100,17 @@
GlobalErrorService* error_service_;
// The UI for showing the error.
- scoped_ptr<ExtensionInstallPrompt> install_ui_;
- scoped_ptr<ExtensionInstallPromptShowParams> install_ui_show_params_;
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui_;
+ std::unique_ptr<ExtensionInstallPromptShowParams> install_ui_show_params_;
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt_;
// The UI for the given error, which will take the form of either a menu
// alert or a bubble alert (depending on the |alert_type_|.
- scoped_ptr<GlobalError> global_error_;
+ std::unique_ptr<GlobalError> global_error_;
// The WebstoreDataFetcher to use in order to populate the error with webstore
// information of the extension.
- scoped_ptr<WebstoreDataFetcher> webstore_data_fetcher_;
+ std::unique_ptr<WebstoreDataFetcher> webstore_data_fetcher_;
base::WeakPtrFactory<ExternalInstallError> weak_factory_;
diff --git a/chrome/browser/extensions/external_install_manager.cc b/chrome/browser/extensions/external_install_manager.cc
index 70737e83..4ced39a4 100644
--- a/chrome/browser/extensions/external_install_manager.cc
+++ b/chrome/browser/extensions/external_install_manager.cc
@@ -87,7 +87,7 @@
? ExternalInstallError::BUBBLE_ALERT
: ExternalInstallError::MENU_ALERT;
- scoped_ptr<ExternalInstallError> error(new ExternalInstallError(
+ std::unique_ptr<ExternalInstallError> error(new ExternalInstallError(
browser_context_, extension->id(), alert_type, this));
shown_ids_.insert(extension->id());
errors_.insert(std::make_pair(extension->id(), std::move(error)));
@@ -95,7 +95,7 @@
void ExternalInstallManager::RemoveExternalInstallError(
const std::string& extension_id) {
- std::map<std::string, scoped_ptr<ExternalInstallError>>::iterator iter =
+ std::map<std::string, std::unique_ptr<ExternalInstallError>>::iterator iter =
errors_.find(extension_id);
if (iter != errors_.end()) {
if (iter->second.get() == currently_visible_install_alert_)
diff --git a/chrome/browser/extensions/external_install_manager.h b/chrome/browser/extensions/external_install_manager.h
index 82732fac..51f3a14 100644
--- a/chrome/browser/extensions/external_install_manager.h
+++ b/chrome/browser/extensions/external_install_manager.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_
#include <map>
+#include <memory>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -95,7 +95,7 @@
ExtensionPrefs* extension_prefs_;
// The collection of ExternalInstallErrors.
- std::map<std::string, scoped_ptr<ExternalInstallError>> errors_;
+ std::map<std::string, std::unique_ptr<ExternalInstallError>> errors_;
std::set<std::string> shown_ids_;
diff --git a/chrome/browser/extensions/external_loader.cc b/chrome/browser/extensions/external_loader.cc
index 662cdeb..c35316b 100644
--- a/chrome/browser/extensions/external_loader.cc
+++ b/chrome/browser/extensions/external_loader.cc
@@ -45,7 +45,7 @@
}
void ExternalLoader::OnUpdated(
- scoped_ptr<base::DictionaryValue> updated_prefs) {
+ std::unique_ptr<base::DictionaryValue> updated_prefs) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (owner_)
owner_->UpdatePrefs(updated_prefs.release());
diff --git a/chrome/browser/extensions/external_loader.h b/chrome/browser/extensions/external_loader.h
index 5bc8551..ecc11d68 100644
--- a/chrome/browser/extensions/external_loader.h
+++ b/chrome/browser/extensions/external_loader.h
@@ -5,10 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
namespace base {
class DictionaryValue;
@@ -59,7 +60,7 @@
virtual void LoadFinished();
// Notifies the provider that the list of extensions has been updated.
- virtual void OnUpdated(scoped_ptr<base::DictionaryValue> updated_prefs);
+ virtual void OnUpdated(std::unique_ptr<base::DictionaryValue> updated_prefs);
// Used for passing the list of extensions from the method that loads them
// to |LoadFinished|. To ensure thread safety, the rules are the following:
@@ -68,7 +69,7 @@
// this task should invoke |LoadFinished| with a PostTask. This scheme of
// posting tasks will avoid concurrent access and imply the necessary memory
// barriers.
- scoped_ptr<base::DictionaryValue> prefs_;
+ std::unique_ptr<base::DictionaryValue> prefs_;
private:
friend class base::RefCountedThreadSafe<ExternalLoader>;
diff --git a/chrome/browser/extensions/external_policy_loader_unittest.cc b/chrome/browser/extensions/external_policy_loader_unittest.cc
index 3807ee7..7fd52e00 100644
--- a/chrome/browser/extensions/external_policy_loader_unittest.cc
+++ b/chrome/browser/extensions/external_policy_loader_unittest.cc
@@ -85,7 +85,7 @@
// Provider returns the correct location when asked.
Manifest::Location location1;
- scoped_ptr<Version> version1;
+ std::unique_ptr<Version> version1;
provider_->GetExtensionDetails(info.extension_id, &location1, &version1);
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1);
EXPECT_FALSE(version1.get());
@@ -112,9 +112,9 @@
private:
std::set<std::string> expected_extensions_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
- scoped_ptr<ExternalProviderImpl> provider_;
+ std::unique_ptr<ExternalProviderImpl> provider_;
DISALLOW_COPY_AND_ASSIGN(MockExternalPolicyProviderVisitor);
};
diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc
index 02d8ea7..b02e1cd 100644
--- a/chrome/browser/extensions/external_pref_loader.cc
+++ b/chrome/browser/extensions/external_pref_loader.cc
@@ -13,6 +13,7 @@
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
@@ -75,19 +76,19 @@
// occurs). An empty dictionary is returned in case of failure (e.g. invalid
// path or json content).
// Caller takes ownership of the returned dictionary.
-scoped_ptr<base::DictionaryValue> ExtractExtensionPrefs(
+std::unique_ptr<base::DictionaryValue> ExtractExtensionPrefs(
base::ValueDeserializer* deserializer,
const base::FilePath& path) {
std::string error_msg;
- scoped_ptr<base::Value> extensions =
+ std::unique_ptr<base::Value> extensions =
deserializer->Deserialize(NULL, &error_msg);
if (!extensions) {
LOG(WARNING) << "Unable to deserialize json data: " << error_msg
<< " in file " << path.value() << ".";
- return make_scoped_ptr(new base::DictionaryValue);
+ return base::WrapUnique(new base::DictionaryValue);
}
- scoped_ptr<base::DictionaryValue> ext_dictionary =
+ std::unique_ptr<base::DictionaryValue> ext_dictionary =
base::DictionaryValue::From(std::move(extensions));
if (ext_dictionary) {
return ext_dictionary;
@@ -95,8 +96,7 @@
LOG(WARNING) << "Expected a JSON dictionary in file " << path.value()
<< ".";
- return make_scoped_ptr(new base::DictionaryValue);
-
+ return base::WrapUnique(new base::DictionaryValue);
}
} // namespace
@@ -197,7 +197,7 @@
void ExternalPrefLoader::LoadOnFileThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- scoped_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
// TODO(skerner): Some values of base_path_id_ will cause
// PathService::Get() to return false, because the path does
@@ -267,7 +267,7 @@
}
JSONFileValueDeserializer deserializer(json_file);
- scoped_ptr<base::DictionaryValue> ext_prefs =
+ std::unique_ptr<base::DictionaryValue> ext_prefs =
ExtractExtensionPrefs(&deserializer, json_file);
if (ext_prefs)
prefs->MergeDictionary(ext_prefs.get());
@@ -305,7 +305,7 @@
<< extension_candidate_path.LossyDisplayName();
JSONFileValueDeserializer deserializer(extension_candidate_path);
- scoped_ptr<base::DictionaryValue> ext_prefs =
+ std::unique_ptr<base::DictionaryValue> ext_prefs =
ExtractExtensionPrefs(&deserializer, extension_candidate_path);
if (ext_prefs) {
DVLOG(1) << "Adding extension with id: " << id;
diff --git a/chrome/browser/extensions/external_pref_loader.h b/chrome/browser/extensions/external_pref_loader.h
index 2357993..776cca14 100644
--- a/chrome/browser/extensions/external_pref_loader.h
+++ b/chrome/browser/extensions/external_pref_loader.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/values.h"
#include "chrome/browser/extensions/external_loader.h"
@@ -135,7 +135,7 @@
~ExternalTestingLoader() override;
base::FilePath fake_base_path_;
- scoped_ptr<base::DictionaryValue> testing_prefs_;
+ std::unique_ptr<base::DictionaryValue> testing_prefs_;
DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader);
};
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc
index 90fea6d..9d130940 100644
--- a/chrome/browser/extensions/external_provider_impl.cc
+++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -343,7 +343,7 @@
path = base_path.Append(external_crx);
}
- scoped_ptr<Version> version(new Version(external_version));
+ std::unique_ptr<Version> version(new Version(external_version));
if (!version->IsValid()) {
LOG(WARNING) << "Malformed extension dictionary for extension: "
<< extension_id.c_str() << ". Invalid version string \""
@@ -360,7 +360,7 @@
<< "extensions from update URLs.";
continue;
}
- scoped_ptr<GURL> update_url(new GURL(external_update_url));
+ std::unique_ptr<GURL> update_url(new GURL(external_update_url));
if (!update_url->is_valid()) {
LOG(WARNING) << "Malformed extension dictionary for extension: "
<< extension_id.c_str() << ". Key " << kExternalUpdateUrl
@@ -400,8 +400,9 @@
}
bool ExternalProviderImpl::GetExtensionDetails(
- const std::string& id, Manifest::Location* location,
- scoped_ptr<Version>* version) const {
+ const std::string& id,
+ Manifest::Location* location,
+ std::unique_ptr<Version>* version) const {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CHECK(prefs_.get());
CHECK(ready_);
@@ -557,7 +558,7 @@
if (connector && connector->IsEnterpriseManaged())
location = Manifest::EXTERNAL_POLICY;
- scoped_ptr<ExternalProviderImpl> kiosk_app_provider(
+ std::unique_ptr<ExternalProviderImpl> kiosk_app_provider(
new ExternalProviderImpl(
service, kiosk_app_manager->CreateExternalLoader(), profile,
location, Manifest::INVALID_LOCATION, Extension::NO_FLAGS));
@@ -569,7 +570,7 @@
// Kiosk secondary app external provider.
if (!kiosk_app_manager->secondary_app_external_loader_created()) {
- scoped_ptr<ExternalProviderImpl> secondary_kiosk_app_provider(
+ std::unique_ptr<ExternalProviderImpl> secondary_kiosk_app_provider(
new ExternalProviderImpl(
service, kiosk_app_manager->CreateSecondaryAppExternalLoader(),
profile, Manifest::EXTERNAL_PREF,
@@ -719,17 +720,13 @@
Extension::WAS_INSTALLED_BY_DEFAULT)));
#endif
- scoped_ptr<ExternalProviderImpl> drive_migration_provider(
+ std::unique_ptr<ExternalProviderImpl> drive_migration_provider(
new ExternalProviderImpl(
service,
- new ExtensionMigrator(profile,
- extension_misc::kDriveHostedAppId,
+ new ExtensionMigrator(profile, extension_misc::kDriveHostedAppId,
extension_misc::kDriveExtensionId),
- profile,
- Manifest::EXTERNAL_PREF,
- Manifest::EXTERNAL_PREF_DOWNLOAD,
- Extension::FROM_WEBSTORE |
- Extension::WAS_INSTALLED_BY_DEFAULT));
+ profile, Manifest::EXTERNAL_PREF, Manifest::EXTERNAL_PREF_DOWNLOAD,
+ Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT));
drive_migration_provider->set_auto_acknowledge(true);
provider_list->push_back(linked_ptr<ExternalProviderInterface>(
drive_migration_provider.release()));
diff --git a/chrome/browser/extensions/external_provider_impl.h b/chrome/browser/extensions/external_provider_impl.h
index 4cc4985d..d1bb516 100644
--- a/chrome/browser/extensions/external_provider_impl.h
+++ b/chrome/browser/extensions/external_provider_impl.h
@@ -64,9 +64,10 @@
void ServiceShutdown() override;
void VisitRegisteredExtension() override;
bool HasExtension(const std::string& id) const override;
- bool GetExtensionDetails(const std::string& id,
- Manifest::Location* location,
- scoped_ptr<base::Version>* version) const override;
+ bool GetExtensionDetails(
+ const std::string& id,
+ Manifest::Location* location,
+ std::unique_ptr<base::Version>* version) const override;
bool IsReady() const override;
@@ -120,7 +121,7 @@
VisitorInterface* service_; // weak
// Dictionary of the external extensions that are provided by this provider.
- scoped_ptr<base::DictionaryValue> prefs_;
+ std::unique_ptr<base::DictionaryValue> prefs_;
// Indicates that the extensions provided by this provider are loaded
// entirely.
diff --git a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc
index 3cd14d7a..7efc028 100644
--- a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc
+++ b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc
@@ -4,9 +4,10 @@
#include "chrome/browser/extensions/external_provider_impl.h"
+#include <memory>
+
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/test/scoped_path_override.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
@@ -87,7 +88,7 @@
}
private:
- scoped_ptr<base::ScopedPathOverride> external_externsions_overrides_;
+ std::unique_ptr<base::ScopedPathOverride> external_externsions_overrides_;
chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
user_manager::FakeUserManager* fake_user_manager_;
chromeos::ScopedUserManagerEnabler scoped_user_manager_;
@@ -199,9 +200,9 @@
->GetSyncableService(syncer::PRIORITY_PREFERENCES)
->MergeDataAndStartSyncing(syncer::PRIORITY_PREFERENCES,
syncer::SyncDataList(),
- scoped_ptr<syncer::SyncChangeProcessor>(
+ std::unique_ptr<syncer::SyncChangeProcessor>(
new syncer::FakeSyncChangeProcessor),
- scoped_ptr<syncer::SyncErrorFactory>(
+ std::unique_ptr<syncer::SyncErrorFactory>(
new syncer::SyncErrorFactoryMock()));
content::WindowedNotificationObserver(
diff --git a/chrome/browser/extensions/external_provider_impl_unittest.cc b/chrome/browser/extensions/external_provider_impl_unittest.cc
index 649626e..f99888bb 100644
--- a/chrome/browser/extensions/external_provider_impl_unittest.cc
+++ b/chrome/browser/extensions/external_provider_impl_unittest.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/external_provider_impl.h"
+#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_path_override.h"
@@ -115,10 +115,10 @@
}
private:
- scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
+ std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
GURL url = test_server_->GetURL(request.relative_url);
if (url.path() == kManifestPath) {
- scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse);
+ std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse);
response->set_code(net::HTTP_OK);
response->set_content(base::StringPrintf(
"<?xml version='1.0' encoding='UTF-8'?>\n"
@@ -140,7 +140,7 @@
base::ReadFileToString(
test_data_dir.AppendASCII("extensions/dummyiap.crx"),
&contents);
- scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse);
+ std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse);
response->set_code(net::HTTP_OK);
response->set_content(contents);
return std::move(response);
@@ -149,8 +149,8 @@
return nullptr;
}
- scoped_ptr<EmbeddedTestServer> test_server_;
- scoped_ptr<ExtensionCacheFake> test_extension_cache_;
+ std::unique_ptr<EmbeddedTestServer> test_server_;
+ std::unique_ptr<ExtensionCacheFake> test_extension_cache_;
#if defined(OS_CHROMEOS)
// chromeos::ServicesCustomizationExternalLoader is hooked up as an
diff --git a/chrome/browser/extensions/external_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc
index 89e969c5..9b660b2e 100644
--- a/chrome/browser/extensions/external_registry_loader_win.cc
+++ b/chrome/browser/extensions/external_registry_loader_win.cc
@@ -61,10 +61,10 @@
base::Bind(&ExternalRegistryLoader::LoadOnFileThread, this));
}
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
ExternalRegistryLoader::LoadPrefsOnFileThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- scoped_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
// A map of IDs, to weed out duplicates between HKCU and HKLM.
std::set<base::string16> keys;
@@ -187,7 +187,8 @@
void ExternalRegistryLoader::LoadOnFileThread() {
base::TimeTicks start_time = base::TimeTicks::Now();
- scoped_ptr<base::DictionaryValue> initial_prefs = LoadPrefsOnFileThread();
+ std::unique_ptr<base::DictionaryValue> initial_prefs =
+ LoadPrefsOnFileThread();
prefs_.reset(initial_prefs.release());
LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin",
base::TimeTicks::Now() - start_time);
@@ -237,7 +238,7 @@
void ExternalRegistryLoader::UpdatePrefsOnFileThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::TimeTicks start_time = base::TimeTicks::Now();
- scoped_ptr<base::DictionaryValue> prefs = LoadPrefsOnFileThread();
+ std::unique_ptr<base::DictionaryValue> prefs = LoadPrefsOnFileThread();
LOCAL_HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWinUpdate",
base::TimeTicks::Now() - start_time);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
diff --git a/chrome/browser/extensions/external_registry_loader_win.h b/chrome/browser/extensions/external_registry_loader_win.h
index fca0c57..e14fb86 100644
--- a/chrome/browser/extensions/external_registry_loader_win.h
+++ b/chrome/browser/extensions/external_registry_loader_win.h
@@ -24,7 +24,7 @@
~ExternalRegistryLoader() override {}
- scoped_ptr<base::DictionaryValue> LoadPrefsOnFileThread();
+ std::unique_ptr<base::DictionaryValue> LoadPrefsOnFileThread();
void LoadOnFileThread();
void CompleteLoadAndStartWatchingRegistry();
void UpdatePrefsOnFileThread();
diff --git a/chrome/browser/extensions/fake_safe_browsing_database_manager.cc b/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
index 755d7385..f50337a 100644
--- a/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
+++ b/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
@@ -103,7 +103,7 @@
std::back_inserter(extension_id_hashes),
safe_browsing::StringToSBFullHash);
- scoped_ptr<SafeBrowsingCheck> safe_browsing_check(
+ std::unique_ptr<SafeBrowsingCheck> safe_browsing_check(
new SafeBrowsingCheck(std::vector<GURL>(), extension_id_hashes, client,
safe_browsing::EXTENSIONBLACKLIST,
std::vector<safe_browsing::SBThreatType>(
@@ -124,7 +124,7 @@
}
void FakeSafeBrowsingDatabaseManager::OnSafeBrowsingResult(
- scoped_ptr<SafeBrowsingCheck> result) {
+ std::unique_ptr<SafeBrowsingCheck> result) {
result->OnSafeBrowsingResult();
}
diff --git a/chrome/browser/extensions/fake_safe_browsing_database_manager.h b/chrome/browser/extensions/fake_safe_browsing_database_manager.h
index 1a426b2..29d6102 100644
--- a/chrome/browser/extensions/fake_safe_browsing_database_manager.h
+++ b/chrome/browser/extensions/fake_safe_browsing_database_manager.h
@@ -51,7 +51,7 @@
~FakeSafeBrowsingDatabaseManager() override;
// Runs result->SafeBrowsingResult().
- void OnSafeBrowsingResult(scoped_ptr<SafeBrowsingCheck> result);
+ void OnSafeBrowsingResult(std::unique_ptr<SafeBrowsingCheck> result);
// Whether to respond to CheckExtensionIDs immediately with true (indicating
// that there is definitely no extension ID match).
diff --git a/chrome/browser/extensions/global_shortcut_listener_win.h b/chrome/browser/extensions/global_shortcut_listener_win.h
index 7d7d34d..833185e3 100644
--- a/chrome/browser/extensions/global_shortcut_listener_win.h
+++ b/chrome/browser/extensions/global_shortcut_listener_win.h
@@ -7,8 +7,9 @@
#include <windows.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/global_shortcut_listener.h"
#include "ui/gfx/win/singleton_hwnd_observer.h"
@@ -39,7 +40,7 @@
typedef std::map<ui::Accelerator, int> HotkeyIdMap;
HotkeyIdMap hotkey_ids_;
- scoped_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_;
+ std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_;
DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerWin);
};
diff --git a/chrome/browser/extensions/install_signer.cc b/chrome/browser/extensions/install_signer.cc
index 4df8e82..9bf403c 100644
--- a/chrome/browser/extensions/install_signer.cc
+++ b/chrome/browser/extensions/install_signer.cc
@@ -92,7 +92,7 @@
machine_id = "unknown";
#endif
- scoped_ptr<crypto::SecureHash> hash(
+ std::unique_ptr<crypto::SecureHash> hash(
crypto::SecureHash::Create(crypto::SecureHash::SHA256));
hash->Update(machine_id.data(), machine_id.size());
@@ -181,10 +181,9 @@
}
// static
-scoped_ptr<InstallSignature> InstallSignature::FromValue(
+std::unique_ptr<InstallSignature> InstallSignature::FromValue(
const base::DictionaryValue& value) {
-
- scoped_ptr<InstallSignature> result(new InstallSignature);
+ std::unique_ptr<InstallSignature> result(new InstallSignature);
// For now we don't want to support any backwards compability, but in the
// future if we do, we would want to put the migration code here.
@@ -351,7 +350,7 @@
// call to the server.
if (ids_.empty()) {
if (!callback_.is_null())
- callback_.Run(scoped_ptr<InstallSignature>(new InstallSignature()));
+ callback_.Run(std::unique_ptr<InstallSignature>(new InstallSignature()));
return;
}
@@ -387,7 +386,7 @@
base::DictionaryValue dictionary;
dictionary.SetInteger(kProtocolVersionKey, 1);
dictionary.SetString(kHashKey, hash_base64);
- scoped_ptr<base::ListValue> id_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> id_list(new base::ListValue);
for (ExtensionIdSet::const_iterator i = ids_.begin(); i != ids_.end(); ++i) {
id_list->AppendString(*i);
}
@@ -408,7 +407,7 @@
void InstallSigner::ReportErrorViaCallback() {
InstallSignature* null_signature = NULL;
if (!callback_.is_null())
- callback_.Run(scoped_ptr<InstallSignature>(null_signature));
+ callback_.Run(std::unique_ptr<InstallSignature>(null_signature));
}
void InstallSigner::ParseFetchResponse() {
@@ -439,7 +438,7 @@
// could not be verified to be in the webstore.
base::DictionaryValue* dictionary = NULL;
- scoped_ptr<base::Value> parsed = base::JSONReader::Read(response);
+ std::unique_ptr<base::Value> parsed = base::JSONReader::Read(response);
bool json_success = parsed.get() && parsed->GetAsDictionary(&dictionary);
UMA_HISTOGRAM_BOOLEAN("ExtensionInstallSigner.ParseJsonSuccess",
json_success);
@@ -490,7 +489,7 @@
ExtensionIdSet valid_ids =
base::STLSetDifference<ExtensionIdSet>(ids_, invalid_ids);
- scoped_ptr<InstallSignature> result;
+ std::unique_ptr<InstallSignature> result;
if (!signature.empty()) {
result.reset(new InstallSignature);
result->ids = valid_ids;
diff --git a/chrome/browser/extensions/install_signer.h b/chrome/browser/extensions/install_signer.h
index 81d3d7af..0b4bcca5 100644
--- a/chrome/browser/extensions/install_signer.h
+++ b/chrome/browser/extensions/install_signer.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_
#define CHROME_BROWSER_EXTENSIONS_INSTALL_SIGNER_H_
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/common/extension.h"
namespace base {
@@ -53,7 +53,7 @@
// Helper methods for serialization to/from a base::DictionaryValue.
void ToValue(base::DictionaryValue* value) const;
- static scoped_ptr<InstallSignature> FromValue(
+ static std::unique_ptr<InstallSignature> FromValue(
const base::DictionaryValue& value);
};
@@ -61,7 +61,8 @@
// that a set of ids are hosted in the webstore.
class InstallSigner {
public:
- typedef base::Callback<void(scoped_ptr<InstallSignature>)> SignatureCallback;
+ typedef base::Callback<void(std::unique_ptr<InstallSignature>)>
+ SignatureCallback;
// IMPORTANT NOTE: It is possible that only some, but not all, of the entries
// in |ids| will be successfully signed by the backend. Callers should always
@@ -115,8 +116,8 @@
// These are used to make the call to a backend server for a signature.
net::URLRequestContextGetter* context_getter_;
- scoped_ptr<net::URLFetcher> url_fetcher_;
- scoped_ptr<FetcherDelegate> delegate_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<FetcherDelegate> delegate_;
// The time the request to the server was started.
base::Time request_start_time_;
diff --git a/chrome/browser/extensions/install_tracker_unittest.cc b/chrome/browser/extensions/install_tracker_unittest.cc
index 84572cd..add6869 100644
--- a/chrome/browser/extensions/install_tracker_unittest.cc
+++ b/chrome/browser/extensions/install_tracker_unittest.cc
@@ -65,8 +65,8 @@
}
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<TestingProfile> profile_;
- scoped_ptr<InstallTracker> tracker_;
+ std::unique_ptr<TestingProfile> profile_;
+ std::unique_ptr<InstallTracker> tracker_;
};
// Verifies that active installs are registered and deregistered correctly.
@@ -104,7 +104,7 @@
// Verify the constructor that registers the install.
ActiveInstallData install_data(kExtensionId1);
install_data.percent_downloaded = 6;
- scoped_ptr<ScopedActiveInstall> scoped_active_install(
+ std::unique_ptr<ScopedActiveInstall> scoped_active_install(
new ScopedActiveInstall(tracker(), install_data));
const ActiveInstallData* retrieved_data =
@@ -132,7 +132,7 @@
TEST_F(InstallTrackerTest, ScopedActiveInstallCancelled) {
ActiveInstallData install_data(kExtensionId1);
install_data.percent_downloaded = 87;
- scoped_ptr<ScopedActiveInstall> scoped_active_install(
+ std::unique_ptr<ScopedActiveInstall> scoped_active_install(
new ScopedActiveInstall(tracker(), install_data));
const ActiveInstallData* retrieved_data =
diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc
index cd527489..78d320c 100644
--- a/chrome/browser/extensions/install_verifier.cc
+++ b/chrome/browser/extensions/install_verifier.cc
@@ -234,7 +234,7 @@
const base::DictionaryValue* pref = prefs_->GetInstallSignature();
if (pref) {
- scoped_ptr<InstallSignature> signature_from_prefs =
+ std::unique_ptr<InstallSignature> signature_from_prefs =
InstallSignature::FromValue(*pref);
if (!signature_from_prefs.get()) {
LogInitResultHistogram(INIT_UNPARSEABLE_PREF);
@@ -452,7 +452,7 @@
ExtensionIdSet InstallVerifier::GetExtensionsToVerify() const {
ExtensionIdSet result;
- scoped_ptr<ExtensionSet> extensions =
+ std::unique_ptr<ExtensionSet> extensions =
ExtensionRegistry::Get(context_)->GenerateInstalledExtensionsSet();
for (ExtensionSet::const_iterator iter = extensions->begin();
iter != extensions->end();
@@ -593,7 +593,7 @@
DVLOG(1) << "SaveToPrefs - saving";
DCHECK(InstallSigner::VerifySignature(*signature_.get()));
- scoped_ptr<InstallSignature> rehydrated =
+ std::unique_ptr<InstallSignature> rehydrated =
InstallSignature::FromValue(pref);
DCHECK(InstallSigner::VerifySignature(*rehydrated.get()));
}
@@ -622,8 +622,7 @@
} // namespace
void InstallVerifier::SignatureCallback(
- scoped_ptr<InstallSignature> signature) {
-
+ std::unique_ptr<InstallSignature> signature) {
linked_ptr<PendingOperation> operation = operation_queue_.front();
operation_queue_.pop();
diff --git a/chrome/browser/extensions/install_verifier.h b/chrome/browser/extensions/install_verifier.h
index e92b5c9..b04e6705 100644
--- a/chrome/browser/extensions/install_verifier.h
+++ b/chrome/browser/extensions/install_verifier.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_
#define CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_
+#include <memory>
#include <queue>
#include <set>
#include <string>
@@ -12,7 +13,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/management_policy.h"
@@ -152,7 +152,7 @@
void SaveToPrefs();
// Called with the result of a signature request, or NULL on failure.
- void SignatureCallback(scoped_ptr<InstallSignature> signature);
+ void SignatureCallback(std::unique_ptr<InstallSignature> signature);
ExtensionPrefs* prefs_;
@@ -164,10 +164,10 @@
// This is the most up-to-date signature, read out of |prefs_| during
// initialization and updated anytime we get new id's added.
- scoped_ptr<InstallSignature> signature_;
+ std::unique_ptr<InstallSignature> signature_;
// The current InstallSigner, if we have a signature request running.
- scoped_ptr<InstallSigner> signer_;
+ std::unique_ptr<InstallSigner> signer_;
// A queue of operations to apply to the current set of allowed ids.
std::queue<linked_ptr<PendingOperation> > operation_queue_;
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index 9cd0447..93fdc59 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -243,7 +243,7 @@
base::TimeTicks start_time = base::TimeTicks::Now();
Profile* profile = extension_service_->profile();
- scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info(
+ std::unique_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info(
extension_prefs_->GetInstalledExtensionsInfo());
std::vector<int> reload_reason_counts(NUM_MANIFEST_RELOAD_REASONS, 0);
@@ -556,7 +556,7 @@
}
}
- scoped_ptr<ExtensionPrefs::ExtensionsInfo> uninstalled_extensions_info(
+ std::unique_ptr<ExtensionPrefs::ExtensionsInfo> uninstalled_extensions_info(
extension_prefs_->GetUninstalledExtensionsInfo());
for (size_t i = 0; i < uninstalled_extensions_info->size(); ++i) {
ExtensionInfo* info = uninstalled_extensions_info->at(i).get();
diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc
index 64fb2d92..b68b9b6 100644
--- a/chrome/browser/extensions/isolated_app_browsertest.cc
+++ b/chrome/browser/extensions/isolated_app_browsertest.cc
@@ -44,14 +44,14 @@
javascript_expression + ")";
}
-scoped_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest(
+std::unique_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest(
const net::EmbeddedTestServer* test_server,
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(request.relative_url, "/expect-and-set-cookie?",
base::CompareCase::SENSITIVE))
- return scoped_ptr<net::test_server::HttpResponse>();
+ return std::unique_ptr<net::test_server::HttpResponse>();
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_OK);
diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc
index bc7e3d9..a14bd040 100644
--- a/chrome/browser/extensions/lazy_background_page_apitest.cc
+++ b/chrome/browser/extensions/lazy_background_page_apitest.cc
@@ -82,8 +82,8 @@
Profile* profile_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
- scoped_ptr<LazyBackgroundObserver> original_complete_;
- scoped_ptr<LazyBackgroundObserver> incognito_complete_;
+ std::unique_ptr<LazyBackgroundObserver> original_complete_;
+ std::unique_ptr<LazyBackgroundObserver> incognito_complete_;
};
} // namespace
diff --git a/chrome/browser/extensions/location_bar_controller_unittest.cc b/chrome/browser/extensions/location_bar_controller_unittest.cc
index 01063d9..a2a9d7f 100644
--- a/chrome/browser/extensions/location_bar_controller_unittest.cc
+++ b/chrome/browser/extensions/location_bar_controller_unittest.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/location_bar_controller.h"
+
+#include <memory>
#include <string>
#include <utility>
#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
@@ -14,7 +16,6 @@
#include "chrome/browser/extensions/extension_action_manager.h"
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/location_bar_controller.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/sessions/session_tab_helper.h"
@@ -101,15 +102,15 @@
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
- scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
+ std::unique_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
// Since we also test that we show page actions for pending script requests,
// we need to enable that feature.
- scoped_ptr<FeatureSwitch::ScopedOverride> active_script_override_;
+ std::unique_ptr<FeatureSwitch::ScopedOverride> active_script_override_;
// This tests legacy page actions.
- scoped_ptr<FeatureSwitch::ScopedOverride> extension_action_override_;
+ std::unique_ptr<FeatureSwitch::ScopedOverride> extension_action_override_;
};
// Test that the location bar gets the proper current actions.
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 77a7b9c..dfbd8a50 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -89,11 +89,11 @@
return items;
}
-scoped_ptr<base::Value> MenuItemsToValue(const MenuItem::List& items) {
- scoped_ptr<base::ListValue> list(new base::ListValue());
+std::unique_ptr<base::Value> MenuItemsToValue(const MenuItem::List& items) {
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (size_t i = 0; i < items.size(); ++i)
list->Append(items[i]->ToValue().release());
- return scoped_ptr<base::Value>(list.release());
+ return std::unique_ptr<base::Value>(list.release());
}
bool GetStringList(const base::DictionaryValue& dict,
@@ -195,8 +195,8 @@
children_.push_back(item);
}
-scoped_ptr<base::DictionaryValue> MenuItem::ToValue() const {
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue);
+std::unique_ptr<base::DictionaryValue> MenuItem::ToValue() const {
+ std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue);
// Should only be called for extensions with event pages, which only have
// string IDs for items.
DCHECK_EQ(0, id_.uid);
@@ -252,8 +252,8 @@
if (!contexts.Populate(*contexts_value))
return NULL;
- scoped_ptr<MenuItem> result(new MenuItem(
- id, title, checked, enabled, type, contexts));
+ std::unique_ptr<MenuItem> result(
+ new MenuItem(id, title, checked, enabled, type, contexts));
std::vector<std::string> document_url_patterns;
if (!GetStringList(value, kDocumentURLPatternsKey, &document_url_patterns))
@@ -270,7 +270,7 @@
// parent_id is filled in from the value, but it might not be valid. It's left
// to be validated upon being added (via AddChildItem) to the menu manager.
- scoped_ptr<Id> parent_id(
+ std::unique_ptr<Id> parent_id(
new Id(incognito, MenuItem::ExtensionKey(extension_id)));
if (value.HasKey(kParentUIDKey)) {
if (!value.GetString(kParentUIDKey, &parent_id->string_uid))
@@ -636,7 +636,7 @@
if (item->type() == MenuItem::RADIO)
RadioItemSelected(item);
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* properties = new base::DictionaryValue();
SetIdKeyValue(properties, "menuItemId", item->id());
@@ -719,11 +719,11 @@
{
// Dispatch to menu item's .onclick handler (this is the legacy API, from
// before chrome.contextMenus.onClicked existed).
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(webview_guest ? events::WEB_VIEW_INTERNAL_CONTEXT_MENUS
: events::CONTEXT_MENUS,
webview_guest ? kOnWebviewContextMenus : kOnContextMenus,
- scoped_ptr<base::ListValue>(args->DeepCopy())));
+ std::unique_ptr<base::ListValue>(args->DeepCopy())));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
event_router->DispatchEventToExtension(item->extension_id(),
@@ -731,7 +731,7 @@
}
{
// Dispatch to .contextMenus.onClicked handler.
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
webview_guest ? events::CHROME_WEB_VIEW_INTERNAL_ON_CLICKED
: events::CONTEXT_MENUS_ON_CLICKED,
webview_guest ? api::chrome_web_view_internal::OnClicked::kEventName
@@ -826,7 +826,7 @@
}
void MenuManager::ReadFromStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
const Extension* extension = ExtensionRegistry::Get(browser_context_)
->enabled_extensions()
.GetByID(extension_id);
@@ -842,7 +842,7 @@
// they have not yet been validated. Separate them out here.
// Because of the order in which we store items in the prefs, parents will
// precede children, so we should already know about any parent items.
- scoped_ptr<MenuItem::Id> parent_id;
+ std::unique_ptr<MenuItem::Id> parent_id;
parent_id.swap(items[i]->parent_id_);
added = AddChildItem(*parent_id, items[i]);
} else {
diff --git a/chrome/browser/extensions/menu_manager.h b/chrome/browser/extensions/menu_manager.h
index 0e9bf8f..cc9f171 100644
--- a/chrome/browser/extensions/menu_manager.h
+++ b/chrome/browser/extensions/menu_manager.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
@@ -144,8 +144,8 @@
value_ |= context;
}
- scoped_ptr<base::Value> ToValue() const {
- return scoped_ptr<base::Value>(
+ std::unique_ptr<base::Value> ToValue() const {
+ return std::unique_ptr<base::Value>(
new base::FundamentalValue(static_cast<int>(value_)));
}
@@ -211,7 +211,7 @@
bool SetChecked(bool checked);
// Converts to Value for serialization to preferences.
- scoped_ptr<base::DictionaryValue> ToValue() const;
+ std::unique_ptr<base::DictionaryValue> ToValue() const;
// Returns a new MenuItem created from |value|, or NULL if there is
// an error. The caller takes ownership of the MenuItem.
@@ -262,7 +262,7 @@
// If this item is a child of another item, the unique id of its parent. If
// this is a top-level item with no parent, this will be NULL.
- scoped_ptr<Id> parent_id_;
+ std::unique_ptr<Id> parent_id_;
// Patterns for restricting what documents this item will appear for. This
// applies to the frame where the click took place.
@@ -369,7 +369,7 @@
// Reads menu items for the extension from the state storage. Any invalid
// items are ignored.
void ReadFromStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value);
+ std::unique_ptr<base::Value> value);
// Removes all "incognito" "split" mode context items.
void RemoveAllIncognitoContextItems();
diff --git a/chrome/browser/extensions/menu_manager_factory.cc b/chrome/browser/extensions/menu_manager_factory.cc
index ef06d7f..8a6d8ae 100644
--- a/chrome/browser/extensions/menu_manager_factory.cc
+++ b/chrome/browser/extensions/menu_manager_factory.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/menu_manager_factory.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/menu_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
@@ -26,9 +27,10 @@
}
// static
-scoped_ptr<KeyedService> MenuManagerFactory::BuildServiceInstanceForTesting(
+std::unique_ptr<KeyedService>
+MenuManagerFactory::BuildServiceInstanceForTesting(
content::BrowserContext* context) {
- return make_scoped_ptr(GetInstance()->BuildServiceInstanceFor(context));
+ return base::WrapUnique(GetInstance()->BuildServiceInstanceFor(context));
}
MenuManagerFactory::MenuManagerFactory()
diff --git a/chrome/browser/extensions/menu_manager_factory.h b/chrome/browser/extensions/menu_manager_factory.h
index df480db..526296f3 100644
--- a/chrome/browser/extensions/menu_manager_factory.h
+++ b/chrome/browser/extensions/menu_manager_factory.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_FACTORY_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
@@ -22,7 +23,7 @@
static MenuManagerFactory* GetInstance();
- static scoped_ptr<KeyedService> BuildServiceInstanceForTesting(
+ static std::unique_ptr<KeyedService> BuildServiceInstanceForTesting(
content::BrowserContext* context);
private:
diff --git a/chrome/browser/extensions/menu_manager_unittest.cc b/chrome/browser/extensions/menu_manager_unittest.cc
index e22aeb6..daac058 100644
--- a/chrome/browser/extensions/menu_manager_unittest.cc
+++ b/chrome/browser/extensions/menu_manager_unittest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/menu_manager.h"
+
+#include <memory>
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_reader.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_system_factory.h"
-#include "chrome/browser/extensions/menu_manager.h"
#include "chrome/browser/extensions/test_extension_prefs.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/common/chrome_paths.h"
@@ -93,7 +95,7 @@
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
MenuManager manager_;
ExtensionList extensions_;
@@ -144,7 +146,7 @@
ASSERT_FALSE(manager_.RemoveContextMenuItem(id));
// Make sure adding an item with the same string ID returns false.
- scoped_ptr<MenuItem> item2too(CreateTestItemWithID(extension, "id2"));
+ std::unique_ptr<MenuItem> item2too(CreateTestItemWithID(extension, "id2"));
ASSERT_FALSE(manager_.AddContextItem(extension, item2too.get()));
// But the same string ID should not collide with another extension.
@@ -166,7 +168,7 @@
// This third item we expect to fail inserting, so we use a scoped_ptr to make
// sure it gets deleted.
- scoped_ptr<MenuItem> item3(CreateTestItem(extension3));
+ std::unique_ptr<MenuItem> item3(CreateTestItem(extension3));
// Add in the first two items.
ASSERT_TRUE(manager_.AddContextItem(extension1, item1));
@@ -246,7 +248,8 @@
value.Set("target_url_patterns", target_url_patterns);
std::string error;
- scoped_ptr<MenuItem> item(MenuItem::Populate(extension->id(), value, &error));
+ std::unique_ptr<MenuItem> item(
+ MenuItem::Populate(extension->id(), value, &error));
ASSERT_TRUE(item.get());
EXPECT_EQ(extension->id(), item->extension_id());
@@ -469,7 +472,7 @@
EventRouter::UserGestureState state));
virtual void DispatchEventToExtension(const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DispatchEventToExtensionMock(extension_id,
event->event_name,
event->event_args.release(),
@@ -483,9 +486,9 @@
};
// MockEventRouter factory function
-scoped_ptr<KeyedService> MockEventRouterFactoryFunction(
+std::unique_ptr<KeyedService> MockEventRouterFactoryFunction(
content::BrowserContext* context) {
- return make_scoped_ptr(new MockEventRouter(static_cast<Profile*>(context)));
+ return base::WrapUnique(new MockEventRouter(static_cast<Profile*>(context)));
}
} // namespace
diff --git a/chrome/browser/extensions/navigation_observer.cc b/chrome/browser/extensions/navigation_observer.cc
index f865ece..84856799 100644
--- a/chrome/browser/extensions/navigation_observer.cc
+++ b/chrome/browser/extensions/navigation_observer.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/navigation_observer.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/navigation_controller.h"
@@ -86,7 +87,7 @@
base::Bind(&NavigationObserver::OnInstallPromptDone,
weak_factory_.GetWeakPtr()),
extension, nullptr,
- make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)),
+ base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
}
}
diff --git a/chrome/browser/extensions/navigation_observer.h b/chrome/browser/extensions/navigation_observer.h
index fb2ca98..32b7b7b 100644
--- a/chrome/browser/extensions/navigation_observer.h
+++ b/chrome/browser/extensions/navigation_observer.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_
#define CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "content/public/browser/notification_observer.h"
@@ -54,7 +54,7 @@
Profile* profile_;
// The UI used to confirm enabling extensions.
- scoped_ptr<ExtensionInstallPrompt> extension_install_prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> extension_install_prompt_;
// The data we keep track of when prompting to enable extensions.
std::string in_progress_prompt_extension_id_;
diff --git a/chrome/browser/extensions/permission_message_combinations_unittest.cc b/chrome/browser/extensions/permission_message_combinations_unittest.cc
index f2b762a..4619b83 100644
--- a/chrome/browser/extensions/permission_message_combinations_unittest.cc
+++ b/chrome/browser/extensions/permission_message_combinations_unittest.cc
@@ -2,9 +2,10 @@
// 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/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/test/values_test_util.h"
#include "chrome/browser/extensions/test_extension_environment.h"
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
@@ -196,7 +197,7 @@
private:
extensions::TestExtensionEnvironment env_;
- scoped_ptr<ChromePermissionMessageProvider> message_provider_;
+ std::unique_ptr<ChromePermissionMessageProvider> message_provider_;
scoped_refptr<const Extension> app_;
// Whitelist a known extension id so we can test all permissions. This ID
// will be used for each test app.
diff --git a/chrome/browser/extensions/permission_messages_unittest.cc b/chrome/browser/extensions/permission_messages_unittest.cc
index 47d70347..68a212c 100644
--- a/chrome/browser/extensions/permission_messages_unittest.cc
+++ b/chrome/browser/extensions/permission_messages_unittest.cc
@@ -4,10 +4,10 @@
#include <stddef.h>
+#include <memory>
#include <utility>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/permissions_updater.h"
@@ -54,8 +54,8 @@
protected:
void CreateAndInstallExtensionWithPermissions(
- scoped_ptr<base::ListValue> required_permissions,
- scoped_ptr<base::ListValue> optional_permissions) {
+ std::unique_ptr<base::ListValue> required_permissions,
+ std::unique_ptr<base::ListValue> optional_permissions) {
app_ = test_util::BuildExtension(ExtensionBuilder())
.MergeManifest(
DictionaryBuilder()
@@ -72,11 +72,11 @@
// Returns the permission messages that would display in the prompt that
// requests all the optional permissions for the current |app_|.
std::vector<base::string16> GetOptionalPermissionMessages() {
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
env_.GetExtensionPrefs()->GetGrantedPermissions(app_->id());
const PermissionSet& optional_permissions =
PermissionsParser::GetOptionalPermissions(app_.get());
- scoped_ptr<const PermissionSet> requested_permissions =
+ std::unique_ptr<const PermissionSet> requested_permissions =
PermissionSet::CreateDifference(optional_permissions,
*granted_permissions);
return GetMessages(*requested_permissions);
@@ -113,7 +113,7 @@
}
extensions::TestExtensionEnvironment env_;
- scoped_ptr<ChromePermissionMessageProvider> message_provider_;
+ std::unique_ptr<ChromePermissionMessageProvider> message_provider_;
scoped_refptr<const Extension> app_;
DISALLOW_COPY_AND_ASSIGN(PermissionMessagesUnittest);
@@ -256,7 +256,7 @@
}
private:
- scoped_ptr<ChromePermissionMessageProvider> message_provider_;
+ std::unique_ptr<ChromePermissionMessageProvider> message_provider_;
};
TEST_F(USBDevicePermissionMessagesTest, SingleDevice) {
@@ -264,7 +264,7 @@
const char kMessage[] =
"Access any PVR Mass Storage from HUMAX Co., Ltd. via USB";
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> permission_list(new base::ListValue());
permission_list->Append(
UsbDevicePermissionData(0x02ad, 0x138c, -1).ToValue().release());
@@ -279,7 +279,7 @@
{
const char kMessage[] = "Access USB devices from HUMAX Co., Ltd.";
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> permission_list(new base::ListValue());
permission_list->Append(
UsbDevicePermissionData(0x02ad, 0x138d, -1).ToValue().release());
@@ -294,7 +294,7 @@
{
const char kMessage[] = "Access USB devices from an unknown vendor";
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> permission_list(new base::ListValue());
permission_list->Append(
UsbDevicePermissionData(0x02ae, 0x138d, -1).ToValue().release());
@@ -317,7 +317,7 @@
};
// Prepare data set
- scoped_ptr<base::ListValue> permission_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> permission_list(new base::ListValue());
permission_list->Append(
UsbDevicePermissionData(0x02ad, 0x138c, -1).ToValue().release());
// This device's product ID is not in Chrome's database.
diff --git a/chrome/browser/extensions/permissions_based_management_policy_provider_unittest.cc b/chrome/browser/extensions/permissions_based_management_policy_provider_unittest.cc
index 1adc8b5..0eac627d 100644
--- a/chrome/browser/extensions/permissions_based_management_policy_provider_unittest.cc
+++ b/chrome/browser/extensions/permissions_based_management_policy_provider_unittest.cc
@@ -2,18 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/permissions_based_management_policy_provider.h"
+
+#include <memory>
#include <string>
#include <vector>
#include "base/logging.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_management_test_util.h"
-#include "chrome/browser/extensions/permissions_based_management_policy_provider.h"
#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
@@ -83,8 +84,8 @@
protected:
std::vector<APIPermissionInfo*> perm_list_;
- scoped_ptr<TestingPrefServiceSimple> pref_service_;
- scoped_ptr<ExtensionManagement> settings_;
+ std::unique_ptr<TestingPrefServiceSimple> pref_service_;
+ std::unique_ptr<ExtensionManagement> settings_;
PermissionsBasedManagementPolicyProvider provider_;
};
diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc
index b191731..4370e32 100644
--- a/chrome/browser/extensions/permissions_updater.cc
+++ b/chrome/browser/extensions/permissions_updater.cc
@@ -36,7 +36,7 @@
// Returns a PermissionSet that has the active permissions of the extension,
// bounded to its current manifest.
-scoped_ptr<const PermissionSet> GetBoundedActivePermissions(
+std::unique_ptr<const PermissionSet> GetBoundedActivePermissions(
const Extension* extension,
const PermissionSet* active_permissions) {
// If the extension has used the optional permissions API, it will have a
@@ -52,13 +52,13 @@
// extension's manifest.
// a) active permissions must be a subset of optional + default permissions
// b) active permissions must contains all default permissions
- scoped_ptr<const PermissionSet> total_permissions =
+ std::unique_ptr<const PermissionSet> total_permissions =
PermissionSet::CreateUnion(
required_permissions,
PermissionsParser::GetOptionalPermissions(extension));
// Make sure the active permissions contain no more than optional + default.
- scoped_ptr<const PermissionSet> adjusted_active =
+ std::unique_ptr<const PermissionSet> adjusted_active =
PermissionSet::CreateIntersection(*total_permissions,
*active_permissions);
@@ -86,12 +86,12 @@
const PermissionSet& permissions) {
const PermissionSet& active =
extension->permissions_data()->active_permissions();
- scoped_ptr<const PermissionSet> total =
+ std::unique_ptr<const PermissionSet> total =
PermissionSet::CreateUnion(active, permissions);
- scoped_ptr<const PermissionSet> added =
+ std::unique_ptr<const PermissionSet> added =
PermissionSet::CreateDifference(*total, active);
- scoped_ptr<const PermissionSet> new_withheld =
+ std::unique_ptr<const PermissionSet> new_withheld =
PermissionSet::CreateDifference(
extension->permissions_data()->withheld_permissions(), permissions);
SetPermissions(extension, std::move(total), std::move(new_withheld));
@@ -110,17 +110,17 @@
const PermissionSet& active =
extension->permissions_data()->active_permissions();
- scoped_ptr<const PermissionSet> remaining =
+ std::unique_ptr<const PermissionSet> remaining =
PermissionSet::CreateDifference(active, to_remove);
// Move any granted permissions that were in the withheld set back to the
// withheld set so they can be added back later.
// Any revoked permission that isn't from the optional permissions can only
// be a withheld permission.
- scoped_ptr<const PermissionSet> removed_withheld =
+ std::unique_ptr<const PermissionSet> removed_withheld =
PermissionSet::CreateDifference(
to_remove, PermissionsParser::GetOptionalPermissions(extension));
- scoped_ptr<const PermissionSet> withheld = PermissionSet::CreateUnion(
+ std::unique_ptr<const PermissionSet> withheld = PermissionSet::CreateUnion(
*removed_withheld, extension->permissions_data()->withheld_permissions());
SetPermissions(extension, std::move(remaining), std::move(withheld));
@@ -141,25 +141,25 @@
const PermissionSet& to_remove) {
const PermissionSet& active =
extension->permissions_data()->active_permissions();
- scoped_ptr<const PermissionSet> total =
+ std::unique_ptr<const PermissionSet> total =
PermissionSet::CreateDifference(active, to_remove);
// |successfully_removed| might not equal |to_remove| if |to_remove| contains
// permissions the extension didn't have.
- scoped_ptr<const PermissionSet> successfully_removed =
+ std::unique_ptr<const PermissionSet> successfully_removed =
PermissionSet::CreateDifference(active, *total);
SetPermissions(extension, std::move(total), nullptr);
NotifyPermissionsUpdated(REMOVED, extension, *successfully_removed);
}
-scoped_ptr<const PermissionSet> PermissionsUpdater::GetRevokablePermissions(
- const Extension* extension) const {
+std::unique_ptr<const PermissionSet>
+PermissionsUpdater::GetRevokablePermissions(const Extension* extension) const {
// The user can revoke any permissions they granted. In other words, any
// permissions the extension didn't start with can be revoked.
const PermissionSet& required =
PermissionsParser::GetRequiredPermissions(extension);
- scoped_ptr<const PermissionSet> granted;
- scoped_ptr<const PermissionSet> withheld;
+ std::unique_ptr<const PermissionSet> granted;
+ std::unique_ptr<const PermissionSet> withheld;
ScriptingPermissionsModifier(browser_context_, make_scoped_refptr(extension))
.WithholdPermissions(required, &granted, &withheld, true);
return PermissionSet::CreateDifference(
@@ -175,14 +175,14 @@
}
void PermissionsUpdater::InitializePermissions(const Extension* extension) {
- scoped_ptr<const PermissionSet> bounded_wrapper;
+ std::unique_ptr<const PermissionSet> bounded_wrapper;
const PermissionSet* bounded_active = nullptr;
// If |extension| is a transient dummy extension, we do not want to look for
// it in preferences.
if (init_flag_ & INIT_FLAG_TRANSIENT) {
bounded_active = &extension->permissions_data()->active_permissions();
} else {
- scoped_ptr<const PermissionSet> active_permissions =
+ std::unique_ptr<const PermissionSet> active_permissions =
ExtensionPrefs::Get(browser_context_)
->GetActivePermissions(extension->id());
bounded_wrapper =
@@ -190,8 +190,8 @@
bounded_active = bounded_wrapper.get();
}
- scoped_ptr<const PermissionSet> granted_permissions;
- scoped_ptr<const PermissionSet> withheld_permissions;
+ std::unique_ptr<const PermissionSet> granted_permissions;
+ std::unique_ptr<const PermissionSet> withheld_permissions;
ScriptingPermissionsModifier(browser_context_, make_scoped_refptr(extension))
.WithholdPermissions(*bounded_active, &granted_permissions,
&withheld_permissions,
@@ -203,8 +203,8 @@
void PermissionsUpdater::SetPermissions(
const Extension* extension,
- scoped_ptr<const PermissionSet> active,
- scoped_ptr<const PermissionSet> withheld) {
+ std::unique_ptr<const PermissionSet> active,
+ std::unique_ptr<const PermissionSet> withheld) {
DCHECK(active);
const PermissionSet& active_weak = *active;
if (withheld) {
@@ -229,11 +229,11 @@
if (!event_router)
return;
- scoped_ptr<base::ListValue> value(new base::ListValue());
- scoped_ptr<api::permissions::Permissions> permissions =
+ std::unique_ptr<base::ListValue> value(new base::ListValue());
+ std::unique_ptr<api::permissions::Permissions> permissions =
PackPermissionSet(changed_permissions);
value->Append(permissions->ToValue().release());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(value)));
event->restrict_to_browser_context = browser_context_;
event_router->DispatchEventToExtension(extension_id, std::move(event));
diff --git a/chrome/browser/extensions/permissions_updater.h b/chrome/browser/extensions/permissions_updater.h
index fb5b563..2bb6f8f 100644
--- a/chrome/browser/extensions/permissions_updater.h
+++ b/chrome/browser/extensions/permissions_updater.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__
#define CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/extension_event_histogram_value.h"
namespace base {
@@ -70,7 +70,7 @@
const PermissionSet& permissions);
// Returns the set of revokable permissions.
- scoped_ptr<const PermissionSet> GetRevokablePermissions(
+ std::unique_ptr<const PermissionSet> GetRevokablePermissions(
const Extension* extension) const;
// Adds all permissions in the |extension|'s active permissions to its
@@ -93,8 +93,8 @@
// withheld permissions to |withheld|. Otherwise, |withheld| permissions are
// not changed.
void SetPermissions(const Extension* extension,
- scoped_ptr<const PermissionSet> active,
- scoped_ptr<const PermissionSet> withheld);
+ std::unique_ptr<const PermissionSet> active,
+ std::unique_ptr<const PermissionSet> withheld);
// Dispatches specified event to the extension.
void DispatchEvent(const std::string& extension_id,
diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc
index 5c6b46e..6a949957 100644
--- a/chrome/browser/extensions/permissions_updater_unittest.cc
+++ b/chrome/browser/extensions/permissions_updater_unittest.cc
@@ -8,6 +8,7 @@
#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -39,8 +40,8 @@
namespace {
scoped_refptr<const Extension> CreateExtensionWithOptionalPermissions(
- scoped_ptr<base::Value> optional_permissions,
- scoped_ptr<base::Value> permissions,
+ std::unique_ptr<base::Value> optional_permissions,
+ std::unique_ptr<base::Value> permissions,
const std::string& name) {
return ExtensionBuilder()
.SetLocation(Manifest::INTERNAL)
@@ -110,7 +111,7 @@
bool waiting_;
content::NotificationRegistrar registrar_;
scoped_refptr<const Extension> extension_;
- scoped_ptr<const PermissionSet> permissions_;
+ std::unique_ptr<const PermissionSet> permissions_;
UpdatedExtensionPermissionsInfo::Reason reason_;
};
@@ -159,8 +160,8 @@
extension->permissions_data()->active_permissions());
ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get());
- scoped_ptr<const PermissionSet> active_permissions;
- scoped_ptr<const PermissionSet> granted_permissions;
+ std::unique_ptr<const PermissionSet> active_permissions;
+ std::unique_ptr<const PermissionSet> granted_permissions;
// Add a few permissions.
APIPermissionSet apis;
@@ -239,15 +240,15 @@
auto api_permission_set = [](APIPermission::ID id) {
APIPermissionSet apis;
apis.insert(id);
- return make_scoped_ptr(new PermissionSet(apis, ManifestPermissionSet(),
- URLPatternSet(), URLPatternSet()));
+ return base::WrapUnique(new PermissionSet(
+ apis, ManifestPermissionSet(), URLPatternSet(), URLPatternSet()));
};
auto url_permission_set = [](const GURL& url) {
URLPatternSet set;
URLPattern pattern(URLPattern::SCHEME_ALL, url.spec());
set.AddPattern(pattern);
- return make_scoped_ptr(new PermissionSet(
+ return base::WrapUnique(new PermissionSet(
APIPermissionSet(), ManifestPermissionSet(), set, URLPatternSet()));
};
@@ -273,7 +274,7 @@
// its granted permissions (stored in prefs). And, the permission should
// be revokable.
EXPECT_TRUE(permissions->HasAPIPermission(APIPermission::kCookie));
- scoped_ptr<const PermissionSet> granted_permissions =
+ std::unique_ptr<const PermissionSet> granted_permissions =
prefs->GetGrantedPermissions(extension->id());
EXPECT_TRUE(granted_permissions->HasAPIPermission(APIPermission::kCookie));
EXPECT_TRUE(updater.GetRevokablePermissions(extension.get())
diff --git a/chrome/browser/extensions/policy_handlers.cc b/chrome/browser/extensions/policy_handlers.cc
index 49f6547..185bdd8a 100644
--- a/chrome/browser/extensions/policy_handlers.cc
+++ b/chrome/browser/extensions/policy_handlers.cc
@@ -43,7 +43,7 @@
void ExtensionListPolicyHandler::ApplyPolicySettings(
const policy::PolicyMap& policies,
PrefValueMap* prefs) {
- scoped_ptr<base::ListValue> list;
+ std::unique_ptr<base::ListValue> list;
policy::PolicyErrorMap errors;
if (CheckAndGetList(policies, &errors, &list) && list)
prefs->SetValue(pref_path(), std::move(list));
@@ -56,7 +56,7 @@
bool ExtensionListPolicyHandler::CheckAndGetList(
const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors,
- scoped_ptr<base::ListValue>* extension_ids) {
+ std::unique_ptr<base::ListValue>* extension_ids) {
if (extension_ids)
extension_ids->reset();
@@ -74,7 +74,7 @@
}
// Filter the list, rejecting any invalid extension IDs.
- scoped_ptr<base::ListValue> filtered_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> filtered_list(new base::ListValue());
for (base::ListValue::const_iterator entry(list_value->begin());
entry != list_value->end(); ++entry) {
std::string id;
@@ -121,7 +121,7 @@
const policy::PolicyMap& policies,
PrefValueMap* prefs) {
const base::Value* value = NULL;
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
if (CheckAndGetValue(policies, NULL, &value) &&
value &&
ParseList(value, dict.get(), NULL)) {
@@ -266,7 +266,7 @@
bool ExtensionSettingsPolicyHandler::CheckPolicySettings(
const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors) {
- scoped_ptr<base::Value> policy_value;
+ std::unique_ptr<base::Value> policy_value;
if (!CheckAndGetValue(policies, errors, &policy_value))
return false;
if (!policy_value)
@@ -320,7 +320,7 @@
void ExtensionSettingsPolicyHandler::ApplyPolicySettings(
const policy::PolicyMap& policies,
PrefValueMap* prefs) {
- scoped_ptr<base::Value> policy_value;
+ std::unique_ptr<base::Value> policy_value;
if (!CheckAndGetValue(policies, NULL, &policy_value) || !policy_value)
return;
prefs->SetValue(pref_names::kExtensionManagement, std::move(policy_value));
diff --git a/chrome/browser/extensions/policy_handlers.h b/chrome/browser/extensions/policy_handlers.h
index 5dd688b..cd7e5d99 100644
--- a/chrome/browser/extensions/policy_handlers.h
+++ b/chrome/browser/extensions/policy_handlers.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_
#define CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/policy/core/browser/configuration_policy_handler.h"
@@ -39,7 +40,7 @@
// Runs sanity checks on the policy value and returns it in |extension_ids|.
bool CheckAndGetList(const policy::PolicyMap& policies,
policy::PolicyErrorMap* errors,
- scoped_ptr<base::ListValue>* extension_ids);
+ std::unique_ptr<base::ListValue>* extension_ids);
private:
const char* pref_path_;
diff --git a/chrome/browser/extensions/policy_handlers_unittest.cc b/chrome/browser/extensions/policy_handlers_unittest.cc
index 03228ed..a3d9e00 100644
--- a/chrome/browser/extensions/policy_handlers_unittest.cc
+++ b/chrome/browser/extensions/policy_handlers_unittest.cc
@@ -321,9 +321,10 @@
TEST(ExtensionSettingsPolicyHandlerTest, CheckPolicySettings) {
std::string error;
- scoped_ptr<base::Value> policy_value = base::JSONReader::ReadAndReturnError(
- kTestManagementPolicy1,
- base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, NULL, &error);
+ std::unique_ptr<base::Value> policy_value =
+ base::JSONReader::ReadAndReturnError(
+ kTestManagementPolicy1,
+ base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, NULL, &error);
ASSERT_TRUE(policy_value.get()) << error;
policy::Schema chrome_schema =
@@ -345,9 +346,10 @@
TEST(ExtensionSettingsPolicyHandlerTest, ApplyPolicySettings) {
std::string error;
- scoped_ptr<base::Value> policy_value = base::JSONReader::ReadAndReturnError(
- kTestManagementPolicy2,
- base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, NULL, &error);
+ std::unique_ptr<base::Value> policy_value =
+ base::JSONReader::ReadAndReturnError(
+ kTestManagementPolicy2,
+ base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, NULL, &error);
ASSERT_TRUE(policy_value.get()) << error;
policy::Schema chrome_schema =
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc
index 3bddd9f..2a49f87 100644
--- a/chrome/browser/extensions/process_manager_browsertest.cc
+++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/process_manager.h"
-
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/browser/extensions/browser_action_test_util.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -25,6 +24,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
+#include "extensions/browser/process_manager.h"
#include "extensions/common/value_builder.h"
#include "extensions/test/background_page_watcher.h"
#include "net/dns/mock_host_resolver.h"
@@ -96,7 +96,7 @@
// page.
const Extension* CreateExtension(const std::string& name,
bool has_background_process) {
- scoped_ptr<TestExtensionDir> dir(new TestExtensionDir());
+ std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir());
DictionaryBuilder manifest;
manifest.Set("name", name)
@@ -165,7 +165,7 @@
}
private:
- std::vector<scoped_ptr<TestExtensionDir>> temp_dirs_;
+ std::vector<std::unique_ptr<TestExtensionDir>> temp_dirs_;
};
// Test that basic extension loading creates the appropriate ExtensionHosts
diff --git a/chrome/browser/extensions/requirements_checker_browsertest.cc b/chrome/browser/extensions/requirements_checker_browsertest.cc
index e3dc361..12b8491f 100644
--- a/chrome/browser/extensions/requirements_checker_browsertest.cc
+++ b/chrome/browser/extensions/requirements_checker_browsertest.cc
@@ -76,7 +76,7 @@
}
protected:
- scoped_ptr<RequirementsChecker> checker_;
+ std::unique_ptr<RequirementsChecker> checker_;
};
IN_PROC_BROWSER_TEST_F(RequirementsCheckerBrowserTest, CheckEmptyExtension) {
diff --git a/chrome/browser/extensions/scripting_permissions_modifier.cc b/chrome/browser/extensions/scripting_permissions_modifier.cc
index 71e3c82b..b52a0366 100644
--- a/chrome/browser/extensions/scripting_permissions_modifier.cc
+++ b/chrome/browser/extensions/scripting_permissions_modifier.cc
@@ -87,8 +87,8 @@
.effective_hosts()
.MatchesURL(origin))
return false;
- scoped_ptr<const PermissionSet> granted_permissions;
- scoped_ptr<const PermissionSet> withheld_permissions;
+ std::unique_ptr<const PermissionSet> granted_permissions;
+ std::unique_ptr<const PermissionSet> withheld_permissions;
WithholdPermissions(required_permissions, &granted_permissions,
&withheld_permissions, true);
if (!granted_permissions->effective_hosts().MatchesURL(origin) &&
@@ -122,8 +122,8 @@
void ScriptingPermissionsModifier::WithholdPermissions(
const PermissionSet& permissions,
- scoped_ptr<const PermissionSet>* granted_permissions_out,
- scoped_ptr<const PermissionSet>* withheld_permissions_out,
+ std::unique_ptr<const PermissionSet>* granted_permissions_out,
+ std::unique_ptr<const PermissionSet>* withheld_permissions_out,
bool use_initial_state) const {
bool should_withhold = false;
if (CanAffectExtension(permissions)) {
diff --git a/chrome/browser/extensions/scripting_permissions_modifier.h b/chrome/browser/extensions/scripting_permissions_modifier.h
index 1b4a5680..5cc5b1f 100644
--- a/chrome/browser/extensions/scripting_permissions_modifier.h
+++ b/chrome/browser/extensions/scripting_permissions_modifier.h
@@ -5,9 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_
#define CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
class GURL;
@@ -57,8 +58,8 @@
// was just installed, not taking into account extra granted preferences.
void WithholdPermissions(
const PermissionSet& permissions,
- scoped_ptr<const PermissionSet>* granted_permissions_out,
- scoped_ptr<const PermissionSet>* withheld_permissions_out,
+ std::unique_ptr<const PermissionSet>* granted_permissions_out,
+ std::unique_ptr<const PermissionSet>* withheld_permissions_out,
bool use_initial_state) const;
// Grants any withheld all-hosts (or all-hosts-like) permissions.
diff --git a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc
index 7ef41e8..da59c428c 100644
--- a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc
+++ b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc
@@ -92,7 +92,7 @@
InitializeEmptyExtensionService();
// Permissions are only withheld with the appropriate switch turned on.
- scoped_ptr<FeatureSwitch::ScopedOverride> switch_override(
+ std::unique_ptr<FeatureSwitch::ScopedOverride> switch_override(
new FeatureSwitch::ScopedOverride(FeatureSwitch::scripts_require_action(),
FeatureSwitch::OVERRIDE_ENABLED));
@@ -242,7 +242,7 @@
EXPECT_TRUE(util::AllowedScriptingOnAllUrls(extension_a->id(), profile()));
// Enable the switch, and re-init permission for the extension.
- scoped_ptr<FeatureSwitch::ScopedOverride> switch_override(
+ std::unique_ptr<FeatureSwitch::ScopedOverride> switch_override(
new FeatureSwitch::ScopedOverride(FeatureSwitch::scripts_require_action(),
FeatureSwitch::OVERRIDE_ENABLED));
updater.InitializePermissions(extension_a.get());
@@ -289,7 +289,7 @@
InitializeEmptyExtensionService();
// Permissions are only withheld with the appropriate switch turned on.
- scoped_ptr<FeatureSwitch::ScopedOverride> switch_override(
+ std::unique_ptr<FeatureSwitch::ScopedOverride> switch_override(
new FeatureSwitch::ScopedOverride(FeatureSwitch::scripts_require_action(),
FeatureSwitch::OVERRIDE_ENABLED));
diff --git a/chrome/browser/extensions/shared_module_service.cc b/chrome/browser/extensions/shared_module_service.cc
index 92cb08d..d3a8cdf6 100644
--- a/chrome/browser/extensions/shared_module_service.cc
+++ b/chrome/browser/extensions/shared_module_service.cc
@@ -108,9 +108,9 @@
return status;
}
-scoped_ptr<ExtensionSet> SharedModuleService::GetDependentExtensions(
+std::unique_ptr<ExtensionSet> SharedModuleService::GetDependentExtensions(
const Extension* extension) {
- scoped_ptr<ExtensionSet> dependents(new ExtensionSet());
+ std::unique_ptr<ExtensionSet> dependents(new ExtensionSet());
if (SharedModuleInfo::IsSharedModule(extension)) {
ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_);
diff --git a/chrome/browser/extensions/shared_module_service.h b/chrome/browser/extensions/shared_module_service.h
index f870f82f..13605ae 100644
--- a/chrome/browser/extensions/shared_module_service.h
+++ b/chrome/browser/extensions/shared_module_service.h
@@ -53,7 +53,8 @@
ImportStatus SatisfyImports(const Extension* extension);
// Returns a set of extensions that import a given extension.
- scoped_ptr<ExtensionSet> GetDependentExtensions(const Extension* extension);
+ std::unique_ptr<ExtensionSet> GetDependentExtensions(
+ const Extension* extension);
private:
// Uninstall shared modules which are not used by other extensions.
diff --git a/chrome/browser/extensions/shared_module_service_unittest.cc b/chrome/browser/extensions/shared_module_service_unittest.cc
index 40d2c42..e53cc40 100644
--- a/chrome/browser/extensions/shared_module_service_unittest.cc
+++ b/chrome/browser/extensions/shared_module_service_unittest.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/extensions/shared_module_service.h"
+#include <memory>
#include <utility>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -51,7 +51,7 @@
}
scoped_refptr<Extension> CreateSharedModule(const std::string& module_id) {
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
DictionaryBuilder()
.Set("name", "Shared Module")
.Set("version", "1.0")
@@ -177,7 +177,7 @@
CreateSharedModule("shared_module_1");
EXPECT_TRUE(InstallExtension(shared_module_1.get(), false));
- scoped_ptr<base::DictionaryValue> manifest_2 =
+ std::unique_ptr<base::DictionaryValue> manifest_2 =
DictionaryBuilder()
.Set("name", "Shared Module 2")
.Set("version", "1.0")
@@ -236,7 +236,7 @@
std::string nonwhitelisted_id =
crx_file::id_util::GenerateId("nonwhitelisted");
// Create a module which exports to a restricted whitelist.
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
DictionaryBuilder()
.Set("name", "Shared Module")
.Set("version", "1.0")
diff --git a/chrome/browser/extensions/standard_management_policy_provider_unittest.cc b/chrome/browser/extensions/standard_management_policy_provider_unittest.cc
index f6ab019..e1b2f540 100644
--- a/chrome/browser/extensions/standard_management_policy_provider_unittest.cc
+++ b/chrome/browser/extensions/standard_management_policy_provider_unittest.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/standard_management_policy_provider.h"
+
+#include <memory>
+
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/blacklist.h"
#include "chrome/browser/extensions/extension_management.h"
-#include "chrome/browser/extensions/standard_management_policy_provider.h"
#include "chrome/browser/extensions/test_extension_prefs.h"
#include "content/public/test/test_browser_thread.h"
#include "extensions/browser/extension_prefs.h"
@@ -48,7 +50,7 @@
content::TestBrowserThread file_thread_;
TestExtensionPrefs prefs_;
- scoped_ptr<ExtensionManagement> settings_;
+ std::unique_ptr<ExtensionManagement> settings_;
StandardManagementPolicyProvider provider_;
};
diff --git a/chrome/browser/extensions/sync_bundle.cc b/chrome/browser/extensions/sync_bundle.cc
index dd79337..0a35419 100644
--- a/chrome/browser/extensions/sync_bundle.cc
+++ b/chrome/browser/extensions/sync_bundle.cc
@@ -17,7 +17,7 @@
SyncBundle::~SyncBundle() {}
void SyncBundle::StartSyncing(
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor) {
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor) {
sync_processor_.reset(sync_processor.release());
}
diff --git a/chrome/browser/extensions/sync_bundle.h b/chrome/browser/extensions/sync_bundle.h
index d8229bf..22c907a 100644
--- a/chrome/browser/extensions/sync_bundle.h
+++ b/chrome/browser/extensions/sync_bundle.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_SYNC_BUNDLE_H_
#define CHROME_BROWSER_EXTENSIONS_SYNC_BUNDLE_H_
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "sync/api/sync_change.h"
#include "sync/api/sync_change_processor.h"
#include "sync/api/sync_data.h"
@@ -25,7 +25,8 @@
SyncBundle();
~SyncBundle();
- void StartSyncing(scoped_ptr<syncer::SyncChangeProcessor> sync_processor);
+ void StartSyncing(
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor);
// Resets this class back to its default values, which will disable all
// syncing until StartSyncing is called again.
@@ -78,7 +79,7 @@
void RemoveSyncedExtension(const std::string& id);
bool HasSyncedExtension(const std::string& id) const;
- scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
+ std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_;
// Stores the set of extensions we know about. Used to decide if a sync change
// should be ACTION_ADD or ACTION_UPDATE.
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h
index 45de7cf..17846b5c 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_
#define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_
+#include <memory>
#include <set>
#include <string>
#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 "chrome/browser/extensions/active_tab_permission_granter.h"
@@ -242,21 +242,22 @@
content::NotificationRegistrar registrar_;
- scoped_ptr<ScriptExecutor> script_executor_;
+ std::unique_ptr<ScriptExecutor> script_executor_;
- scoped_ptr<LocationBarController> location_bar_controller_;
+ std::unique_ptr<LocationBarController> location_bar_controller_;
- scoped_ptr<ExtensionActionRunner> extension_action_runner_;
+ std::unique_ptr<ExtensionActionRunner> extension_action_runner_;
- scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_;
+ std::unique_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_;
- scoped_ptr<BookmarkAppHelper> bookmark_app_helper_;
+ std::unique_ptr<BookmarkAppHelper> bookmark_app_helper_;
// Creates WebstoreInlineInstaller instances for inline install triggers.
- scoped_ptr<WebstoreInlineInstallerFactory> webstore_inline_installer_factory_;
+ std::unique_ptr<WebstoreInlineInstallerFactory>
+ webstore_inline_installer_factory_;
// The reenable prompt for disabled extensions, if any.
- scoped_ptr<ExtensionReenabler> extension_reenabler_;
+ std::unique_ptr<ExtensionReenabler> extension_reenabler_;
// Vend weak pointers that can be invalidated to stop in-progress loads.
base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_;
diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc
index 37f5628..4376497 100644
--- a/chrome/browser/extensions/test_extension_environment.cc
+++ b/chrome/browser/extensions/test_extension_environment.cc
@@ -37,13 +37,14 @@
namespace {
-scoped_ptr<base::DictionaryValue> MakeExtensionManifest(
+std::unique_ptr<base::DictionaryValue> MakeExtensionManifest(
const base::Value& manifest_extra) {
- scoped_ptr<base::DictionaryValue> manifest = DictionaryBuilder()
- .Set("name", "Extension")
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Build();
+ std::unique_ptr<base::DictionaryValue> manifest =
+ DictionaryBuilder()
+ .Set("name", "Extension")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Build();
const base::DictionaryValue* manifest_extra_dict;
if (manifest_extra.GetAsDictionary(&manifest_extra_dict)) {
manifest->MergeDictionary(manifest_extra_dict);
@@ -55,7 +56,7 @@
return manifest;
}
-scoped_ptr<base::DictionaryValue> MakePackagedAppManifest() {
+std::unique_ptr<base::DictionaryValue> MakePackagedAppManifest() {
return extensions::DictionaryBuilder()
.Set("name", "Test App Name")
.Set("version", "2.0")
@@ -140,7 +141,7 @@
const Extension* TestExtensionEnvironment::MakeExtension(
const base::Value& manifest_extra) {
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
MakeExtensionManifest(manifest_extra);
scoped_refptr<Extension> result =
ExtensionBuilder().SetManifest(std::move(manifest)).Build();
@@ -151,7 +152,7 @@
const Extension* TestExtensionEnvironment::MakeExtension(
const base::Value& manifest_extra,
const std::string& id) {
- scoped_ptr<base::DictionaryValue> manifest =
+ std::unique_ptr<base::DictionaryValue> manifest =
MakeExtensionManifest(manifest_extra);
scoped_refptr<Extension> result =
ExtensionBuilder().SetManifest(std::move(manifest)).SetID(id).Build();
@@ -172,8 +173,9 @@
return result;
}
-scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const {
- scoped_ptr<content::WebContents> contents(
+std::unique_ptr<content::WebContents> TestExtensionEnvironment::MakeTab()
+ const {
+ std::unique_ptr<content::WebContents> contents(
content::WebContentsTester::CreateTestWebContents(profile(), NULL));
// Create a tab id.
SessionTabHelper::CreateForWebContents(contents.get());
diff --git a/chrome/browser/extensions/test_extension_environment.h b/chrome/browser/extensions/test_extension_environment.h
index 99aa7f7..889452bb 100644
--- a/chrome/browser/extensions/test_extension_environment.h
+++ b/chrome/browser/extensions/test_extension_environment.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_ENVIRONMENT_H_
#define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_ENVIRONMENT_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "build/build_config.h"
@@ -79,7 +80,7 @@
scoped_refptr<Extension> MakePackagedApp(const std::string& id, bool install);
// Returns a test web contents that has a tab id.
- scoped_ptr<content::WebContents> MakeTab() const;
+ std::unique_ptr<content::WebContents> MakeTab() const;
// Deletes the testing profile to test profile teardown.
void DeleteProfile();
@@ -89,13 +90,13 @@
void Init();
- scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
- scoped_ptr<ChromeOSEnv> chromeos_env_;
+ std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
+ std::unique_ptr<ChromeOSEnv> chromeos_env_;
#if defined(OS_WIN)
ui::ScopedOleInitializer ole_initializer_;
#endif
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ExtensionService* extension_service_;
DISALLOW_COPY_AND_ASSIGN(TestExtensionEnvironment);
diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc
index c1137e3..8409146 100644
--- a/chrome/browser/extensions/test_extension_prefs.cc
+++ b/chrome/browser/extensions/test_extension_prefs.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/extensions/test_extension_prefs.h"
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
@@ -123,16 +123,14 @@
factory.set_extension_prefs(
new ExtensionPrefStore(extension_pref_value_map_.get(), false));
pref_service_ = factory.CreateSyncable(pref_registry_.get());
- scoped_ptr<ExtensionPrefs> prefs(ExtensionPrefs::Create(
- &profile_,
- pref_service_.get(),
- temp_dir_.path(),
- extension_pref_value_map_.get(),
- extensions_disabled_,
+ std::unique_ptr<ExtensionPrefs> prefs(ExtensionPrefs::Create(
+ &profile_, pref_service_.get(), temp_dir_.path(),
+ extension_pref_value_map_.get(), extensions_disabled_,
std::vector<ExtensionPrefsObserver*>(),
// Guarantee that no two extensions get the same installation time
// stamp and we can reliably assert the installation order in the tests.
- scoped_ptr<ExtensionPrefs::TimeProvider>(new IncrementalTimeProvider())));
+ std::unique_ptr<ExtensionPrefs::TimeProvider>(
+ new IncrementalTimeProvider())));
ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting(&profile_,
std::move(prefs));
// Hack: After recreating ExtensionPrefs, the AppSorting also needs to be
diff --git a/chrome/browser/extensions/test_extension_prefs.h b/chrome/browser/extensions/test_extension_prefs.h
index 886a64c..665baa5 100644
--- a/chrome/browser/extensions/test_extension_prefs.h
+++ b/chrome/browser/extensions/test_extension_prefs.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
#define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
+#include <memory>
#include <string>
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/test/base/testing_profile.h"
#include "extensions/common/manifest.h"
@@ -98,8 +98,8 @@
base::FilePath preferences_file_;
base::FilePath extensions_dir_;
scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_;
- scoped_ptr<syncable_prefs::PrefServiceSyncable> pref_service_;
- scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
+ std::unique_ptr<syncable_prefs::PrefServiceSyncable> pref_service_;
+ std::unique_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
const scoped_refptr<base::SequencedTaskRunner> task_runner_;
private:
diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc
index f1165963..b1049e7a 100644
--- a/chrome/browser/extensions/test_extension_system.cc
+++ b/chrome/browser/extensions/test_extension_system.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/blacklist.h"
#include "chrome/browser/extensions/chrome_app_sorting.h"
#include "chrome/browser/extensions/extension_management.h"
@@ -124,7 +125,7 @@
return NULL;
}
-scoped_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions(
+std::unique_ptr<ExtensionSet> TestExtensionSystem::GetDependentExtensions(
const Extension* extension) {
return extension_service()->shared_module_service()->GetDependentExtensions(
extension);
@@ -142,9 +143,9 @@
}
// static
-scoped_ptr<KeyedService> TestExtensionSystem::Build(
+std::unique_ptr<KeyedService> TestExtensionSystem::Build(
content::BrowserContext* profile) {
- return make_scoped_ptr(
+ return base::WrapUnique(
new TestExtensionSystem(static_cast<Profile*>(profile)));
}
diff --git a/chrome/browser/extensions/test_extension_system.h b/chrome/browser/extensions/test_extension_system.h
index 1306507..7f67470 100644
--- a/chrome/browser/extensions/test_extension_system.h
+++ b/chrome/browser/extensions/test_extension_system.h
@@ -5,7 +5,8 @@
#ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
#define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "extensions/browser/extension_system.h"
#include "extensions/common/one_shot_event.h"
@@ -59,7 +60,7 @@
AppSorting* app_sorting() override;
const OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override;
- scoped_ptr<ExtensionSet> GetDependentExtensions(
+ std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
void InstallUpdate(const std::string& extension_id,
const base::FilePath& temp_dir) override;
@@ -69,7 +70,7 @@
void SetReady() { ready_.Signal(); }
// Factory method for tests to use with SetTestingProfile.
- static scoped_ptr<KeyedService> Build(content::BrowserContext* profile);
+ static std::unique_ptr<KeyedService> Build(content::BrowserContext* profile);
// Used by ExtensionPrefsTest to re-create the AppSorting after it has
// re-created the ExtensionPrefs instance (this can never happen in non-test
@@ -80,14 +81,14 @@
Profile* profile_;
private:
- scoped_ptr<StateStore> state_store_;
+ std::unique_ptr<StateStore> state_store_;
scoped_refptr<TestValueStoreFactory> store_factory_;
- scoped_ptr<ManagementPolicy> management_policy_;
- scoped_ptr<RuntimeData> runtime_data_;
- scoped_ptr<ExtensionService> extension_service_;
+ std::unique_ptr<ManagementPolicy> management_policy_;
+ std::unique_ptr<RuntimeData> runtime_data_;
+ std::unique_ptr<ExtensionService> extension_service_;
scoped_refptr<InfoMap> info_map_;
- scoped_ptr<QuotaService> quota_service_;
- scoped_ptr<AppSorting> app_sorting_;
+ std::unique_ptr<QuotaService> quota_service_;
+ std::unique_ptr<AppSorting> app_sorting_;
OneShotEvent ready_;
};
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
index 764789b..d319274 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
@@ -51,9 +51,10 @@
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile);
- scoped_ptr<infobars::InfoBar> new_infobar(
+ std::unique_ptr<infobars::InfoBar> new_infobar(
infobar_service->CreateConfirmInfoBar(
- scoped_ptr<ConfirmInfoBarDelegate>(new ThemeInstalledInfoBarDelegate(
+ std::unique_ptr<
+ ConfirmInfoBarDelegate>(new ThemeInstalledInfoBarDelegate(
extensions::ExtensionSystem::Get(profile)->extension_service(),
theme_service, new_theme, previous_theme_id,
previous_using_system_theme))));
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index bc28a4d..f812a2f 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -59,7 +59,7 @@
void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
- scoped_ptr<ExtensionInstallPrompt> install_ui_;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui_;
scoped_refptr<const Extension> extension_;
base::Closure callback_;
@@ -71,7 +71,7 @@
Profile* profile,
const base::Closure& callback)
: extension_(extension), callback_(callback) {
- scoped_ptr<extensions::ExtensionInstallUI> ui(
+ std::unique_ptr<extensions::ExtensionInstallUI> ui(
extensions::CreateExtensionInstallUI(profile));
install_ui_.reset(new ExtensionInstallPrompt(
profile, ui->GetDefaultInstallDialogParent()));
diff --git a/chrome/browser/extensions/unpacked_installer.h b/chrome/browser/extensions/unpacked_installer.h
index 41bbebd..2bdc85e 100644
--- a/chrome/browser/extensions/unpacked_installer.h
+++ b/chrome/browser/extensions/unpacked_installer.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
#define CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
+#include <memory>
#include <string>
#include <vector>
@@ -12,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/extension_install_checker.h"
diff --git a/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc b/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc
index 667a1901..2a63357 100644
--- a/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc
+++ b/chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc
@@ -29,11 +29,11 @@
const char kTestRequestParam[] = "extension-updater-test-request";
} // namespace
-scoped_ptr<ExtensionDownloader>
+std::unique_ptr<ExtensionDownloader>
ChromeExtensionDownloaderFactory::CreateForRequestContext(
net::URLRequestContextGetter* request_context,
ExtensionDownloaderDelegate* delegate) {
- scoped_ptr<ExtensionDownloader> downloader(
+ std::unique_ptr<ExtensionDownloader> downloader(
new ExtensionDownloader(delegate, request_context));
#if defined(GOOGLE_CHROME_BUILD)
std::string brand;
@@ -55,15 +55,16 @@
return downloader;
}
-scoped_ptr<ExtensionDownloader>
+std::unique_ptr<ExtensionDownloader>
ChromeExtensionDownloaderFactory::CreateForProfile(
Profile* profile,
ExtensionDownloaderDelegate* delegate) {
- scoped_ptr<IdentityProvider> identity_provider(new ProfileIdentityProvider(
- SigninManagerFactory::GetForProfile(profile),
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
- LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile)));
- scoped_ptr<ExtensionDownloader> downloader =
+ std::unique_ptr<IdentityProvider> identity_provider(
+ new ProfileIdentityProvider(
+ SigninManagerFactory::GetForProfile(profile),
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
+ LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile)));
+ std::unique_ptr<ExtensionDownloader> downloader =
CreateForRequestContext(profile->GetRequestContext(), delegate);
downloader->SetWebstoreIdentityProvider(std::move(identity_provider));
return downloader;
diff --git a/chrome/browser/extensions/updater/chrome_extension_downloader_factory.h b/chrome/browser/extensions/updater/chrome_extension_downloader_factory.h
index b4ab072..2f3a787a 100644
--- a/chrome/browser/extensions/updater/chrome_extension_downloader_factory.h
+++ b/chrome/browser/extensions/updater/chrome_extension_downloader_factory.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_CHROME_EXTENSION_DOWNLOADER_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_UPDATER_CHROME_EXTENSION_DOWNLOADER_FACTORY_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
class Profile;
@@ -24,14 +24,14 @@
public:
// Creates a downloader with the given request context. No profile identity
// is associated with this downloader.
- static scoped_ptr<extensions::ExtensionDownloader> CreateForRequestContext(
- net::URLRequestContextGetter* request_context,
- extensions::ExtensionDownloaderDelegate* delegate);
+ static std::unique_ptr<extensions::ExtensionDownloader>
+ CreateForRequestContext(net::URLRequestContextGetter* request_context,
+ extensions::ExtensionDownloaderDelegate* delegate);
// Creates a downloader for a given Profile. This downloader will be able
// to authenticate as the signed-in user in the event that it's asked to
// fetch a protected download.
- static scoped_ptr<extensions::ExtensionDownloader> CreateForProfile(
+ static std::unique_ptr<extensions::ExtensionDownloader> CreateForProfile(
Profile* profile,
extensions::ExtensionDownloaderDelegate* delegate);
};
diff --git a/chrome/browser/extensions/updater/extension_cache_impl.cc b/chrome/browser/extensions/updater/extension_cache_impl.cc
index 3f00c43..acb8d19 100644
--- a/chrome/browser/extensions/updater/extension_cache_impl.cc
+++ b/chrome/browser/extensions/updater/extension_cache_impl.cc
@@ -27,7 +27,7 @@
namespace extensions {
ExtensionCacheImpl::ExtensionCacheImpl(
- scoped_ptr<ExtensionCacheDelegate> delegate)
+ std::unique_ptr<ExtensionCacheDelegate> delegate)
: cache_(new LocalExtensionCache(
delegate->GetCacheDir(),
delegate->GetMaximumCacheSize(),
diff --git a/chrome/browser/extensions/updater/extension_cache_impl.h b/chrome/browser/extensions/updater/extension_cache_impl.h
index e04245f..0033cd6 100644
--- a/chrome/browser/extensions/updater/extension_cache_impl.h
+++ b/chrome/browser/extensions/updater/extension_cache_impl.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_CACHE_IMPL_H_
#define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_CACHE_IMPL_H_
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -12,7 +13,6 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -32,7 +32,7 @@
class ExtensionCacheImpl : public ExtensionCache,
public content::NotificationObserver {
public:
- explicit ExtensionCacheImpl(scoped_ptr<ExtensionCacheDelegate> delegate);
+ explicit ExtensionCacheImpl(std::unique_ptr<ExtensionCacheDelegate> delegate);
~ExtensionCacheImpl() override;
// Implementation of ExtensionCache.
@@ -62,7 +62,7 @@
bool CachingAllowed(const std::string& id);
// Cache implementation that uses local cache dir.
- scoped_ptr<LocalExtensionCache> cache_;
+ std::unique_ptr<LocalExtensionCache> cache_;
// Set of extensions that can be cached.
std::set<std::string> allowed_extensions_;
diff --git a/chrome/browser/extensions/updater/extension_updater.h b/chrome/browser/extensions/updater/extension_updater.h
index dcf656e..d2568296 100644
--- a/chrome/browser/extensions/updater/extension_updater.h
+++ b/chrome/browser/extensions/updater/extension_updater.h
@@ -7,6 +7,7 @@
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <stack>
#include <string>
@@ -15,7 +16,6 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
@@ -240,7 +240,7 @@
const ExtensionDownloader::Factory downloader_factory_;
// Fetches the crx files for the extensions that have an available update.
- scoped_ptr<ExtensionDownloader> downloader_;
+ std::unique_ptr<ExtensionDownloader> downloader_;
base::OneShotTimer timer_;
int frequency_seconds_;
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc
index 86ee9cc1..b24e06e 100644
--- a/chrome/browser/extensions/updater/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -6,8 +6,10 @@
#include <stddef.h>
#include <stdint.h>
+
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <utility>
#include <vector>
@@ -17,7 +19,6 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -373,34 +374,34 @@
PendingExtensionManager pending_extension_manager_;
private:
- scoped_ptr<ExtensionDownloader> CreateExtensionDownloader(
+ std::unique_ptr<ExtensionDownloader> CreateExtensionDownloader(
ExtensionDownloaderDelegate* delegate) {
- scoped_ptr<ExtensionDownloader> downloader =
+ std::unique_ptr<ExtensionDownloader> downloader =
ChromeExtensionDownloaderFactory::CreateForRequestContext(
- request_context(),
- downloader_delegate_override_ ? downloader_delegate_override_
- : delegate);
+ request_context(), downloader_delegate_override_
+ ? downloader_delegate_override_
+ : delegate);
if (enable_metrics_)
downloader->set_enable_extra_update_metrics(true);
return downloader;
}
- scoped_ptr<ExtensionDownloader> CreateExtensionDownloaderWithIdentity(
+ std::unique_ptr<ExtensionDownloader> CreateExtensionDownloaderWithIdentity(
ExtensionDownloaderDelegate* delegate) {
- scoped_ptr<FakeIdentityProvider> fake_identity_provider;
+ std::unique_ptr<FakeIdentityProvider> fake_identity_provider;
fake_token_service_.reset(new FakeOAuth2TokenService());
fake_identity_provider.reset(new FakeIdentityProvider(
fake_token_service_.get()));
fake_identity_provider->LogIn(kFakeAccountId);
fake_token_service_->AddAccount(kFakeAccountId);
- scoped_ptr<ExtensionDownloader> downloader(
+ std::unique_ptr<ExtensionDownloader> downloader(
CreateExtensionDownloader(delegate));
downloader->SetWebstoreIdentityProvider(std::move(fake_identity_provider));
return downloader;
}
- scoped_ptr<FakeOAuth2TokenService> fake_token_service_;
+ std::unique_ptr<FakeOAuth2TokenService> fake_token_service_;
ExtensionDownloaderDelegate* downloader_delegate_override_;
@@ -694,7 +695,8 @@
void StartUpdateCheck(ExtensionDownloader* downloader,
ManifestFetchData* fetch_data) {
- downloader->StartUpdateCheck(scoped_ptr<ManifestFetchData>(fetch_data));
+ downloader->StartUpdateCheck(
+ std::unique_ptr<ManifestFetchData>(fetch_data));
}
size_t ManifestFetchersCount(ExtensionDownloader* downloader) {
@@ -766,7 +768,7 @@
// Make sure that an empty update URL data string does not cause a ap=
// option to appear in the x= parameter.
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(GURL("http://localhost/foo")));
fetch_data->AddExtension(id, version, &kNeverPingedData, std::string(),
std::string());
@@ -784,7 +786,7 @@
// Make sure that an update URL data string causes an appropriate ap=
// option to appear in the x= parameter.
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(GURL("http://localhost/foo")));
fetch_data->AddExtension(id, version, &kNeverPingedData, "bar",
std::string());
@@ -801,7 +803,7 @@
// Make sure that an update URL data string causes an appropriate ap=
// option to appear in the x= parameter.
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(GURL("http://localhost/foo")));
fetch_data->AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c",
std::string());
@@ -846,7 +848,7 @@
const std::string install_source = "instally";
// Make sure that an installsource= appears in the x= parameter.
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(GURL("http://localhost/foo")));
fetch_data->AddExtension(id, version, &kNeverPingedData,
kEmptyUpdateUrlData, install_source);
@@ -863,7 +865,7 @@
ExtensionDownloader downloader(&delegate, profile.GetRequestContext());
// Check passing an empty list of parse results to DetermineUpdates
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(GURL("http://localhost/foo")));
UpdateManifest::Results updates;
std::vector<int> updateable;
@@ -906,7 +908,7 @@
MockExtensionDownloaderDelegate delegate;
ExtensionDownloader downloader(&delegate, profile.GetRequestContext());
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(GURL("http://localhost/foo")));
UpdateManifest::Results updates;
@@ -946,10 +948,14 @@
GURL kUpdateUrl("http://localhost/manifest1");
- scoped_ptr<ManifestFetchData> fetch1(CreateManifestFetchData(kUpdateUrl));
- scoped_ptr<ManifestFetchData> fetch2(CreateManifestFetchData(kUpdateUrl));
- scoped_ptr<ManifestFetchData> fetch3(CreateManifestFetchData(kUpdateUrl));
- scoped_ptr<ManifestFetchData> fetch4(CreateManifestFetchData(kUpdateUrl));
+ std::unique_ptr<ManifestFetchData> fetch1(
+ CreateManifestFetchData(kUpdateUrl));
+ std::unique_ptr<ManifestFetchData> fetch2(
+ CreateManifestFetchData(kUpdateUrl));
+ std::unique_ptr<ManifestFetchData> fetch3(
+ CreateManifestFetchData(kUpdateUrl));
+ std::unique_ptr<ManifestFetchData> fetch4(
+ CreateManifestFetchData(kUpdateUrl));
ManifestFetchData::PingData zeroDays(0, 0, true, 0);
fetch1->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
std::string());
@@ -1086,7 +1092,8 @@
GURL kUpdateUrl("http://localhost/manifest1");
- scoped_ptr<ManifestFetchData> fetch(CreateManifestFetchData(kUpdateUrl));
+ std::unique_ptr<ManifestFetchData> fetch(
+ CreateManifestFetchData(kUpdateUrl));
ManifestFetchData::PingData zeroDays(0, 0, true, 0);
fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
std::string());
@@ -1152,7 +1159,7 @@
void TestSingleExtensionDownloading(bool pending, bool retry, bool fail) {
net::TestURLFetcherFactory factory;
net::TestURLFetcher* fetcher = NULL;
- scoped_ptr<ServiceForDownloadTests> service(
+ std::unique_ptr<ServiceForDownloadTests> service(
new ServiceForDownloadTests(prefs_.get()));
ExtensionUpdater updater(service.get(),
service->extension_prefs(),
@@ -1176,9 +1183,9 @@
Version version("0.0.1");
std::set<int> requests;
requests.insert(0);
- scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch(
- new ExtensionDownloader::ExtensionFetch(
- id, test_url, hash, version.GetString(), requests));
+ std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch(
+ new ExtensionDownloader::ExtensionFetch(id, test_url, hash,
+ version.GetString(), requests));
updater.downloader_->FetchUpdatedExtension(std::move(fetch));
if (pending) {
@@ -1262,7 +1269,7 @@
int max_authuser) {
net::TestURLFetcherFactory factory;
net::TestURLFetcher* fetcher = NULL;
- scoped_ptr<ServiceForDownloadTests> service(
+ std::unique_ptr<ServiceForDownloadTests> service(
new ServiceForDownloadTests(prefs_.get()));
const ExtensionDownloader::Factory& downloader_factory =
enable_oauth2 ? service->GetAuthenticatedDownloaderFactory()
@@ -1286,9 +1293,9 @@
Version version("0.0.1");
std::set<int> requests;
requests.insert(0);
- scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch(
- new ExtensionDownloader::ExtensionFetch(
- id, test_url, hash, version.GetString(), requests));
+ std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch(
+ new ExtensionDownloader::ExtensionFetch(id, test_url, hash,
+ version.GetString(), requests));
updater.downloader_->FetchUpdatedExtension(std::move(fetch));
fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId);
@@ -1476,12 +1483,12 @@
std::set<int> requests;
requests.insert(0);
// Start two fetches
- scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch1(
- new ExtensionDownloader::ExtensionFetch(
- id1, url1, hash1, version1, requests));
- scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch2(
- new ExtensionDownloader::ExtensionFetch(
- id2, url2, hash2, version2, requests));
+ std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch1(
+ new ExtensionDownloader::ExtensionFetch(id1, url1, hash1, version1,
+ requests));
+ std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch2(
+ new ExtensionDownloader::ExtensionFetch(id2, url2, hash2, version2,
+ requests));
updater.downloader_->FetchUpdatedExtension(std::move(fetch1));
updater.downloader_->FetchUpdatedExtension(std::move(fetch2));
@@ -1775,7 +1782,7 @@
updater.Start();
updater.EnsureDownloaderCreated();
- scoped_ptr<ManifestFetchData> fetch_data(
+ std::unique_ptr<ManifestFetchData> fetch_data(
CreateManifestFetchData(update_url));
const Extension* extension = tmp[0].get();
fetch_data->AddExtension(extension->id(), extension->VersionString(),
@@ -1888,7 +1895,7 @@
}
protected:
- scoped_ptr<TestExtensionPrefs> prefs_;
+ std::unique_ptr<TestExtensionPrefs> prefs_;
ManifestFetchData* CreateManifestFetchData(const GURL& update_url) {
return new ManifestFetchData(update_url, 0, "",
@@ -2124,7 +2131,7 @@
net::TestURLFetcherFactory factory;
MockService service(prefs_.get());
MockExtensionDownloaderDelegate delegate;
- scoped_ptr<ExtensionDownloader> downloader(
+ std::unique_ptr<ExtensionDownloader> downloader(
new ExtensionDownloader(&delegate, service.request_context()));
EXPECT_EQ(0u, ManifestFetchersCount(downloader.get()));
diff --git a/chrome/browser/extensions/updater/local_extension_cache.cc b/chrome/browser/extensions/updater/local_extension_cache.cc
index 4caec7d8..7370999 100644
--- a/chrome/browser/extensions/updater/local_extension_cache.cc
+++ b/chrome/browser/extensions/updater/local_extension_cache.cc
@@ -306,7 +306,7 @@
base::WeakPtr<LocalExtensionCache> local_cache,
const base::FilePath& cache_dir,
const base::Closure& callback) {
- scoped_ptr<CacheMap> cache_content(new CacheMap);
+ std::unique_ptr<CacheMap> cache_content(new CacheMap);
BackendCheckCacheContentsInternal(cache_dir, cache_content.get());
content::BrowserThread::PostTask(
content::BrowserThread::UI,
@@ -465,7 +465,7 @@
}
void LocalExtensionCache::OnCacheContentsChecked(
- scoped_ptr<CacheMap> cache_content,
+ std::unique_ptr<CacheMap> cache_content,
const base::Closure& callback) {
cache_content->swap(cached_extensions_);
state_ = kReady;
diff --git a/chrome/browser/extensions/updater/local_extension_cache.h b/chrome/browser/extensions/updater/local_extension_cache.h
index 0bd50ef..acf4e283 100644
--- a/chrome/browser/extensions/updater/local_extension_cache.h
+++ b/chrome/browser/extensions/updater/local_extension_cache.h
@@ -9,12 +9,12 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <string>
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
@@ -208,7 +208,7 @@
// Invoked when the cache content on disk has been checked. |cache_content|
// contains all the currently valid crx files in the cache.
- void OnCacheContentsChecked(scoped_ptr<CacheMap> cache_content,
+ void OnCacheContentsChecked(std::unique_ptr<CacheMap> cache_content,
const base::Closure& callback);
// Update timestamp for the file to mark it as "used". This method is invoked
diff --git a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc
index 2ef7759..efcf267c 100644
--- a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc
+++ b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc
@@ -139,7 +139,7 @@
private:
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<base::SequencedWorkerPoolOwner> pool_owner_;
+ std::unique_ptr<base::SequencedWorkerPoolOwner> pool_owner_;
scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
base::ScopedTempDir cache_dir_;
@@ -339,7 +339,7 @@
EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash22, NULL, NULL));
}
-static void OnPutExtension(scoped_ptr<base::RunLoop>* run_loop,
+static void OnPutExtension(std::unique_ptr<base::RunLoop>* run_loop,
const base::FilePath& file_path,
bool file_ownership_passed) {
ASSERT_TRUE(*run_loop);
@@ -351,7 +351,7 @@
const std::string& expected_hash,
const base::FilePath& path,
const std::string& version) {
- scoped_ptr<base::RunLoop> run_loop;
+ std::unique_ptr<base::RunLoop> run_loop;
run_loop.reset(new base::RunLoop);
cache.PutExtension(id, expected_hash, path, version,
base::Bind(&OnPutExtension, &run_loop));
diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc
index 3485c056..4f8338b 100644
--- a/chrome/browser/extensions/user_script_listener.cc
+++ b/chrome/browser/extensions/user_script_listener.cc
@@ -61,7 +61,7 @@
private:
bool should_defer_;
bool did_defer_;
- scoped_ptr<base::ElapsedTimer> timer_;
+ std::unique_ptr<base::ElapsedTimer> timer_;
DISALLOW_COPY_AND_ASSIGN(Throttle);
};
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index e2c7c93..091723d 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/user_script_listener.h"
+
+#include <memory>
+
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/unpacked_installer.h"
-#include "chrome/browser/extensions/user_script_listener.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/notification_service.h"
@@ -56,7 +58,7 @@
private:
net::URLRequest* request_;
- scoped_ptr<ResourceThrottle> throttle_;
+ std::unique_ptr<ResourceThrottle> throttle_;
};
// A simple test net::URLRequestJob. We don't care what it does, only that
@@ -75,8 +77,9 @@
};
// Yoinked from extension_manifest_unittest.cc.
-scoped_ptr<base::DictionaryValue> LoadManifestFile(const base::FilePath path,
- std::string* error) {
+std::unique_ptr<base::DictionaryValue> LoadManifestFile(
+ const base::FilePath path,
+ std::string* error) {
EXPECT_TRUE(base::PathExists(path));
JSONFileValueDeserializer deserializer(path);
return base::DictionaryValue::From(deserializer.Deserialize(NULL, error));
@@ -90,7 +93,7 @@
AppendASCII("extensions").
AppendASCII("manifest_tests").
AppendASCII(filename.c_str());
- scoped_ptr<base::DictionaryValue> value = LoadManifestFile(path, error);
+ std::unique_ptr<base::DictionaryValue> value = LoadManifestFile(path, error);
if (!value)
return NULL;
return Extension::Create(path.DirName(), Manifest::UNPACKED, *value,
@@ -120,13 +123,11 @@
public:
UserScriptListenerTest() {
net::URLRequestFilter::GetInstance()->AddHostnameInterceptor(
- "http", "google.com",
- scoped_ptr<net::URLRequestInterceptor>(
- new SimpleTestJobURLRequestInterceptor()));
+ "http", "google.com", std::unique_ptr<net::URLRequestInterceptor>(
+ new SimpleTestJobURLRequestInterceptor()));
net::URLRequestFilter::GetInstance()->AddHostnameInterceptor(
- "http", "example.com",
- scoped_ptr<net::URLRequestInterceptor>(
- new SimpleTestJobURLRequestInterceptor()));
+ "http", "example.com", std::unique_ptr<net::URLRequestInterceptor>(
+ new SimpleTestJobURLRequestInterceptor()));
}
~UserScriptListenerTest() override {
@@ -153,13 +154,13 @@
}
protected:
- scoped_ptr<net::URLRequest> StartTestRequest(
+ std::unique_ptr<net::URLRequest> StartTestRequest(
net::URLRequest::Delegate* delegate,
const std::string& url_string,
net::TestURLRequestContext* context) {
GURL url(url_string);
- scoped_ptr<net::URLRequest> request(context->CreateRequest(
- url, net::DEFAULT_PRIORITY, delegate));
+ std::unique_ptr<net::URLRequest> request(
+ context->CreateRequest(url, net::DEFAULT_PRIORITY, delegate));
ResourceThrottle* throttle = listener_->CreateResourceThrottle(
url, content::RESOURCE_TYPE_MAIN_FRAME);
@@ -209,7 +210,7 @@
net::TestDelegate delegate;
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
StartTestRequest(&delegate, kMatchingUrl, &context));
ASSERT_FALSE(request->is_pending());
@@ -227,7 +228,7 @@
net::TestDelegate delegate;
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
StartTestRequest(&delegate, kMatchingUrl, &context));
ASSERT_FALSE(request->is_pending());
@@ -249,7 +250,7 @@
TEST_F(UserScriptListenerTest, NoDelayNoExtension) {
net::TestDelegate delegate;
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
StartTestRequest(&delegate, kMatchingUrl, &context));
// The request should be started immediately.
@@ -265,7 +266,7 @@
net::TestDelegate delegate;
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
StartTestRequest(&delegate, kNotMatchingUrl, &context));
// The request should be started immediately.
@@ -296,7 +297,7 @@
net::TestDelegate delegate;
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> request(
+ std::unique_ptr<net::URLRequest> request(
StartTestRequest(&delegate, kMatchingUrl, &context));
ASSERT_FALSE(request->is_pending());
@@ -328,8 +329,8 @@
net::TestDelegate delegate;
net::TestURLRequestContext context;
GURL url(kMatchingUrl);
- scoped_ptr<net::URLRequest> request(context.CreateRequest(
- url, net::DEFAULT_PRIORITY, &delegate));
+ std::unique_ptr<net::URLRequest> request(
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, &delegate));
ResourceThrottle* throttle =
listener_->CreateResourceThrottle(url, content::RESOURCE_TYPE_MAIN_FRAME);
diff --git a/chrome/browser/extensions/webstore_data_fetcher.cc b/chrome/browser/extensions/webstore_data_fetcher.cc
index 1ade331..1586b92 100644
--- a/chrome/browser/extensions/webstore_data_fetcher.cc
+++ b/chrome/browser/extensions/webstore_data_fetcher.cc
@@ -55,14 +55,15 @@
}
void WebstoreDataFetcher::OnJsonParseSuccess(
- scoped_ptr<base::Value> parsed_json) {
+ std::unique_ptr<base::Value> parsed_json) {
if (!parsed_json->IsType(base::Value::TYPE_DICTIONARY)) {
OnJsonParseFailure(kInvalidWebstoreResponseError);
return;
}
- delegate_->OnWebstoreResponseParseSuccess(scoped_ptr<base::DictionaryValue>(
- static_cast<base::DictionaryValue*>(parsed_json.release())));
+ delegate_->OnWebstoreResponseParseSuccess(
+ std::unique_ptr<base::DictionaryValue>(
+ static_cast<base::DictionaryValue*>(parsed_json.release())));
}
void WebstoreDataFetcher::OnJsonParseFailure(
@@ -73,7 +74,8 @@
void WebstoreDataFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
CHECK_EQ(webstore_data_url_fetcher_.get(), source);
- scoped_ptr<net::URLFetcher> fetcher(std::move(webstore_data_url_fetcher_));
+ std::unique_ptr<net::URLFetcher> fetcher(
+ std::move(webstore_data_url_fetcher_));
if (!fetcher->GetStatus().is_success() ||
fetcher->GetResponseCode() != 200) {
diff --git a/chrome/browser/extensions/webstore_data_fetcher.h b/chrome/browser/extensions/webstore_data_fetcher.h
index 0cb26f3..bcb48a5 100644
--- a/chrome/browser/extensions/webstore_data_fetcher.h
+++ b/chrome/browser/extensions/webstore_data_fetcher.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_H_
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "url/gurl.h"
@@ -44,7 +44,7 @@
}
private:
- void OnJsonParseSuccess(scoped_ptr<base::Value> parsed_json);
+ void OnJsonParseSuccess(std::unique_ptr<base::Value> parsed_json);
void OnJsonParseFailure(const std::string& error);
// net::URLFetcherDelegate overrides:
@@ -56,7 +56,7 @@
std::string id_;
// For fetching webstore JSON data.
- scoped_ptr<net::URLFetcher> webstore_data_url_fetcher_;
+ std::unique_ptr<net::URLFetcher> webstore_data_url_fetcher_;
// Maximum auto retry times on server 5xx error or ERR_NETWORK_CHANGED.
// Default is 0 which means to use the URLFetcher default behavior.
diff --git a/chrome/browser/extensions/webstore_data_fetcher_delegate.h b/chrome/browser/extensions/webstore_data_fetcher_delegate.h
index 7f864e9..3b503d62 100644
--- a/chrome/browser/extensions/webstore_data_fetcher_delegate.h
+++ b/chrome/browser/extensions/webstore_data_fetcher_delegate.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_DELEGATE_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
namespace base {
class DictionaryValue;
@@ -23,7 +23,7 @@
// Invoked when the web store response parsing is successful. Delegate takes
// ownership of |webstore_data|.
virtual void OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) = 0;
+ std::unique_ptr<base::DictionaryValue> webstore_data) = 0;
// Invoked when the web store response parsing is failed.
virtual void OnWebstoreResponseParseFailure(const std::string& error) = 0;
diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc
index 0b0f698..86a7848 100644
--- a/chrome/browser/extensions/webstore_inline_installer.cc
+++ b/chrome/browser/extensions/webstore_inline_installer.cc
@@ -101,9 +101,9 @@
return requestor_url_;
}
-scoped_ptr<ExtensionInstallPrompt::Prompt>
+std::unique_ptr<ExtensionInstallPrompt::Prompt>
WebstoreInlineInstaller::CreateInstallPrompt() const {
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::INLINE_INSTALL_PROMPT));
diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h
index 22ae82138..9e11fa4 100644
--- a/chrome/browser/extensions/webstore_inline_installer.h
+++ b/chrome/browser/extensions/webstore_inline_installer.h
@@ -54,7 +54,7 @@
bool ShouldShowPostInstallUI() const override;
bool ShouldShowAppInstalledBubble() const override;
content::WebContents* GetWebContents() const override;
- scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const override;
bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data,
std::string* error) const override;
diff --git a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
index eba0821..d6c561dc0 100644
--- a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/extensions/webstore_inline_installer.h"
+
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/tab_helper.h"
-#include "chrome/browser/extensions/webstore_inline_installer.h"
#include "chrome/browser/extensions/webstore_inline_installer_factory.h"
#include "chrome/browser/extensions/webstore_installer_test.h"
#include "chrome/browser/extensions/webstore_standalone_installer.h"
@@ -71,8 +73,8 @@
const ExtensionInstallPrompt::DoneCallback& done_callback,
const Extension* extension,
const SkBitmap* icon,
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt,
- scoped_ptr<const extensions::PermissionSet> custom_permissions,
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt,
+ std::unique_ptr<const extensions::PermissionSet> custom_permissions,
const ShowDialogCallback& show_dialog_callback) override {
done_callback_ = done_callback;
g_done_callback = &done_callback_;
@@ -118,9 +120,9 @@
install_result_target_(nullptr),
programmable_prompt_(nullptr) {}
- scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override {
+ std::unique_ptr<ExtensionInstallPrompt> CreateInstallUI() override {
programmable_prompt_ = new ProgrammableInstallPrompt(web_contents());
- return make_scoped_ptr(programmable_prompt_);
+ return base::WrapUnique(programmable_prompt_);
}
// Added here to make it public so that test cases can call it below.
@@ -131,7 +133,7 @@
// Tests that care about the actual arguments to the install callback can use
// this to receive a copy in |install_result_target|.
void set_install_result_target(
- scoped_ptr<InstallResult>* install_result_target) {
+ std::unique_ptr<InstallResult>* install_result_target) {
install_result_target_ = install_result_target;
}
@@ -153,7 +155,7 @@
// This can be set by tests that want to get the actual install callback
// arguments.
- scoped_ptr<InstallResult>* install_result_target_;
+ std::unique_ptr<InstallResult>* install_result_target_;
ProgrammableInstallPrompt* programmable_prompt_;
};
@@ -225,7 +227,7 @@
// implement). If we ever do change things to kill the prompt in this case,
// the following code can be removed (it verifies that clicking ok on the
// dialog does not result in an install).
- scoped_ptr<InstallResult> install_result;
+ std::unique_ptr<InstallResult> install_result;
factory->last_installer()->set_install_result_target(&install_result);
ASSERT_TRUE(ProgrammableInstallPrompt::Ready());
ProgrammableInstallPrompt::Accept();
diff --git a/chrome/browser/extensions/webstore_inline_installer_factory.cc b/chrome/browser/extensions/webstore_inline_installer_factory.cc
index e96b725..39e0b83a 100644
--- a/chrome/browser/extensions/webstore_inline_installer_factory.cc
+++ b/chrome/browser/extensions/webstore_inline_installer_factory.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/extensions/webstore_inline_installer.h"
#include "chrome/browser/extensions/webstore_inline_installer_factory.h"
+
+#include <memory>
+
+#include "chrome/browser/extensions/webstore_inline_installer.h"
#include "content/public/browser/web_contents.h"
namespace extensions {
diff --git a/chrome/browser/extensions/webstore_inline_installer_factory.h b/chrome/browser/extensions/webstore_inline_installer_factory.h
index 5b891cc..97dcc8f9 100644
--- a/chrome/browser/extensions/webstore_inline_installer_factory.h
+++ b/chrome/browser/extensions/webstore_inline_installer_factory.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_FACTORY_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/webstore_standalone_installer.h"
diff --git a/chrome/browser/extensions/webstore_inline_installer_unittest.cc b/chrome/browser/extensions/webstore_inline_installer_unittest.cc
index ae45287..1d06828d 100644
--- a/chrome/browser/extensions/webstore_inline_installer_unittest.cc
+++ b/chrome/browser/extensions/webstore_inline_installer_unittest.cc
@@ -64,7 +64,7 @@
const std::vector<std::string>& verified_sites);
protected:
- scoped_ptr<content::WebContents> web_contents_;
+ std::unique_ptr<content::WebContents> web_contents_;
};
void WebstoreInlineInstallerTest::SetUp() {
diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc
index 55fefbe..691ec849 100644
--- a/chrome/browser/extensions/webstore_install_helper.cc
+++ b/chrome/browser/extensions/webstore_install_helper.cc
@@ -83,7 +83,7 @@
}
void WebstoreInstallHelper::OnJSONParseSucceeded(
- scoped_ptr<base::Value> result) {
+ std::unique_ptr<base::Value> result) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
manifest_parse_complete_ = true;
const base::DictionaryValue* value;
diff --git a/chrome/browser/extensions/webstore_install_helper.h b/chrome/browser/extensions/webstore_install_helper.h
index 7b1f62c1..c53ea812d 100644
--- a/chrome/browser/extensions/webstore_install_helper.h
+++ b/chrome/browser/extensions/webstore_install_helper.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
@@ -79,7 +79,7 @@
~WebstoreInstallHelper() override;
// Callbacks for the SafeJsonParser.
- void OnJSONParseSucceeded(scoped_ptr<base::Value> result);
+ void OnJSONParseSucceeded(std::unique_ptr<base::Value> result);
void OnJSONParseFailed(const std::string& error_message);
// Implementing the chrome::BitmapFetcherDelegate interface.
@@ -100,7 +100,7 @@
// SkBitmap.
GURL icon_url_;
net::URLRequestContextGetter* context_getter_; // Only usable on UI thread.
- scoped_ptr<chrome::BitmapFetcher> icon_fetcher_;
+ std::unique_ptr<chrome::BitmapFetcher> icon_fetcher_;
// Flags for whether we're done doing icon decoding and manifest parsing.
bool icon_decode_complete_;
@@ -108,7 +108,7 @@
// The results of successful decoding/parsing.
SkBitmap icon_;
- scoped_ptr<base::DictionaryValue> parsed_manifest_;
+ std::unique_ptr<base::DictionaryValue> parsed_manifest_;
// A details string for keeping track of any errors.
std::string error_;
diff --git a/chrome/browser/extensions/webstore_install_with_prompt.cc b/chrome/browser/extensions/webstore_install_with_prompt.cc
index b45a6418..6f2915f 100644
--- a/chrome/browser/extensions/webstore_install_with_prompt.cc
+++ b/chrome/browser/extensions/webstore_install_with_prompt.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/webstore_install_with_prompt.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h"
@@ -54,17 +55,18 @@
return dummy_requestor_url_;
}
-scoped_ptr<ExtensionInstallPrompt::Prompt>
+std::unique_ptr<ExtensionInstallPrompt::Prompt>
WebstoreInstallWithPrompt::CreateInstallPrompt() const {
- return make_scoped_ptr(new ExtensionInstallPrompt::Prompt(
+ return base::WrapUnique(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::INSTALL_PROMPT));
}
-scoped_ptr<ExtensionInstallPrompt>
+std::unique_ptr<ExtensionInstallPrompt>
WebstoreInstallWithPrompt::CreateInstallUI() {
// Create an ExtensionInstallPrompt. If the parent window is NULL, the dialog
// will be placed in the middle of the screen.
- return make_scoped_ptr(new ExtensionInstallPrompt(profile(), parent_window_));
+ return base::WrapUnique(
+ new ExtensionInstallPrompt(profile(), parent_window_));
}
bool WebstoreInstallWithPrompt::ShouldShowPostInstallUI() const {
diff --git a/chrome/browser/extensions/webstore_install_with_prompt.h b/chrome/browser/extensions/webstore_install_with_prompt.h
index 5973a9bd..ce4976ad 100644
--- a/chrome/browser/extensions/webstore_install_with_prompt.h
+++ b/chrome/browser/extensions/webstore_install_with_prompt.h
@@ -5,8 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_WITH_PROMPT_H_
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_WITH_PROMPT_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/webstore_standalone_installer.h"
#include "chrome/browser/ui/native_window_tracker.h"
#include "ui/gfx/native_widget_types.h"
@@ -55,9 +56,9 @@
bool ShouldShowPostInstallUI() const override;
bool ShouldShowAppInstalledBubble() const override;
content::WebContents* GetWebContents() const override;
- scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const override;
- scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override;
+ std::unique_ptr<ExtensionInstallPrompt> CreateInstallUI() override;
bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data,
std::string* error) const override;
bool CheckRequestorPermitted(const base::DictionaryValue& webstore_data,
@@ -69,10 +70,10 @@
GURL dummy_requestor_url_;
// A non-visible WebContents used to download data from the webstore.
- scoped_ptr<content::WebContents> dummy_web_contents_;
+ std::unique_ptr<content::WebContents> dummy_web_contents_;
gfx::NativeWindow parent_window_;
- scoped_ptr<NativeWindowTracker> parent_window_tracker_;
+ std::unique_ptr<NativeWindowTracker> parent_window_tracker_;
DISALLOW_COPY_AND_ASSIGN(WebstoreInstallWithPrompt);
};
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
index fa910f3..e2cddb4a 100644
--- a/chrome/browser/extensions/webstore_installer.cc
+++ b/chrome/browser/extensions/webstore_installer.cc
@@ -248,16 +248,16 @@
manifest_check_level(MANIFEST_CHECK_LEVEL_STRICT) {
}
-scoped_ptr<WebstoreInstaller::Approval>
+std::unique_ptr<WebstoreInstaller::Approval>
WebstoreInstaller::Approval::CreateWithInstallPrompt(Profile* profile) {
- scoped_ptr<Approval> result(new Approval());
+ std::unique_ptr<Approval> result(new Approval());
result->profile = profile;
return result;
}
-scoped_ptr<WebstoreInstaller::Approval>
+std::unique_ptr<WebstoreInstaller::Approval>
WebstoreInstaller::Approval::CreateForSharedModule(Profile* profile) {
- scoped_ptr<Approval> result(new Approval());
+ std::unique_ptr<Approval> result(new Approval());
result->profile = profile;
result->skip_install_dialog = true;
result->skip_post_install_ui = true;
@@ -265,19 +265,18 @@
return result;
}
-scoped_ptr<WebstoreInstaller::Approval>
+std::unique_ptr<WebstoreInstaller::Approval>
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
Profile* profile,
const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> parsed_manifest,
+ std::unique_ptr<base::DictionaryValue> parsed_manifest,
bool strict_manifest_check) {
- scoped_ptr<Approval> result(new Approval());
+ std::unique_ptr<Approval> result(new Approval());
result->extension_id = extension_id;
result->profile = profile;
- result->manifest = scoped_ptr<Manifest>(
- new Manifest(Manifest::INVALID_LOCATION,
- scoped_ptr<base::DictionaryValue>(
- parsed_manifest->DeepCopy())));
+ result->manifest = std::unique_ptr<Manifest>(new Manifest(
+ Manifest::INVALID_LOCATION,
+ std::unique_ptr<base::DictionaryValue>(parsed_manifest->DeepCopy())));
result->skip_install_dialog = true;
result->manifest_check_level = strict_manifest_check ?
MANIFEST_CHECK_LEVEL_STRICT : MANIFEST_CHECK_LEVEL_LOOSE;
@@ -295,7 +294,7 @@
Delegate* delegate,
content::WebContents* web_contents,
const std::string& id,
- scoped_ptr<Approval> approval,
+ std::unique_ptr<Approval> approval,
InstallSource source)
: content::WebContentsObserver(web_contents),
extension_registry_observer_(this),
@@ -491,7 +490,8 @@
download_item_->AddObserver(this);
if (pending_modules_.size() > 1) {
// We are downloading a shared module. We need create an approval for it.
- scoped_ptr<Approval> approval = Approval::CreateForSharedModule(profile_);
+ std::unique_ptr<Approval> approval =
+ Approval::CreateForSharedModule(profile_);
const SharedModuleInfo::ImportInfo& info = pending_modules_.front();
approval->extension_id = info.extension_id;
const Version version_required(info.minimum_version);
@@ -667,12 +667,9 @@
contents->GetRenderViewHost()->GetRoutingID();
content::ResourceContext* resource_context =
controller.GetBrowserContext()->GetResourceContext();
- scoped_ptr<DownloadUrlParameters> params(new DownloadUrlParameters(
- download_url_,
- render_process_host_id,
- render_view_host_routing_id,
- contents->GetMainFrame()->GetRoutingID(),
- resource_context));
+ std::unique_ptr<DownloadUrlParameters> params(new DownloadUrlParameters(
+ download_url_, render_process_host_id, render_view_host_routing_id,
+ contents->GetMainFrame()->GetRoutingID(), resource_context));
params->set_file_path(file);
if (controller.GetVisibleEntry())
params->set_referrer(content::Referrer::SanitizeForRequest(
diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h
index e02cbc6d..c1303c5 100644
--- a/chrome/browser/extensions/webstore_installer.h
+++ b/chrome/browser/extensions/webstore_installer.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_
#include <list>
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/supports_user_data.h"
#include "base/timer/timer.h"
@@ -102,20 +102,20 @@
// download was initiated by WebstoreInstaller. The Approval instance should
// be checked further for additional details.
struct Approval : public base::SupportsUserData::Data {
- static scoped_ptr<Approval> CreateWithInstallPrompt(Profile* profile);
+ static std::unique_ptr<Approval> CreateWithInstallPrompt(Profile* profile);
// Creates an Approval for installing a shared module.
- static scoped_ptr<Approval> CreateForSharedModule(Profile* profile);
+ static std::unique_ptr<Approval> CreateForSharedModule(Profile* profile);
// Creates an Approval that will skip putting up an install confirmation
// prompt if the actual manifest from the extension to be installed matches
// |parsed_manifest|. The |strict_manifest_check| controls whether we want
// to require an exact manifest match, or are willing to tolerate a looser
// check just that the effective permissions are the same.
- static scoped_ptr<Approval> CreateWithNoInstallPrompt(
+ static std::unique_ptr<Approval> CreateWithNoInstallPrompt(
Profile* profile,
const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> parsed_manifest,
+ std::unique_ptr<base::DictionaryValue> parsed_manifest,
bool strict_manifest_check);
~Approval() override;
@@ -127,7 +127,7 @@
Profile* profile;
// The expected manifest, before localization.
- scoped_ptr<Manifest> manifest;
+ std::unique_ptr<Manifest> manifest;
// Whether to use a bubble notification when an app is installed, instead of
// the default behavior of transitioning to the new tab page.
@@ -159,7 +159,7 @@
scoped_refptr<Extension> dummy_extension;
// Required minimum version.
- scoped_ptr<Version> minimum_version;
+ std::unique_ptr<Version> minimum_version;
// The authuser index required to download the item being installed. May be
// the empty string, in which case no authuser parameter is used.
@@ -185,7 +185,7 @@
Delegate* delegate,
content::WebContents* web_contents,
const std::string& id,
- scoped_ptr<Approval> approval,
+ std::unique_ptr<Approval> approval,
InstallSource source);
// Starts downloading and installing the extension.
@@ -275,7 +275,7 @@
// trigger at least every second, though sometimes more frequently (depending
// on number of modules, etc).
base::OneShotTimer download_progress_timer_;
- scoped_ptr<Approval> approval_;
+ std::unique_ptr<Approval> approval_;
GURL download_url_;
scoped_refptr<CrxInstaller> crx_installer_;
diff --git a/chrome/browser/extensions/webstore_installer_browsertest.cc b/chrome/browser/extensions/webstore_installer_browsertest.cc
index 92a080f..891dadf 100644
--- a/chrome/browser/extensions/webstore_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_installer_browsertest.cc
@@ -39,7 +39,7 @@
Delegate* delegate,
content::WebContents* web_contents,
const std::string& id,
- scoped_ptr<Approval> approval,
+ std::unique_ptr<Approval> approval,
InstallSource source)
: WebstoreInstaller(profile,
delegate,
@@ -117,7 +117,7 @@
}
IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) {
- scoped_ptr<base::DictionaryValue> manifest(
+ std::unique_ptr<base::DictionaryValue> manifest(
DictionaryBuilder()
.Set("name", kExtensionName)
.Set("description", "Foo")
@@ -131,7 +131,7 @@
ASSERT_TRUE(active_web_contents);
// Create an approval.
- scoped_ptr<WebstoreInstaller::Approval> approval =
+ std::unique_ptr<WebstoreInstaller::Approval> approval =
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
browser()->profile(), kTestExtensionId, std::move(manifest), false);
@@ -150,7 +150,7 @@
}
IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, SimultaneousInstall) {
- scoped_ptr<base::DictionaryValue> manifest(
+ std::unique_ptr<base::DictionaryValue> manifest(
DictionaryBuilder()
.Set("name", kExtensionName)
.Set("description", "Foo")
@@ -164,12 +164,10 @@
ASSERT_TRUE(active_web_contents);
// Create an approval.
- scoped_ptr<WebstoreInstaller::Approval> approval =
+ std::unique_ptr<WebstoreInstaller::Approval> approval =
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
- browser()->profile(),
- kTestExtensionId,
- scoped_ptr<base::DictionaryValue>(manifest->DeepCopy()),
- false);
+ browser()->profile(), kTestExtensionId,
+ std::unique_ptr<base::DictionaryValue>(manifest->DeepCopy()), false);
// Create and run a WebstoreInstaller.
base::RunLoop run_loop;
diff --git a/chrome/browser/extensions/webstore_installer_test.h b/chrome/browser/extensions/webstore_installer_test.h
index ec88e2e8..4c67ef2b 100644
--- a/chrome/browser/extensions/webstore_installer_test.h
+++ b/chrome/browser/extensions/webstore_installer_test.h
@@ -71,7 +71,8 @@
base::ScopedTempDir download_directory_;
- scoped_ptr<extensions::ScopedTestDialogAutoConfirm> install_auto_confirm_;
+ std::unique_ptr<extensions::ScopedTestDialogAutoConfirm>
+ install_auto_confirm_;
DISALLOW_COPY_AND_ASSIGN(WebstoreInstallerTest);
};
diff --git a/chrome/browser/extensions/webstore_reinstaller.cc b/chrome/browser/extensions/webstore_reinstaller.cc
index d1a1604..29b4e99 100644
--- a/chrome/browser/extensions/webstore_reinstaller.cc
+++ b/chrome/browser/extensions/webstore_reinstaller.cc
@@ -44,9 +44,9 @@
return GURL::EmptyGURL();
}
-scoped_ptr<ExtensionInstallPrompt::Prompt>
+std::unique_ptr<ExtensionInstallPrompt::Prompt>
WebstoreReinstaller::CreateInstallPrompt() const {
- scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::REPAIR_PROMPT));
prompt->SetWebstoreData(localized_user_count(),
diff --git a/chrome/browser/extensions/webstore_reinstaller.h b/chrome/browser/extensions/webstore_reinstaller.h
index 5cc5813..4123440 100644
--- a/chrome/browser/extensions/webstore_reinstaller.h
+++ b/chrome/browser/extensions/webstore_reinstaller.h
@@ -34,7 +34,7 @@
bool ShouldShowPostInstallUI() const override;
bool ShouldShowAppInstalledBubble() const override;
content::WebContents* GetWebContents() const override;
- scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const override;
bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data,
std::string* error) const override;
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc
index da7483d..33c164f 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.cc
+++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "base/version.h"
#include "chrome/browser/extensions/crx_installer.h"
@@ -170,18 +171,17 @@
ProceedWithInstallPrompt();
}
-scoped_ptr<ExtensionInstallPrompt>
+std::unique_ptr<ExtensionInstallPrompt>
WebstoreStandaloneInstaller::CreateInstallUI() {
- return make_scoped_ptr(new ExtensionInstallPrompt(GetWebContents()));
+ return base::WrapUnique(new ExtensionInstallPrompt(GetWebContents()));
}
-scoped_ptr<WebstoreInstaller::Approval>
+std::unique_ptr<WebstoreInstaller::Approval>
WebstoreStandaloneInstaller::CreateApproval() const {
- scoped_ptr<WebstoreInstaller::Approval> approval(
+ std::unique_ptr<WebstoreInstaller::Approval> approval(
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
- profile_,
- id_,
- scoped_ptr<base::DictionaryValue>(manifest_.get()->DeepCopy()),
+ profile_, id_,
+ std::unique_ptr<base::DictionaryValue>(manifest_.get()->DeepCopy()),
true));
approval->skip_post_install_ui = !ShouldShowPostInstallUI();
approval->use_app_installed_bubble = ShouldShowAppInstalledBubble();
@@ -204,7 +204,7 @@
DCHECK(result == ExtensionInstallPrompt::Result::ACCEPTED);
- scoped_ptr<WebstoreInstaller::Approval> approval = CreateApproval();
+ std::unique_ptr<WebstoreInstaller::Approval> approval = CreateApproval();
ExtensionService* extension_service =
ExtensionSystem::Get(profile_)->extension_service();
@@ -244,7 +244,7 @@
}
void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) {
+ std::unique_ptr<base::DictionaryValue> webstore_data) {
OnWebStoreDataFetcherDone();
if (!CheckRequestorAlive()) {
diff --git a/chrome/browser/extensions/webstore_standalone_installer.h b/chrome/browser/extensions/webstore_standalone_installer.h
index 5cb43a26..ed79c38 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.h
+++ b/chrome/browser/extensions/webstore_standalone_installer.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_
#define CHROME_BROWSER_EXTENSIONS_WEBSTORE_STANDALONE_INSTALLER_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/active_install_data.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/webstore_data_fetcher_delegate.h"
@@ -120,7 +120,7 @@
// Should return an installation prompt with desired properties or NULL if
// no prompt should be shown.
- virtual scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ virtual std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const = 0;
// Perform all necessary checks to make sure inline install is permitted,
@@ -146,10 +146,10 @@
// Returns an install UI to be shown. By default, this returns an install UI
// that is a transient child of the host window for GetWebContents().
- virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI();
+ virtual std::unique_ptr<ExtensionInstallPrompt> CreateInstallUI();
// Create an approval to pass installation parameters to the CrxInstaller.
- virtual scoped_ptr<WebstoreInstaller::Approval> CreateApproval() const;
+ virtual std::unique_ptr<WebstoreInstaller::Approval> CreateApproval() const;
// Called once the install prompt has finished.
virtual void OnInstallPromptDone(ExtensionInstallPrompt::Result result);
@@ -194,7 +194,7 @@
void OnWebstoreRequestFailure() override;
void OnWebstoreResponseParseSuccess(
- scoped_ptr<base::DictionaryValue> webstore_data) override;
+ std::unique_ptr<base::DictionaryValue> webstore_data) override;
void OnWebstoreResponseParseFailure(const std::string& error) override;
@@ -223,11 +223,11 @@
WebstoreInstaller::InstallSource install_source_;
// Installation dialog and its underlying prompt.
- scoped_ptr<ExtensionInstallPrompt> install_ui_;
- scoped_ptr<ExtensionInstallPrompt::Prompt> install_prompt_;
+ std::unique_ptr<ExtensionInstallPrompt> install_ui_;
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> install_prompt_;
// For fetching webstore JSON data.
- scoped_ptr<WebstoreDataFetcher> webstore_data_fetcher_;
+ std::unique_ptr<WebstoreDataFetcher> webstore_data_fetcher_;
// Extracted from the webstore JSON data response.
std::string localized_name_;
@@ -236,12 +236,12 @@
std::string localized_user_count_;
double average_rating_;
int rating_count_;
- scoped_ptr<base::DictionaryValue> webstore_data_;
- scoped_ptr<base::DictionaryValue> manifest_;
+ std::unique_ptr<base::DictionaryValue> webstore_data_;
+ std::unique_ptr<base::DictionaryValue> manifest_;
SkBitmap icon_;
// Active install registered with the InstallTracker.
- scoped_ptr<ScopedActiveInstall> scoped_active_install_;
+ std::unique_ptr<ScopedActiveInstall> scoped_active_install_;
// Created by ShowInstallUI() when a prompt is shown (if
// the implementor returns a non-NULL in CreateInstallPrompt()).
diff --git a/chrome/browser/extensions/webstore_startup_installer.cc b/chrome/browser/extensions/webstore_startup_installer.cc
index 7f0cdba..5dee0f4 100644
--- a/chrome/browser/extensions/webstore_startup_installer.cc
+++ b/chrome/browser/extensions/webstore_startup_installer.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/webstore_startup_installer.h"
+#include "base/memory/ptr_util.h"
+
namespace extensions {
WebstoreStartupInstaller::WebstoreStartupInstaller(
@@ -19,10 +21,10 @@
WebstoreStartupInstaller::~WebstoreStartupInstaller() {}
-scoped_ptr<ExtensionInstallPrompt::Prompt>
+std::unique_ptr<ExtensionInstallPrompt::Prompt>
WebstoreStartupInstaller::CreateInstallPrompt() const {
if (show_prompt_) {
- return make_scoped_ptr(new ExtensionInstallPrompt::Prompt(
+ return base::WrapUnique(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::INSTALL_PROMPT));
}
return NULL;
diff --git a/chrome/browser/extensions/webstore_startup_installer.h b/chrome/browser/extensions/webstore_startup_installer.h
index f0358c377..594582d6 100644
--- a/chrome/browser/extensions/webstore_startup_installer.h
+++ b/chrome/browser/extensions/webstore_startup_installer.h
@@ -32,7 +32,7 @@
~WebstoreStartupInstaller() override;
// Implementations of WebstoreStandaloneInstaller Template Method's hooks.
- scoped_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
+ std::unique_ptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
const override;
private:
diff --git a/chrome/browser/extensions/window_controller.h b/chrome/browser/extensions/window_controller.h
index 5bd45cb..c54a98b 100644
--- a/chrome/browser/extensions/window_controller.h
+++ b/chrome/browser/extensions/window_controller.h
@@ -85,11 +85,11 @@
virtual base::DictionaryValue* CreateWindowValueWithTabs(
const extensions::Extension* extension) const = 0;
- virtual scoped_ptr<api::tabs::Tab> CreateTabObject(
+ virtual std::unique_ptr<api::tabs::Tab> CreateTabObject(
const extensions::Extension* extension,
int tab_index) const = 0;
- // DEPRECATED: Use scoped_ptr<api::tabs::Tab> CreateTabObject(...)
+ // DEPRECATED: Use std::unique_ptr<api::tabs::Tab> CreateTabObject(...)
virtual base::DictionaryValue* CreateTabValue(
const extensions::Extension* extension, int tab_index) const = 0;
diff --git a/chrome/browser/extensions/zipfile_installer.h b/chrome/browser/extensions/zipfile_installer.h
index 8898908..39de613 100644
--- a/chrome/browser/extensions/zipfile_installer.h
+++ b/chrome/browser/extensions/zipfile_installer.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_ZIPFILE_INSTALLER_H_
#define CHROME_BROWSER_EXTENSIONS_ZIPFILE_INSTALLER_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/utility_process_host_client.h"
diff --git a/chrome/browser/extensions/zipfile_installer_unittest.cc b/chrome/browser/extensions/zipfile_installer_unittest.cc
index e0fa78e5..4c253a83 100644
--- a/chrome/browser/extensions/zipfile_installer_unittest.cc
+++ b/chrome/browser/extensions/zipfile_installer_unittest.cc
@@ -108,11 +108,11 @@
protected:
scoped_refptr<ZipFileInstaller> zipfile_installer_;
- scoped_ptr<TestingProfile> profile_;
+ std::unique_ptr<TestingProfile> profile_;
ExtensionService* extension_service_;
content::TestBrowserThreadBundle browser_threads_;
- scoped_ptr<content::InProcessUtilityThreadHelper>
+ std::unique_ptr<content::InProcessUtilityThreadHelper>
in_process_utility_thread_helper_;
MockExtensionRegistryObserver observer_;