Convert //components/gcm_driver from scoped_ptr to std::unique_ptr
BUG=554298
[email protected]
Review URL: https://codereview.chromium.org/1907003003
Cr-Commit-Position: refs/heads/master@{#388906}
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.h b/components/gcm_driver/crypto/gcm_encryption_provider.h
index b07d42f1..1b90f872 100644
--- a/components/gcm_driver/crypto/gcm_encryption_provider.h
+++ b/components/gcm_driver/crypto/gcm_encryption_provider.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
namespace base {
@@ -122,7 +122,7 @@
const KeyPair& pair,
const std::string& auth_secret);
- scoped_ptr<GCMKeyStore> key_store_;
+ std::unique_ptr<GCMKeyStore> key_store_;
base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_;
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
index 233e8a4..2b2d0693 100644
--- a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
+++ b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
@@ -112,7 +112,7 @@
base::ScopedTempDir scoped_temp_dir_;
base::HistogramTester histogram_tester_;
- scoped_ptr<GCMEncryptionProvider> encryption_provider_;
+ std::unique_ptr<GCMEncryptionProvider> encryption_provider_;
GCMEncryptionProvider::DecryptionResult decryption_result_ =
GCMEncryptionProvider::DECRYPTION_RESULT_UNENCRYPTED;
diff --git a/components/gcm_driver/crypto/gcm_key_store.cc b/components/gcm_driver/crypto/gcm_key_store.cc
index 25cf078..8cb03c9 100644
--- a/components/gcm_driver/crypto/gcm_key_store.cc
+++ b/components/gcm_driver/crypto/gcm_key_store.cc
@@ -116,8 +116,8 @@
using EntryVectorType =
leveldb_proto::ProtoDatabase<EncryptionData>::KeyEntryVector;
- scoped_ptr<EntryVectorType> entries_to_save(new EntryVectorType());
- scoped_ptr<std::vector<std::string>> keys_to_remove(
+ std::unique_ptr<EntryVectorType> entries_to_save(new EntryVectorType());
+ std::unique_ptr<std::vector<std::string>> keys_to_remove(
new std::vector<std::string>());
entries_to_save->push_back(std::make_pair(app_id, encryption_data));
@@ -166,8 +166,8 @@
using EntryVectorType =
leveldb_proto::ProtoDatabase<EncryptionData>::KeyEntryVector;
- scoped_ptr<EntryVectorType> entries_to_save(new EntryVectorType());
- scoped_ptr<std::vector<std::string>> keys_to_remove(
+ std::unique_ptr<EntryVectorType> entries_to_save(new EntryVectorType());
+ std::unique_ptr<std::vector<std::string>> keys_to_remove(
new std::vector<std::string>(1, app_id));
database_->UpdateEntries(
@@ -225,8 +225,9 @@
base::Bind(&GCMKeyStore::DidLoadKeys, weak_factory_.GetWeakPtr()));
}
-void GCMKeyStore::DidLoadKeys(bool success,
- scoped_ptr<std::vector<EncryptionData>> entries) {
+void GCMKeyStore::DidLoadKeys(
+ bool success,
+ std::unique_ptr<std::vector<EncryptionData>> entries) {
UMA_HISTOGRAM_BOOLEAN("GCM.Crypto.LoadKeyStoreSuccessRate", success);
if (!success) {
DVLOG(1) << "Unable to load entries into the GCM Key Store.";
diff --git a/components/gcm_driver/crypto/gcm_key_store.h b/components/gcm_driver/crypto/gcm_key_store.h
index a89265f..743785ae 100644
--- a/components/gcm_driver/crypto/gcm_key_store.h
+++ b/components/gcm_driver/crypto/gcm_key_store.h
@@ -6,6 +6,7 @@
#define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -13,7 +14,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 "components/gcm_driver/crypto/proto/gcm_encryption_data.pb.h"
#include "components/gcm_driver/gcm_delayed_task_controller.h"
@@ -64,7 +64,7 @@
void DidInitialize(bool success);
void DidLoadKeys(bool success,
- scoped_ptr<std::vector<EncryptionData>> entries);
+ std::unique_ptr<std::vector<EncryptionData>> entries);
void DidStoreKeys(const std::string& app_id,
const KeyPair& pair,
@@ -93,7 +93,7 @@
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
// Instance of the ProtoDatabase backing the key store.
- scoped_ptr<leveldb_proto::ProtoDatabase<EncryptionData>> database_;
+ std::unique_ptr<leveldb_proto::ProtoDatabase<EncryptionData>> database_;
enum class State;
diff --git a/components/gcm_driver/crypto/gcm_key_store_unittest.cc b/components/gcm_driver/crypto/gcm_key_store_unittest.cc
index b596293..067bad4 100644
--- a/components/gcm_driver/crypto/gcm_key_store_unittest.cc
+++ b/components/gcm_driver/crypto/gcm_key_store_unittest.cc
@@ -62,7 +62,7 @@
base::ScopedTempDir scoped_temp_dir_;
base::HistogramTester histogram_tester_;
- scoped_ptr<GCMKeyStore> gcm_key_store_;
+ std::unique_ptr<GCMKeyStore> gcm_key_store_;
};
TEST_F(GCMKeyStoreTest, EmptyByDefault) {
diff --git a/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc b/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc
index 15aeb95..2dad624 100644
--- a/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc
+++ b/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc
@@ -6,9 +6,10 @@
#include <stddef.h>
+#include <memory>
+
#include "base/base64url.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
#include "components/gcm_driver/crypto/p256_key_util.h"
#include "crypto/random.h"
@@ -122,7 +123,7 @@
class GCMMessageCryptographerTest : public ::testing::Test {
public:
void SetUp() override {
- scoped_ptr<crypto::SymmetricKey> random_key(
+ std::unique_ptr<crypto::SymmetricKey> random_key(
crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES,
kKeySizeBits));
@@ -159,7 +160,7 @@
base::StringPiece key() const { return key_; }
private:
- scoped_ptr<GCMMessageCryptographer> cryptographer_;
+ std::unique_ptr<GCMMessageCryptographer> cryptographer_;
std::string key_;
};
@@ -425,11 +426,11 @@
// Creates a new cryptographer based on the P-256 curve with the given public
// keys of the sender and receiver, and optionally, the authentication secret.
// The public keys must be given as uncompressed P-256 EC points.
- void CreateCryptographer(const char* encoded_receiver_public_key,
- const char* encoded_sender_public_key,
- const char* encoded_auth_secret,
- scoped_ptr<GCMMessageCryptographer>* cryptographer)
- const {
+ void CreateCryptographer(
+ const char* encoded_receiver_public_key,
+ const char* encoded_sender_public_key,
+ const char* encoded_auth_secret,
+ std::unique_ptr<GCMMessageCryptographer>* cryptographer) const {
std::string receiver_public_key, sender_public_key, auth_secret;
ASSERT_TRUE(base::Base64UrlDecode(
encoded_receiver_public_key,
@@ -444,7 +445,7 @@
base::Base64UrlDecodePolicy::IGNORE_PADDING, &auth_secret));
}
- scoped_ptr<GCMMessageCryptographer> instance(
+ std::unique_ptr<GCMMessageCryptographer> instance(
new GCMMessageCryptographer(GCMMessageCryptographer::Label::P256,
receiver_public_key, sender_public_key,
auth_secret));
@@ -506,7 +507,7 @@
ASSERT_GT(sender_shared_secret.size(), 0u);
ASSERT_EQ(sender_shared_secret, receiver_shared_secret);
- scoped_ptr<GCMMessageCryptographer> cryptographer;
+ std::unique_ptr<GCMMessageCryptographer> cryptographer;
ASSERT_NO_FATAL_FAILURE(CreateCryptographer(
kReceiverPublicUncompressed, kSenderPublicUncompressed, kAuthSecret,
&cryptographer));
@@ -579,7 +580,7 @@
ASSERT_GT(sender_shared_secret.size(), 0u);
ASSERT_EQ(sender_shared_secret, receiver_shared_secret);
- scoped_ptr<GCMMessageCryptographer> cryptographer;
+ std::unique_ptr<GCMMessageCryptographer> cryptographer;
ASSERT_NO_FATAL_FAILURE(CreateCryptographer(
kReceiverPublicUncompressed, kSenderPublicUncompressed,
nullptr /* auth_secret */, &cryptographer));
diff --git a/components/gcm_driver/crypto/p256_key_util.cc b/components/gcm_driver/crypto/p256_key_util.cc
index 47de029..24e8da5 100644
--- a/components/gcm_driver/crypto/p256_key_util.cc
+++ b/components/gcm_driver/crypto/p256_key_util.cc
@@ -6,10 +6,11 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <memory>
#include <vector>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "crypto/ec_private_key.h"
namespace gcm {
@@ -34,7 +35,8 @@
DCHECK(out_private_key);
DCHECK(out_public_key);
- scoped_ptr<crypto::ECPrivateKey> key_pair(crypto::ECPrivateKey::Create());
+ std::unique_ptr<crypto::ECPrivateKey> key_pair(
+ crypto::ECPrivateKey::Create());
if (!key_pair.get()) {
DLOG(ERROR) << "Unable to generate a new P-256 key pair.";
return false;
diff --git a/components/gcm_driver/crypto/p256_key_util_openssl.cc b/components/gcm_driver/crypto/p256_key_util_openssl.cc
index 16f848ee..6a48be16 100644
--- a/components/gcm_driver/crypto/p256_key_util_openssl.cc
+++ b/components/gcm_driver/crypto/p256_key_util_openssl.cc
@@ -2,18 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/gcm_driver/crypto/p256_key_util.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
#include <openssl/ec.h>
#include <openssl/ecdh.h>
#include <openssl/evp.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <memory>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
+#include "components/gcm_driver/crypto/p256_key_util.h"
#include "crypto/ec_private_key.h"
#include "crypto/scoped_openssl_types.h"
@@ -32,11 +31,11 @@
std::string* out_shared_secret) {
DCHECK(out_shared_secret);
- scoped_ptr<crypto::ECPrivateKey> local_key_pair(
+ std::unique_ptr<crypto::ECPrivateKey> local_key_pair(
crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
"" /* no password */,
- std::vector<uint8_t>(
- private_key.data(), private_key.data() + private_key.size()),
+ std::vector<uint8_t>(private_key.data(),
+ private_key.data() + private_key.size()),
std::vector<uint8_t>(
public_key_x509.data(),
public_key_x509.data() + public_key_x509.size())));
diff --git a/components/gcm_driver/fake_gcm_app_handler.h b/components/gcm_driver/fake_gcm_app_handler.h
index 69d5b201..6f66e259 100644
--- a/components/gcm_driver/fake_gcm_app_handler.h
+++ b/components/gcm_driver/fake_gcm_app_handler.h
@@ -5,9 +5,10 @@
#ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_
#define COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/gcm_driver/gcm_app_handler.h"
namespace base {
@@ -52,7 +53,7 @@
private:
void ClearResults();
- scoped_ptr<base::RunLoop> run_loop_;
+ std::unique_ptr<base::RunLoop> run_loop_;
Event received_event_;
std::string app_id_;
diff --git a/components/gcm_driver/fake_gcm_client.cc b/components/gcm_driver/fake_gcm_client.cc
index ef2acf05..e0cb8a7 100644
--- a/components/gcm_driver/fake_gcm_client.cc
+++ b/components/gcm_driver/fake_gcm_client.cc
@@ -78,7 +78,7 @@
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
const scoped_refptr<net::URLRequestContextGetter>&
url_request_context_getter,
- scoped_ptr<Encryptor> encryptor,
+ std::unique_ptr<Encryptor> encryptor,
Delegate* delegate) {
delegate_ = delegate;
}
@@ -194,8 +194,7 @@
void FakeGCMClient::SetLastTokenFetchTime(const base::Time& time) {
}
-void FakeGCMClient::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) {
-}
+void FakeGCMClient::UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer) {}
void FakeGCMClient::AddInstanceIDData(const std::string& app_id,
const std::string& instance_id,
diff --git a/components/gcm_driver/fake_gcm_client.h b/components/gcm_driver/fake_gcm_client.h
index badaffd..4ba1114 100644
--- a/components/gcm_driver/fake_gcm_client.h
+++ b/components/gcm_driver/fake_gcm_client.h
@@ -48,7 +48,7 @@
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
const scoped_refptr<net::URLRequestContextGetter>&
url_request_context_getter,
- scoped_ptr<Encryptor> encryptor,
+ std::unique_ptr<Encryptor> encryptor,
Delegate* delegate) override;
void Start(StartMode start_mode) override;
void Stop() override;
@@ -69,7 +69,7 @@
void UpdateAccountMapping(const AccountMapping& account_mapping) override;
void RemoveAccountMapping(const std::string& account_id) override;
void SetLastTokenFetchTime(const base::Time& time) override;
- void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) override;
+ void UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer) override;
void AddInstanceIDData(const std::string& app_id,
const std::string& instance_id,
const std::string& extra_data) override;
diff --git a/components/gcm_driver/fake_gcm_client_factory.cc b/components/gcm_driver/fake_gcm_client_factory.cc
index d14fc84..70eccef 100644
--- a/components/gcm_driver/fake_gcm_client_factory.cc
+++ b/components/gcm_driver/fake_gcm_client_factory.cc
@@ -4,7 +4,8 @@
#include "components/gcm_driver/fake_gcm_client_factory.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/sequenced_task_runner.h"
#include "components/gcm_driver/gcm_client.h"
@@ -20,8 +21,8 @@
FakeGCMClientFactory::~FakeGCMClientFactory() {
}
-scoped_ptr<GCMClient> FakeGCMClientFactory::BuildInstance() {
- return scoped_ptr<GCMClient>(new FakeGCMClient(ui_thread_, io_thread_));
+std::unique_ptr<GCMClient> FakeGCMClientFactory::BuildInstance() {
+ return std::unique_ptr<GCMClient>(new FakeGCMClient(ui_thread_, io_thread_));
}
} // namespace gcm
diff --git a/components/gcm_driver/fake_gcm_client_factory.h b/components/gcm_driver/fake_gcm_client_factory.h
index e70e48a..4ab893d 100644
--- a/components/gcm_driver/fake_gcm_client_factory.h
+++ b/components/gcm_driver/fake_gcm_client_factory.h
@@ -26,7 +26,7 @@
~FakeGCMClientFactory() override;
// GCMClientFactory:
- scoped_ptr<GCMClient> BuildInstance() override;
+ std::unique_ptr<GCMClient> BuildInstance() override;
private:
scoped_refptr<base::SequencedTaskRunner> ui_thread_;
diff --git a/components/gcm_driver/gcm_account_mapper.cc b/components/gcm_driver/gcm_account_mapper.cc
index e764cb2..db81c3ae 100644
--- a/components/gcm_driver/gcm_account_mapper.cc
+++ b/components/gcm_driver/gcm_account_mapper.cc
@@ -386,7 +386,7 @@
return accounts_.end();
}
-void GCMAccountMapper::SetClockForTesting(scoped_ptr<base::Clock> clock) {
+void GCMAccountMapper::SetClockForTesting(std::unique_ptr<base::Clock> clock) {
clock_ = std::move(clock);
}
diff --git a/components/gcm_driver/gcm_account_mapper.h b/components/gcm_driver/gcm_account_mapper.h
index 45ece23..a8cb9d7 100644
--- a/components/gcm_driver/gcm_account_mapper.h
+++ b/components/gcm_driver/gcm_account_mapper.h
@@ -5,12 +5,12 @@
#ifndef COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_
#define COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_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 "components/gcm_driver/gcm_app_handler.h"
#include "components/gcm_driver/gcm_client.h"
@@ -102,7 +102,7 @@
const std::string& message_id);
// Sets the clock for testing.
- void SetClockForTesting(scoped_ptr<base::Clock> clock);
+ void SetClockForTesting(std::unique_ptr<base::Clock> clock);
// GCMDriver owns GCMAccountMapper.
GCMDriver* gcm_driver_;
@@ -111,7 +111,7 @@
DispatchMessageCallback dispatch_message_callback_;
// Clock for timestamping status changes.
- scoped_ptr<base::Clock> clock_;
+ std::unique_ptr<base::Clock> clock_;
// Currnetly tracked account mappings.
AccountMappings accounts_;
diff --git a/components/gcm_driver/gcm_account_mapper_unittest.cc b/components/gcm_driver/gcm_account_mapper_unittest.cc
index a617d6c..e9013e5 100644
--- a/components/gcm_driver/gcm_account_mapper_unittest.cc
+++ b/components/gcm_driver/gcm_account_mapper_unittest.cc
@@ -263,7 +263,7 @@
private:
CustomFakeGCMDriver gcm_driver_;
- scoped_ptr<GCMAccountMapper> account_mapper_;
+ std::unique_ptr<GCMAccountMapper> account_mapper_;
base::SimpleTestClock* clock_;
std::string last_received_app_id_;
IncomingMessage last_received_message_;
@@ -281,7 +281,7 @@
account_mapper_->ShutdownHandler();
gcm_driver_.RemoveAppHandler(kGCMAccountMapperAppId);
account_mapper_.reset(new GCMAccountMapper(&gcm_driver_));
- scoped_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock);
+ std::unique_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock);
clock_ = clock.get();
account_mapper_->SetClockForTesting(std::move(clock));
}
diff --git a/components/gcm_driver/gcm_account_tracker.cc b/components/gcm_driver/gcm_account_tracker.cc
index 06c08666..ab5708e9 100644
--- a/components/gcm_driver/gcm_account_tracker.cc
+++ b/components/gcm_driver/gcm_account_tracker.cc
@@ -45,14 +45,13 @@
}
GCMAccountTracker::GCMAccountTracker(
- scoped_ptr<gaia::AccountTracker> account_tracker,
+ std::unique_ptr<gaia::AccountTracker> account_tracker,
GCMDriver* driver)
: OAuth2TokenService::Consumer(kGCMAccountTrackerName),
account_tracker_(account_tracker.release()),
driver_(driver),
shutdown_called_(false),
- reporting_weak_ptr_factory_(this) {
-}
+ reporting_weak_ptr_factory_(this) {}
GCMAccountTracker::~GCMAccountTracker() {
DCHECK(shutdown_called_);
@@ -339,7 +338,7 @@
OAuth2TokenService::ScopeSet scopes;
scopes.insert(kGCMGroupServerScope);
scopes.insert(kGCMCheckinServerScope);
- scoped_ptr<OAuth2TokenService::Request> request =
+ std::unique_ptr<OAuth2TokenService::Request> request =
GetTokenService()->StartRequest(account_iter->first, scopes, this);
pending_token_requests_.push_back(request.release());
diff --git a/components/gcm_driver/gcm_account_tracker.h b/components/gcm_driver/gcm_account_tracker.h
index 3e2ff02..5535014 100644
--- a/components/gcm_driver/gcm_account_tracker.h
+++ b/components/gcm_driver/gcm_account_tracker.h
@@ -70,7 +70,7 @@
// |account_tracker| is used to deliver information about the accounts present
// in the browser context to |driver|.
- GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker,
+ GCMAccountTracker(std::unique_ptr<gaia::AccountTracker> account_tracker,
GCMDriver* driver);
~GCMAccountTracker() override;
@@ -143,7 +143,7 @@
OAuth2TokenService* GetTokenService();
// Account tracker.
- scoped_ptr<gaia::AccountTracker> account_tracker_;
+ std::unique_ptr<gaia::AccountTracker> account_tracker_;
// GCM Driver. Not owned.
GCMDriver* driver_;
diff --git a/components/gcm_driver/gcm_account_tracker_unittest.cc b/components/gcm_driver/gcm_account_tracker_unittest.cc
index 0677fbcb..ea982af 100644
--- a/components/gcm_driver/gcm_account_tracker_unittest.cc
+++ b/components/gcm_driver/gcm_account_tracker_unittest.cc
@@ -5,11 +5,11 @@
#include "components/gcm_driver/gcm_account_tracker.h"
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/gcm_driver/fake_gcm_driver.h"
#include "google_apis/gaia/fake_identity_provider.h"
#include "google_apis/gaia/fake_oauth2_token_service.h"
@@ -187,9 +187,9 @@
base::MessageLoop message_loop_;
net::TestURLFetcherFactory test_fetcher_factory_;
- scoped_ptr<FakeOAuth2TokenService> fake_token_service_;
- scoped_ptr<FakeIdentityProvider> fake_identity_provider_;
- scoped_ptr<GCMAccountTracker> tracker_;
+ std::unique_ptr<FakeOAuth2TokenService> fake_token_service_;
+ std::unique_ptr<FakeIdentityProvider> fake_identity_provider_;
+ std::unique_ptr<GCMAccountTracker> tracker_;
};
GCMAccountTrackerTest::GCMAccountTrackerTest() {
@@ -198,7 +198,7 @@
fake_identity_provider_.reset(
new FakeIdentityProvider(fake_token_service_.get()));
- scoped_ptr<gaia::AccountTracker> gaia_account_tracker(
+ std::unique_ptr<gaia::AccountTracker> gaia_account_tracker(
new gaia::AccountTracker(
fake_identity_provider_.get(),
new net::TestURLRequestContextGetter(message_loop_.task_runner())));
diff --git a/components/gcm_driver/gcm_channel_status_request.h b/components/gcm_driver/gcm_channel_status_request.h
index 1be074f..d68899a9 100644
--- a/components/gcm_driver/gcm_channel_status_request.h
+++ b/components/gcm_driver/gcm_channel_status_request.h
@@ -5,12 +5,13 @@
#ifndef COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_
#define COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_REQUEST_H_
+#include <memory>
+
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "net/base/backoff_entry.h"
#include "net/url_request/url_fetcher_delegate.h"
@@ -62,7 +63,7 @@
const std::string channel_status_request_url_;
const std::string user_agent_;
GCMChannelStatusRequestCallback callback_;
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
net::BackoffEntry backoff_entry_;
base::WeakPtrFactory<GCMChannelStatusRequest> weak_ptr_factory_;
diff --git a/components/gcm_driver/gcm_channel_status_request_unittest.cc b/components/gcm_driver/gcm_channel_status_request_unittest.cc
index 3190345..494c8ce 100644
--- a/components/gcm_driver/gcm_channel_status_request_unittest.cc
+++ b/components/gcm_driver/gcm_channel_status_request_unittest.cc
@@ -34,7 +34,7 @@
bool enabled,
int poll_interval_seconds);
- scoped_ptr<GCMChannelStatusRequest> request_;
+ std::unique_ptr<GCMChannelStatusRequest> request_;
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
base::ThreadTaskRunnerHandle task_runner_handle_;
net::TestURLFetcherFactory url_fetcher_factory_;
diff --git a/components/gcm_driver/gcm_channel_status_syncer.h b/components/gcm_driver/gcm_channel_status_syncer.h
index e9fd7e3..b0d1dee 100644
--- a/components/gcm_driver/gcm_channel_status_syncer.h
+++ b/components/gcm_driver/gcm_channel_status_syncer.h
@@ -5,10 +5,11 @@
#ifndef COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_H_
#define COMPONENTS_GCM_DRIVER_GCM_CHANNEL_STATUS_SYNCER_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 "base/memory/weak_ptr.h"
#include "base/time/time.h"
@@ -85,7 +86,7 @@
const std::string user_agent_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
- scoped_ptr<GCMChannelStatusRequest> request_;
+ std::unique_ptr<GCMChannelStatusRequest> request_;
bool started_;
bool gcm_enabled_;
diff --git a/components/gcm_driver/gcm_client.h b/components/gcm_driver/gcm_client.h
index c7f0aa95..add4dea 100644
--- a/components/gcm_driver/gcm_client.h
+++ b/components/gcm_driver/gcm_client.h
@@ -8,11 +8,11 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "components/gcm_driver/common/gcm_messages.h"
#include "components/gcm_driver/crypto/gcm_encryption_provider.h"
#include "components/gcm_driver/gcm_activity.h"
@@ -231,7 +231,7 @@
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
const scoped_refptr<net::URLRequestContextGetter>&
url_request_context_getter,
- scoped_ptr<Encryptor> encryptor,
+ std::unique_ptr<Encryptor> encryptor,
Delegate* delegate) = 0;
// This will initiate the GCM connection only if |start_mode| means to start
@@ -302,7 +302,7 @@
virtual void SetLastTokenFetchTime(const base::Time& time) = 0;
// Updates the timer used by the HeartbeatManager for sending heartbeats.
- virtual void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) = 0;
+ virtual void UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer) = 0;
// Adds the Instance ID data for a specific app to the persistent store.
virtual void AddInstanceIDData(const std::string& app_id,
diff --git a/components/gcm_driver/gcm_client_factory.cc b/components/gcm_driver/gcm_client_factory.cc
index e09f8b4c..9ef8ad4 100644
--- a/components/gcm_driver/gcm_client_factory.cc
+++ b/components/gcm_driver/gcm_client_factory.cc
@@ -4,13 +4,14 @@
#include "components/gcm_driver/gcm_client_factory.h"
+#include "base/memory/ptr_util.h"
#include "components/gcm_driver/gcm_client_impl.h"
namespace gcm {
-scoped_ptr<GCMClient> GCMClientFactory::BuildInstance() {
- return scoped_ptr<GCMClient>(new GCMClientImpl(
- make_scoped_ptr<GCMInternalsBuilder>(new GCMInternalsBuilder())));
+std::unique_ptr<GCMClient> GCMClientFactory::BuildInstance() {
+ return std::unique_ptr<GCMClient>(new GCMClientImpl(
+ base::WrapUnique<GCMInternalsBuilder>(new GCMInternalsBuilder())));
}
GCMClientFactory::GCMClientFactory() {
diff --git a/components/gcm_driver/gcm_client_factory.h b/components/gcm_driver/gcm_client_factory.h
index 033257cd..963b863 100644
--- a/components/gcm_driver/gcm_client_factory.h
+++ b/components/gcm_driver/gcm_client_factory.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_FACTORY_H_
#define COMPONENTS_GCM_DRIVER_GCM_CLIENT_FACTORY_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
namespace gcm {
@@ -19,7 +20,7 @@
// Creates a new instance of GCMClient. The testing code could override this
// to provide a mocked instance.
- virtual scoped_ptr<GCMClient> BuildInstance();
+ virtual std::unique_ptr<GCMClient> BuildInstance();
private:
DISALLOW_COPY_AND_ASSIGN(GCMClientFactory);
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc
index 7d92f0a9a..bdca90b 100644
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -5,13 +5,15 @@
#include "components/gcm_driver/gcm_client_impl.h"
#include <stddef.h>
+
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
@@ -241,33 +243,29 @@
GCMInternalsBuilder::GCMInternalsBuilder() {}
GCMInternalsBuilder::~GCMInternalsBuilder() {}
-scoped_ptr<base::Clock> GCMInternalsBuilder::BuildClock() {
- return make_scoped_ptr<base::Clock>(new base::DefaultClock());
+std::unique_ptr<base::Clock> GCMInternalsBuilder::BuildClock() {
+ return base::WrapUnique<base::Clock>(new base::DefaultClock());
}
-scoped_ptr<MCSClient> GCMInternalsBuilder::BuildMCSClient(
+std::unique_ptr<MCSClient> GCMInternalsBuilder::BuildMCSClient(
const std::string& version,
base::Clock* clock,
ConnectionFactory* connection_factory,
GCMStore* gcm_store,
GCMStatsRecorder* recorder) {
- return scoped_ptr<MCSClient>(new MCSClient(
- version, clock, connection_factory, gcm_store, recorder));
+ return std::unique_ptr<MCSClient>(
+ new MCSClient(version, clock, connection_factory, gcm_store, recorder));
}
-scoped_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory(
- const std::vector<GURL>& endpoints,
- const net::BackoffEntry::Policy& backoff_policy,
- net::HttpNetworkSession* gcm_network_session,
- net::HttpNetworkSession* http_network_session,
- GCMStatsRecorder* recorder) {
- return make_scoped_ptr<ConnectionFactory>(
- new ConnectionFactoryImpl(endpoints,
- backoff_policy,
- gcm_network_session,
- http_network_session,
- nullptr,
- recorder));
+std::unique_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory(
+ const std::vector<GURL>& endpoints,
+ const net::BackoffEntry::Policy& backoff_policy,
+ net::HttpNetworkSession* gcm_network_session,
+ net::HttpNetworkSession* http_network_session,
+ GCMStatsRecorder* recorder) {
+ return base::WrapUnique<ConnectionFactory>(
+ new ConnectionFactoryImpl(endpoints, backoff_policy, gcm_network_session,
+ http_network_session, nullptr, recorder));
}
GCMClientImpl::CheckinInfo::CheckinInfo()
@@ -295,7 +293,8 @@
last_checkin_accounts.clear();
}
-GCMClientImpl::GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder)
+GCMClientImpl::GCMClientImpl(
+ std::unique_ptr<GCMInternalsBuilder> internals_builder)
: internals_builder_(std::move(internals_builder)),
state_(UNINITIALIZED),
delegate_(NULL),
@@ -316,7 +315,7 @@
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
const scoped_refptr<net::URLRequestContextGetter>&
url_request_context_getter,
- scoped_ptr<Encryptor> encryptor,
+ std::unique_ptr<Encryptor> encryptor,
GCMClient::Delegate* delegate) {
DCHECK_EQ(UNINITIALIZED, state_);
DCHECK(url_request_context_getter.get());
@@ -377,7 +376,8 @@
state_ = LOADING;
}
-void GCMClientImpl::OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result) {
+void GCMClientImpl::OnLoadCompleted(
+ std::unique_ptr<GCMStore::LoadResult> result) {
DCHECK_EQ(LOADING, state_);
if (!result->success) {
@@ -419,9 +419,9 @@
iter != result->registrations.end();
++iter) {
std::string registration_id;
- scoped_ptr<RegistrationInfo> registration =
- RegistrationInfo::BuildFromString(
- iter->first, iter->second, ®istration_id);
+ std::unique_ptr<RegistrationInfo> registration =
+ RegistrationInfo::BuildFromString(iter->first, iter->second,
+ ®istration_id);
// TODO(jianli): Add UMA to track the error case.
if (registration.get())
registrations_[make_linked_ptr(registration.release())] = registration_id;
@@ -629,7 +629,7 @@
weak_ptr_factory_.GetWeakPtr()));
}
-void GCMClientImpl::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) {
+void GCMClientImpl::UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer) {
DCHECK(mcs_client_);
mcs_client_->UpdateHeartbeatTimer(std::move(timer));
}
@@ -879,7 +879,7 @@
}
}
- scoped_ptr<RegistrationRequest::CustomRequestHandler> request_handler;
+ std::unique_ptr<RegistrationRequest::CustomRequestHandler> request_handler;
std::string source_to_record;
const GCMRegistrationInfo* gcm_registration_info =
@@ -921,13 +921,14 @@
device_checkin_info_.secret,
registration_info->app_id);
- scoped_ptr<RegistrationRequest> registration_request(new RegistrationRequest(
- gservices_settings_.GetRegistrationURL(), request_info,
- std::move(request_handler), GetGCMBackoffPolicy(),
- base::Bind(&GCMClientImpl::OnRegisterCompleted,
- weak_ptr_factory_.GetWeakPtr(), registration_info),
- kMaxRegistrationRetries, url_request_context_getter_, &recorder_,
- source_to_record));
+ std::unique_ptr<RegistrationRequest> registration_request(
+ new RegistrationRequest(
+ gservices_settings_.GetRegistrationURL(), request_info,
+ std::move(request_handler), GetGCMBackoffPolicy(),
+ base::Bind(&GCMClientImpl::OnRegisterCompleted,
+ weak_ptr_factory_.GetWeakPtr(), registration_info),
+ kMaxRegistrationRetries, url_request_context_getter_, &recorder_,
+ source_to_record));
registration_request->Start();
pending_registration_requests_.insert(
std::make_pair(registration_info, std::move(registration_request)));
@@ -981,7 +982,7 @@
const linked_ptr<RegistrationInfo>& registration_info) {
DCHECK_EQ(state_, READY);
- scoped_ptr<UnregistrationRequest::CustomRequestHandler> request_handler;
+ std::unique_ptr<UnregistrationRequest::CustomRequestHandler> request_handler;
std::string source_to_record;
const GCMRegistrationInfo* gcm_registration_info =
@@ -1061,7 +1062,7 @@
device_checkin_info_.secret,
registration_info->app_id);
- scoped_ptr<UnregistrationRequest> unregistration_request(
+ std::unique_ptr<UnregistrationRequest> unregistration_request(
new UnregistrationRequest(
gservices_settings_.GetRegistrationURL(), request_info,
std::move(request_handler), GetGCMBackoffPolicy(),
@@ -1309,7 +1310,8 @@
bool registered = false;
// First, find among all GCM registrations.
- scoped_ptr<GCMRegistrationInfo> gcm_registration(new GCMRegistrationInfo);
+ std::unique_ptr<GCMRegistrationInfo> gcm_registration(
+ new GCMRegistrationInfo);
gcm_registration->app_id = app_id;
auto gcm_registration_iter = registrations_.find(
make_linked_ptr<RegistrationInfo>(gcm_registration.release()));
@@ -1327,7 +1329,8 @@
// Then, find among all InstanceID registrations.
if (!registered) {
- scoped_ptr<InstanceIDTokenInfo> instance_id_token(new InstanceIDTokenInfo);
+ std::unique_ptr<InstanceIDTokenInfo> instance_id_token(
+ new InstanceIDTokenInfo);
instance_id_token->app_id = app_id;
instance_id_token->authorized_entity = sender;
instance_id_token->scope = kGCMScope;
diff --git a/components/gcm_driver/gcm_client_impl.h b/components/gcm_driver/gcm_client_impl.h
index e7d33d0..f4cc121 100644
--- a/components/gcm_driver/gcm_client_impl.h
+++ b/components/gcm_driver/gcm_client_impl.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -16,7 +17,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_stats_recorder_impl.h"
@@ -58,14 +58,14 @@
GCMInternalsBuilder();
virtual ~GCMInternalsBuilder();
- virtual scoped_ptr<base::Clock> BuildClock();
- virtual scoped_ptr<MCSClient> BuildMCSClient(
+ virtual std::unique_ptr<base::Clock> BuildClock();
+ virtual std::unique_ptr<MCSClient> BuildMCSClient(
const std::string& version,
base::Clock* clock,
ConnectionFactory* connection_factory,
GCMStore* gcm_store,
GCMStatsRecorder* recorder);
- virtual scoped_ptr<ConnectionFactory> BuildConnectionFactory(
+ virtual std::unique_ptr<ConnectionFactory> BuildConnectionFactory(
const std::vector<GURL>& endpoints,
const net::BackoffEntry::Policy& backoff_policy,
net::HttpNetworkSession* gcm_network_session,
@@ -99,7 +99,8 @@
READY,
};
- explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder);
+ explicit GCMClientImpl(
+ std::unique_ptr<GCMInternalsBuilder> internals_builder);
~GCMClientImpl() override;
// GCMClient implementation.
@@ -109,7 +110,7 @@
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
const scoped_refptr<net::URLRequestContextGetter>&
url_request_context_getter,
- scoped_ptr<Encryptor> encryptor,
+ std::unique_ptr<Encryptor> encryptor,
GCMClient::Delegate* delegate) override;
void Start(StartMode start_mode) override;
void Stop() override;
@@ -130,7 +131,7 @@
void UpdateAccountMapping(const AccountMapping& account_mapping) override;
void RemoveAccountMapping(const std::string& account_id) override;
void SetLastTokenFetchTime(const base::Time& time) override;
- void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) override;
+ void UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer) override;
void AddInstanceIDData(const std::string& app_id,
const std::string& instance_id,
const std::string& extra_data) override;
@@ -176,16 +177,17 @@
// Collection of pending registration requests. Keys are RegistrationInfo
// instance, while values are pending registration requests to obtain a
// registration ID for requesting application.
- using PendingRegistrationRequests = std::map<linked_ptr<RegistrationInfo>,
- scoped_ptr<RegistrationRequest>,
- RegistrationInfoComparer>;
+ using PendingRegistrationRequests =
+ std::map<linked_ptr<RegistrationInfo>,
+ std::unique_ptr<RegistrationRequest>,
+ RegistrationInfoComparer>;
// Collection of pending unregistration requests. Keys are RegistrationInfo
// instance, while values are pending unregistration requests to disable the
// registration ID currently assigned to the application.
using PendingUnregistrationRequests =
std::map<linked_ptr<RegistrationInfo>,
- scoped_ptr<UnregistrationRequest>,
+ std::unique_ptr<UnregistrationRequest>,
RegistrationInfoComparer>;
friend class GCMClientImplTest;
@@ -207,7 +209,7 @@
// Runs after GCM Store load is done to trigger continuation of the
// initialization.
- void OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result);
+ void OnLoadCompleted(std::unique_ptr<GCMStore::LoadResult> result);
// Starts the GCM.
void StartGCM();
// Initializes mcs_client_, which handles the connection to MCS.
@@ -300,7 +302,7 @@
void ResetCache();
// Builder for the GCM internals (mcs client, etc.).
- scoped_ptr<GCMInternalsBuilder> internals_builder_;
+ std::unique_ptr<GCMInternalsBuilder> internals_builder_;
// Recorder that logs GCM activities.
GCMStatsRecorderImpl recorder_;
@@ -321,7 +323,7 @@
// Clock used for timing of retry logic. Passed in for testing. Owned by
// GCMClientImpl.
- scoped_ptr<base::Clock> clock_;
+ std::unique_ptr<base::Clock> clock_;
// Information about the chrome build.
// TODO(fgorski): Check if it can be passed in constructor and made const.
@@ -329,24 +331,24 @@
// Persistent data store for keeping device credentials, messages and user to
// serial number mappings.
- scoped_ptr<GCMStore> gcm_store_;
+ std::unique_ptr<GCMStore> gcm_store_;
// Data loaded from the GCM store.
- scoped_ptr<GCMStore::LoadResult> load_result_;
+ std::unique_ptr<GCMStore::LoadResult> load_result_;
// Tracks if the GCM store has been reset. This is used to prevent from
// resetting and loading from the store again and again.
bool gcm_store_reset_;
- scoped_ptr<net::HttpNetworkSession> network_session_;
- scoped_ptr<ConnectionFactory> connection_factory_;
+ std::unique_ptr<net::HttpNetworkSession> network_session_;
+ std::unique_ptr<ConnectionFactory> connection_factory_;
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
// Controls receiving and sending of packets and reliable message queueing.
// Must be destroyed before |network_session_|.
- scoped_ptr<MCSClient> mcs_client_;
+ std::unique_ptr<MCSClient> mcs_client_;
- scoped_ptr<CheckinRequest> checkin_request_;
+ std::unique_ptr<CheckinRequest> checkin_request_;
// Cached registration info.
RegistrationInfoMap registrations_;
diff --git a/components/gcm_driver/gcm_client_impl_unittest.cc b/components/gcm_driver/gcm_client_impl_unittest.cc
index 232ff36..e6510b1d 100644
--- a/components/gcm_driver/gcm_client_impl_unittest.cc
+++ b/components/gcm_driver/gcm_client_impl_unittest.cc
@@ -6,12 +6,14 @@
#include <stdint.h>
+#include <memory>
+
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/thread_task_runner_handle.h"
@@ -194,13 +196,14 @@
FakeGCMInternalsBuilder(base::TimeDelta clock_step);
~FakeGCMInternalsBuilder() override;
- scoped_ptr<base::Clock> BuildClock() override;
- scoped_ptr<MCSClient> BuildMCSClient(const std::string& version,
- base::Clock* clock,
- ConnectionFactory* connection_factory,
- GCMStore* gcm_store,
- GCMStatsRecorder* recorder) override;
- scoped_ptr<ConnectionFactory> BuildConnectionFactory(
+ std::unique_ptr<base::Clock> BuildClock() override;
+ std::unique_ptr<MCSClient> BuildMCSClient(
+ const std::string& version,
+ base::Clock* clock,
+ ConnectionFactory* connection_factory,
+ GCMStore* gcm_store,
+ GCMStatsRecorder* recorder) override;
+ std::unique_ptr<ConnectionFactory> BuildConnectionFactory(
const std::vector<GURL>& endpoints,
const net::BackoffEntry::Policy& backoff_policy,
net::HttpNetworkSession* gcm_network_session,
@@ -217,29 +220,28 @@
FakeGCMInternalsBuilder::~FakeGCMInternalsBuilder() {}
-scoped_ptr<base::Clock> FakeGCMInternalsBuilder::BuildClock() {
- return make_scoped_ptr<base::Clock>(new AutoAdvancingTestClock(clock_step_));
+std::unique_ptr<base::Clock> FakeGCMInternalsBuilder::BuildClock() {
+ return base::WrapUnique<base::Clock>(new AutoAdvancingTestClock(clock_step_));
}
-scoped_ptr<MCSClient> FakeGCMInternalsBuilder::BuildMCSClient(
+std::unique_ptr<MCSClient> FakeGCMInternalsBuilder::BuildMCSClient(
const std::string& version,
base::Clock* clock,
ConnectionFactory* connection_factory,
GCMStore* gcm_store,
GCMStatsRecorder* recorder) {
- return make_scoped_ptr<MCSClient>(new FakeMCSClient(clock,
- connection_factory,
- gcm_store,
- recorder));
+ return base::WrapUnique<MCSClient>(
+ new FakeMCSClient(clock, connection_factory, gcm_store, recorder));
}
-scoped_ptr<ConnectionFactory> FakeGCMInternalsBuilder::BuildConnectionFactory(
+std::unique_ptr<ConnectionFactory>
+FakeGCMInternalsBuilder::BuildConnectionFactory(
const std::vector<GURL>& endpoints,
const net::BackoffEntry::Policy& backoff_policy,
net::HttpNetworkSession* gcm_network_session,
net::HttpNetworkSession* http_network_session,
GCMStatsRecorder* recorder) {
- return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory());
+ return base::WrapUnique<ConnectionFactory>(new FakeConnectionFactory());
}
} // namespace
@@ -391,7 +393,7 @@
base::Time last_token_fetch_time_;
std::vector<AccountMapping> last_account_mappings_;
- scoped_ptr<GCMClientImpl> gcm_client_;
+ std::unique_ptr<GCMClientImpl> gcm_client_;
net::TestURLFetcherFactory url_fetcher_factory_;
@@ -439,7 +441,7 @@
}
void GCMClientImplTest::BuildGCMClient(base::TimeDelta clock_step) {
- gcm_client_.reset(new GCMClientImpl(make_scoped_ptr<GCMInternalsBuilder>(
+ gcm_client_.reset(new GCMClientImpl(base::WrapUnique<GCMInternalsBuilder>(
new FakeGCMInternalsBuilder(clock_step))));
}
@@ -530,13 +532,9 @@
// Actual initialization.
GCMClient::ChromeBuildInfo chrome_build_info;
chrome_build_info.version = kChromeVersion;
- gcm_client_->Initialize(
- chrome_build_info,
- gcm_store_path(),
- task_runner_,
- url_request_context_getter_,
- make_scoped_ptr<Encryptor>(new FakeEncryptor),
- this);
+ gcm_client_->Initialize(chrome_build_info, gcm_store_path(), task_runner_,
+ url_request_context_getter_,
+ base::WrapUnique<Encryptor>(new FakeEncryptor), this);
}
void GCMClientImplTest::StartGCMClient() {
@@ -548,14 +546,14 @@
void GCMClientImplTest::Register(const std::string& app_id,
const std::vector<std::string>& senders) {
- scoped_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
+ std::unique_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
gcm_info->app_id = app_id;
gcm_info->sender_ids = senders;
gcm_client()->Register(make_linked_ptr<RegistrationInfo>(gcm_info.release()));
}
void GCMClientImplTest::Unregister(const std::string& app_id) {
- scoped_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
+ std::unique_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
gcm_info->app_id = app_id;
gcm_client()->Unregister(
make_linked_ptr<RegistrationInfo>(gcm_info.release()));
@@ -1438,7 +1436,8 @@
void GCMClientInstanceIDTest::GetToken(const std::string& app_id,
const std::string& authorized_entity,
const std::string& scope) {
- scoped_ptr<InstanceIDTokenInfo> instance_id_info(new InstanceIDTokenInfo);
+ std::unique_ptr<InstanceIDTokenInfo> instance_id_info(
+ new InstanceIDTokenInfo);
instance_id_info->app_id = app_id;
instance_id_info->authorized_entity = authorized_entity;
instance_id_info->scope = scope;
@@ -1449,7 +1448,8 @@
void GCMClientInstanceIDTest::DeleteToken(const std::string& app_id,
const std::string& authorized_entity,
const std::string& scope) {
- scoped_ptr<InstanceIDTokenInfo> instance_id_info(new InstanceIDTokenInfo);
+ std::unique_ptr<InstanceIDTokenInfo> instance_id_info(
+ new InstanceIDTokenInfo);
instance_id_info->app_id = app_id;
instance_id_info->authorized_entity = authorized_entity;
instance_id_info->scope = scope;
@@ -1471,7 +1471,8 @@
bool GCMClientInstanceIDTest::ExistsToken(const std::string& app_id,
const std::string& authorized_entity,
const std::string& scope) const {
- scoped_ptr<InstanceIDTokenInfo> instance_id_info(new InstanceIDTokenInfo);
+ std::unique_ptr<InstanceIDTokenInfo> instance_id_info(
+ new InstanceIDTokenInfo);
instance_id_info->app_id = app_id;
instance_id_info->authorized_entity = authorized_entity;
instance_id_info->scope = scope;
diff --git a/components/gcm_driver/gcm_delayed_task_controller_unittest.cc b/components/gcm_driver/gcm_delayed_task_controller_unittest.cc
index 993ec30d..cb19dcf5 100644
--- a/components/gcm_driver/gcm_delayed_task_controller_unittest.cc
+++ b/components/gcm_driver/gcm_delayed_task_controller_unittest.cc
@@ -4,8 +4,9 @@
#include "components/gcm_driver/gcm_delayed_task_controller.h"
+#include <memory>
+
#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gcm {
@@ -22,7 +23,7 @@
int number_of_triggered_tasks() const { return number_of_triggered_tasks_; }
private:
- scoped_ptr<GCMDelayedTaskController> controller_;
+ std::unique_ptr<GCMDelayedTaskController> controller_;
int number_of_triggered_tasks_;
};
diff --git a/components/gcm_driver/gcm_desktop_utils.cc b/components/gcm_driver/gcm_desktop_utils.cc
index 7e112af..7ee152f2 100644
--- a/components/gcm_driver/gcm_desktop_utils.cc
+++ b/components/gcm_driver/gcm_desktop_utils.cc
@@ -83,8 +83,8 @@
} // namespace
-scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+std::unique_ptr<GCMDriver> CreateGCMDriverDesktop(
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
PrefService* prefs,
const base::FilePath& store_path,
const scoped_refptr<net::URLRequestContextGetter>& request_context,
@@ -92,7 +92,7 @@
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) {
- return scoped_ptr<GCMDriver>(new GCMDriverDesktop(
+ return std::unique_ptr<GCMDriver>(new GCMDriverDesktop(
std::move(gcm_client_factory), GetChromeBuildInfo(channel),
GetChannelStatusRequestUrl(channel), GetUserAgent(channel), prefs,
store_path, request_context, ui_task_runner, io_task_runner,
diff --git a/components/gcm_driver/gcm_desktop_utils.h b/components/gcm_driver/gcm_desktop_utils.h
index b7e62e4..bd8ce48 100644
--- a/components/gcm_driver/gcm_desktop_utils.h
+++ b/components/gcm_driver/gcm_desktop_utils.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_GCM_DRIVER_GCM_GCM_DESKTOP_UTILS_H_
#define COMPONENTS_GCM_DRIVER_GCM_GCM_DESKTOP_UTILS_H_
+#include <memory>
+
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner.h"
#include "components/version_info/version_info.h"
@@ -24,8 +25,8 @@
class GCMDriver;
class GCMClientFactory;
-scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+std::unique_ptr<GCMDriver> CreateGCMDriverDesktop(
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
PrefService* prefs,
const base::FilePath& store_path,
const scoped_refptr<net::URLRequestContextGetter>& request_context,
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc
index 171e4faf..d8f7fafb 100644
--- a/components/gcm_driver/gcm_driver_desktop.cc
+++ b/components/gcm_driver/gcm_driver_desktop.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/profiler/scoped_tracker.h"
#include "base/sequenced_task_runner.h"
@@ -68,7 +69,7 @@
// Called on IO thread.
void Initialize(
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
const GCMClient::ChromeBuildInfo& chrome_build_info,
const base::FilePath& store_path,
const scoped_refptr<net::URLRequestContextGetter>& request_context,
@@ -119,7 +120,7 @@
base::WeakPtr<GCMDriverDesktop> service_;
- scoped_ptr<GCMClient> gcm_client_;
+ std::unique_ptr<GCMClient> gcm_client_;
DISALLOW_COPY_AND_ASSIGN(IOWorker);
};
@@ -137,7 +138,7 @@
}
void GCMDriverDesktop::IOWorker::Initialize(
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
const GCMClient::ChromeBuildInfo& chrome_build_info,
const base::FilePath& store_path,
const scoped_refptr<net::URLRequestContextGetter>& request_context,
@@ -150,12 +151,9 @@
gcm_client_ = gcm_client_factory->BuildInstance();
- gcm_client_->Initialize(chrome_build_info,
- store_path,
- blocking_task_runner,
- request_context,
- make_scoped_ptr<Encryptor>(new SystemEncryptor),
- this);
+ gcm_client_->Initialize(
+ chrome_build_info, store_path, blocking_task_runner, request_context,
+ base::WrapUnique<Encryptor>(new SystemEncryptor), this);
}
void GCMDriverDesktop::IOWorker::OnRegisterFinished(
@@ -325,7 +323,7 @@
const std::vector<std::string>& sender_ids) {
DCHECK(io_thread_->RunsTasksOnCurrentThread());
- scoped_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
+ std::unique_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
gcm_info->app_id = app_id;
gcm_info->sender_ids = sender_ids;
gcm_client_->Register(make_linked_ptr<RegistrationInfo>(gcm_info.release()));
@@ -334,7 +332,7 @@
void GCMDriverDesktop::IOWorker::Unregister(const std::string& app_id) {
DCHECK(io_thread_->RunsTasksOnCurrentThread());
- scoped_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
+ std::unique_ptr<GCMRegistrationInfo> gcm_info(new GCMRegistrationInfo);
gcm_info->app_id = app_id;
gcm_client_->Unregister(
make_linked_ptr<RegistrationInfo>(gcm_info.release()));
@@ -450,7 +448,7 @@
const std::map<std::string, std::string>& options) {
DCHECK(io_thread_->RunsTasksOnCurrentThread());
- scoped_ptr<InstanceIDTokenInfo> instance_id_token_info(
+ std::unique_ptr<InstanceIDTokenInfo> instance_id_token_info(
new InstanceIDTokenInfo);
instance_id_token_info->app_id = app_id;
instance_id_token_info->authorized_entity = authorized_entity;
@@ -464,7 +462,7 @@
const std::string& app_id,
const std::string& authorized_entity,
const std::string& scope) {
- scoped_ptr<InstanceIDTokenInfo> instance_id_token_info(
+ std::unique_ptr<InstanceIDTokenInfo> instance_id_token_info(
new InstanceIDTokenInfo);
instance_id_token_info->app_id = app_id;
instance_id_token_info->authorized_entity = authorized_entity;
@@ -477,7 +475,7 @@
#if defined(OS_CHROMEOS)
DCHECK(io_thread_->RunsTasksOnCurrentThread());
- scoped_ptr<base::Timer> timer;
+ std::unique_ptr<base::Timer> timer;
if (wake)
timer.reset(new timers::SimpleAlarmTimer());
else
@@ -507,7 +505,7 @@
}
GCMDriverDesktop::GCMDriverDesktop(
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
const GCMClient::ChromeBuildInfo& chrome_build_info,
const std::string& channel_status_request_url,
const std::string& user_agent,
diff --git a/components/gcm_driver/gcm_driver_desktop.h b/components/gcm_driver/gcm_driver_desktop.h
index f42bd052..5a986e2 100644
--- a/components/gcm_driver/gcm_driver_desktop.h
+++ b/components/gcm_driver/gcm_driver_desktop.h
@@ -6,6 +6,7 @@
#define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_
#include <map>
+#include <memory>
#include <string>
#include <tuple>
#include <vector>
@@ -13,7 +14,6 @@
#include "base/compiler_specific.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/observer_list.h"
#include "base/tuple.h"
@@ -49,7 +49,7 @@
public InstanceIDHandler {
public:
GCMDriverDesktop(
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
const GCMClient::ChromeBuildInfo& chrome_build_info,
const std::string& channel_status_request_url,
const std::string& user_agent,
@@ -186,7 +186,7 @@
const std::string& scope,
GCMClient::Result result);
- scoped_ptr<GCMChannelStatusSyncer> gcm_channel_status_syncer_;
+ std::unique_ptr<GCMChannelStatusSyncer> gcm_channel_status_syncer_;
// Flag to indicate whether the user is signed in to a GAIA account.
bool signed_in_;
@@ -206,7 +206,7 @@
base::ObserverList<GCMConnectionObserver, false> connection_observer_list_;
// Account mapper. Only works when user is signed in.
- scoped_ptr<GCMAccountMapper> account_mapper_;
+ std::unique_ptr<GCMAccountMapper> account_mapper_;
// Time of last token fetching.
base::Time last_token_fetch_time_;
@@ -214,7 +214,7 @@
scoped_refptr<base::SequencedTaskRunner> ui_thread_;
scoped_refptr<base::SequencedTaskRunner> io_thread_;
- scoped_ptr<GCMDelayedTaskController> delayed_task_controller_;
+ std::unique_ptr<GCMDelayedTaskController> delayed_task_controller_;
// Whether the HeartbeatManager should try to wake the system from suspend for
// sending heartbeat messages.
@@ -222,7 +222,7 @@
// For all the work occurring on the IO thread. Must be destroyed on the IO
// thread.
- scoped_ptr<IOWorker> io_worker_;
+ std::unique_ptr<IOWorker> io_worker_;
// Callback for GetGCMStatistics.
GetGCMStatisticsCallback request_gcm_statistics_callback_;
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc
index 9037b12..c7a2b0c 100644
--- a/components/gcm_driver/gcm_driver_desktop_unittest.cc
+++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -168,9 +168,9 @@
base::MessageLoopForUI message_loop_;
base::Thread io_thread_;
base::FieldTrialList field_trial_list_;
- scoped_ptr<GCMDriverDesktop> driver_;
- scoped_ptr<FakeGCMAppHandler> gcm_app_handler_;
- scoped_ptr<FakeGCMConnectionObserver> gcm_connection_observer_;
+ std::unique_ptr<GCMDriverDesktop> driver_;
+ std::unique_ptr<FakeGCMAppHandler> gcm_app_handler_;
+ std::unique_ptr<FakeGCMConnectionObserver> gcm_connection_observer_;
base::Closure async_operation_completed_callback_;
@@ -242,7 +242,7 @@
scoped_refptr<net::URLRequestContextGetter> request_context =
new net::TestURLRequestContextGetter(io_thread_.task_runner());
driver_.reset(new GCMDriverDesktop(
- scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory(
+ std::unique_ptr<GCMClientFactory>(new FakeGCMClientFactory(
base::ThreadTaskRunnerHandle::Get(), io_thread_.task_runner())),
GCMClient::ChromeBuildInfo(), "http://channel.status.request.url",
"user-agent-string", &prefs_, temp_dir_.path(), request_context,
diff --git a/components/gcm_driver/gcm_profile_service.cc b/components/gcm_driver/gcm_profile_service.cc
index 0356adf..1f9aaec 100644
--- a/components/gcm_driver/gcm_profile_service.cc
+++ b/components/gcm_driver/gcm_profile_service.cc
@@ -55,7 +55,7 @@
GCMDriver* driver_;
IdentityProvider* identity_provider_;
- scoped_ptr<GCMAccountTracker> gcm_account_tracker_;
+ std::unique_ptr<GCMAccountTracker> gcm_account_tracker_;
// The account ID that this service is responsible for. Empty when the service
// is not running.
@@ -108,7 +108,7 @@
if (gcm_account_tracker_)
return;
- scoped_ptr<gaia::AccountTracker> gaia_account_tracker(
+ std::unique_ptr<gaia::AccountTracker> gaia_account_tracker(
new gaia::AccountTracker(identity_provider_, request_context));
gcm_account_tracker_.reset(
@@ -141,8 +141,8 @@
base::FilePath path,
net::URLRequestContextGetter* request_context,
version_info::Channel channel,
- scoped_ptr<ProfileIdentityProvider> identity_provider,
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+ std::unique_ptr<ProfileIdentityProvider> identity_provider,
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner)
diff --git a/components/gcm_driver/gcm_profile_service.h b/components/gcm_driver/gcm_profile_service.h
index 5c2b79d1..156d108 100644
--- a/components/gcm_driver/gcm_profile_service.h
+++ b/components/gcm_driver/gcm_profile_service.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_GCM_DRIVER_GCM_PROFILE_SERVICE_H_
#define COMPONENTS_GCM_DRIVER_GCM_PROFILE_SERVICE_H_
+#include <memory>
#include <string>
#include "base/callback_forward.h"
@@ -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 "build/build_config.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/signin/core/browser/profile_identity_provider.h"
@@ -56,8 +56,8 @@
base::FilePath path,
net::URLRequestContextGetter* request_context,
version_info::Channel channel,
- scoped_ptr<ProfileIdentityProvider> identity_provider,
- scoped_ptr<GCMClientFactory> gcm_client_factory,
+ std::unique_ptr<ProfileIdentityProvider> identity_provider,
+ std::unique_ptr<GCMClientFactory> gcm_client_factory,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
@@ -81,14 +81,14 @@
private:
net::URLRequestContextGetter* request_context_;
- scoped_ptr<ProfileIdentityProvider> profile_identity_provider_;
+ std::unique_ptr<ProfileIdentityProvider> profile_identity_provider_;
- scoped_ptr<GCMDriver> driver_;
+ std::unique_ptr<GCMDriver> driver_;
// Used for both account tracker and GCM.UserSignedIn UMA.
#if !defined(OS_ANDROID)
class IdentityObserver;
- scoped_ptr<IdentityObserver> identity_observer_;
+ std::unique_ptr<IdentityObserver> identity_observer_;
#endif
DISALLOW_COPY_AND_ASSIGN(GCMProfileService);
diff --git a/components/gcm_driver/instance_id/instance_id.h b/components/gcm_driver/instance_id/instance_id.h
index de9bc21..3aa7658e 100644
--- a/components/gcm_driver/instance_id/instance_id.h
+++ b/components/gcm_driver/instance_id/instance_id.h
@@ -6,11 +6,11 @@
#define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_H_
#include <map>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
namespace gcm {
@@ -58,8 +58,8 @@
// |app_id|: identifies the application that uses the Instance ID.
// |handler|: provides the GCM functionality needed to support Instance ID.
// Must outlive this class. On Android, this can be null instead.
- static scoped_ptr<InstanceID> Create(const std::string& app_id,
- gcm::InstanceIDHandler* handler);
+ static std::unique_ptr<InstanceID> Create(const std::string& app_id,
+ gcm::InstanceIDHandler* handler);
virtual ~InstanceID();
diff --git a/components/gcm_driver/instance_id/instance_id_android.cc b/components/gcm_driver/instance_id/instance_id_android.cc
index f2fbd21..8ed0e96 100644
--- a/components/gcm_driver/instance_id/instance_id_android.cc
+++ b/components/gcm_driver/instance_id/instance_id_android.cc
@@ -6,6 +6,8 @@
#include <stdint.h>
+#include <memory>
+
#include "base/android/context_utils.h"
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
@@ -13,7 +15,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "jni/InstanceIDBridge_jni.h"
@@ -30,9 +32,9 @@
}
// static
-scoped_ptr<InstanceID> InstanceID::Create(const std::string& app_id,
- gcm::InstanceIDHandler* unused) {
- return make_scoped_ptr(new InstanceIDAndroid(app_id));
+std::unique_ptr<InstanceID> InstanceID::Create(const std::string& app_id,
+ gcm::InstanceIDHandler* unused) {
+ return base::WrapUnique(new InstanceIDAndroid(app_id));
}
InstanceIDAndroid::InstanceIDAndroid(const std::string& app_id)
diff --git a/components/gcm_driver/instance_id/instance_id_driver.cc b/components/gcm_driver/instance_id/instance_id_driver.cc
index 937d77b..c4c89ae 100644
--- a/components/gcm_driver/instance_id/instance_id_driver.cc
+++ b/components/gcm_driver/instance_id/instance_id_driver.cc
@@ -37,7 +37,7 @@
gcm::InstanceIDHandler* handler = gcm_driver_->GetInstanceIDHandlerInternal();
- scoped_ptr<InstanceID> instance_id = InstanceID::Create(app_id, handler);
+ std::unique_ptr<InstanceID> instance_id = InstanceID::Create(app_id, handler);
InstanceID* instance_id_ptr = instance_id.get();
instance_id_map_.insert(std::make_pair(app_id, std::move(instance_id)));
return instance_id_ptr;
diff --git a/components/gcm_driver/instance_id/instance_id_driver.h b/components/gcm_driver/instance_id/instance_id_driver.h
index e006f0d3..38e1e622 100644
--- a/components/gcm_driver/instance_id/instance_id_driver.h
+++ b/components/gcm_driver/instance_id/instance_id_driver.h
@@ -6,10 +6,10 @@
#define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
namespace gcm {
class GCMDriver;
@@ -46,7 +46,7 @@
// InstanceIDProfileServiceFactory, which owns this.
gcm::GCMDriver* gcm_driver_;
- std::map<std::string, scoped_ptr<InstanceID>> instance_id_map_;
+ std::map<std::string, std::unique_ptr<InstanceID>> instance_id_map_;
DISALLOW_COPY_AND_ASSIGN(InstanceIDDriver);
};
diff --git a/components/gcm_driver/instance_id/instance_id_driver_unittest.cc b/components/gcm_driver/instance_id/instance_id_driver_unittest.cc
index 8997296..de3c15e 100644
--- a/components/gcm_driver/instance_id/instance_id_driver_unittest.cc
+++ b/components/gcm_driver/instance_id/instance_id_driver_unittest.cc
@@ -82,8 +82,8 @@
void DeleteTokenCompleted(InstanceID::Result result);
base::MessageLoopForUI message_loop_;
- scoped_ptr<FakeGCMDriverForInstanceID> gcm_driver_;
- scoped_ptr<InstanceIDDriver> driver_;
+ std::unique_ptr<FakeGCMDriverForInstanceID> gcm_driver_;
+ std::unique_ptr<InstanceIDDriver> driver_;
std::string id_;
base::Time creation_time_;
diff --git a/components/gcm_driver/instance_id/instance_id_impl.cc b/components/gcm_driver/instance_id/instance_id_impl.cc
index f7e5014..667008fd 100644
--- a/components/gcm_driver/instance_id/instance_id_impl.cc
+++ b/components/gcm_driver/instance_id/instance_id_impl.cc
@@ -7,10 +7,12 @@
#include <stdint.h>
#include <algorithm>
+#include <memory>
+
#include "base/base64.h"
#include "base/bind.h"
#include "base/logging.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 "components/gcm_driver/gcm_driver.h"
@@ -47,9 +49,10 @@
} // namespace
// static
-scoped_ptr<InstanceID> InstanceID::Create(const std::string& app_id,
- gcm::InstanceIDHandler* handler) {
- return make_scoped_ptr(new InstanceIDImpl(app_id, handler));
+std::unique_ptr<InstanceID> InstanceID::Create(
+ const std::string& app_id,
+ gcm::InstanceIDHandler* handler) {
+ return base::WrapUnique(new InstanceIDImpl(app_id, handler));
}
InstanceIDImpl::InstanceIDImpl(const std::string& app_id,
diff --git a/components/gcm_driver/instance_id/instance_id_impl.h b/components/gcm_driver/instance_id/instance_id_impl.h
index d36264c3..c37438bc 100644
--- a/components/gcm_driver/instance_id/instance_id_impl.h
+++ b/components/gcm_driver/instance_id/instance_id_impl.h
@@ -6,11 +6,11 @@
#define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
#include <map>
+#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/time/time.h"
#include "components/gcm_driver/gcm_client.h"
diff --git a/components/gcm_driver/registration_info.cc b/components/gcm_driver/registration_info.cc
index 38c11de9..c91d1cc 100644
--- a/components/gcm_driver/registration_info.cc
+++ b/components/gcm_driver/registration_info.cc
@@ -18,11 +18,11 @@
} // namespace
// static
-scoped_ptr<RegistrationInfo> RegistrationInfo::BuildFromString(
+std::unique_ptr<RegistrationInfo> RegistrationInfo::BuildFromString(
const std::string& serialized_key,
const std::string& serialized_value,
std::string* registration_id) {
- scoped_ptr<RegistrationInfo> registration;
+ std::unique_ptr<RegistrationInfo> registration;
if (base::StartsWith(serialized_key, kInsanceIDSerializationPrefix,
base::CompareCase::SENSITIVE))
@@ -246,7 +246,8 @@
bool ExistsGCMRegistrationInMap(const RegistrationInfoMap& map,
const std::string& app_id) {
- scoped_ptr<GCMRegistrationInfo> gcm_registration(new GCMRegistrationInfo);
+ std::unique_ptr<GCMRegistrationInfo> gcm_registration(
+ new GCMRegistrationInfo);
gcm_registration->app_id = app_id;
return map.count(
make_linked_ptr<RegistrationInfo>(gcm_registration.release())) > 0;
diff --git a/components/gcm_driver/registration_info.h b/components/gcm_driver/registration_info.h
index 6584376..b9ba0a1b 100644
--- a/components/gcm_driver/registration_info.h
+++ b/components/gcm_driver/registration_info.h
@@ -6,11 +6,11 @@
#define COMPONENTS_GCM_DRIVER_REGISTRATION_INFO_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
namespace gcm {
@@ -24,7 +24,7 @@
// Returns the appropriate RegistrationInfo instance based on the serialized
// key and value.
// |registration_id| can be NULL if no interest to it.
- static scoped_ptr<RegistrationInfo> BuildFromString(
+ static std::unique_ptr<RegistrationInfo> BuildFromString(
const std::string& serialized_key,
const std::string& serialized_value,
std::string* registration_id);