Commit 1ccca773 authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in extensions code.

This patch was generated by running the rewrite_scoped_refptr clang tool
on a ChromeOS build.

BUG=110610

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

Cr-Commit-Position: refs/heads/master@{#294904}
parent f76f8e9b
......@@ -79,7 +79,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) {
// public sessions, the extension can be installed.
scoped_refptr<const extensions::Extension> extension =
CreateExternalComponentExtension();
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
base::string16 error;
EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
EXPECT_EQ(base::string16(), error);
......@@ -88,7 +88,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) {
// Verify that if an extension's type has been whitelisted for use in
// device-local accounts, the extension can be installed.
extension = CreateHostedApp();
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
EXPECT_EQ(base::string16(), error);
error.clear();
......@@ -96,7 +96,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) {
// Verify that if an extension's ID has been explicitly whitelisted for use in
// device-local accounts, the extension can be installed.
extension = CreateRegularExtension(kWhitelistedId);
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
EXPECT_EQ(base::string16(), error);
error.clear();
......@@ -105,7 +105,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, PublicSession) {
// been whitelisted for use in public sessions, the extension cannot be
// installed.
extension = CreateRegularExtension(std::string());
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
EXPECT_NE(base::string16(), error);
error.clear();
......@@ -117,7 +117,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) {
// Verify that a platform app can be installed.
scoped_refptr<const extensions::Extension> extension = CreatePlatformApp();
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
base::string16 error;
EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error));
EXPECT_EQ(base::string16(), error);
......@@ -127,7 +127,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) {
// other types of device-local accounts cannot be installed in a single-app
// kiosk session.
extension = CreateExternalComponentExtension();
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
EXPECT_NE(base::string16(), error);
error.clear();
......@@ -136,7 +136,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) {
// types of device-local accounts cannot be installed in a single-app kiosk
// session.
extension = CreateHostedApp();
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
EXPECT_NE(base::string16(), error);
error.clear();
......@@ -145,7 +145,7 @@ TEST(DeviceLocalAccountManagementPolicyProviderTest, KioskAppSession) {
// types of device-local accounts cannot be installed in a single-app kiosk
// session.
extension = CreateRegularExtension(kWhitelistedId);
ASSERT_TRUE(extension);
ASSERT_TRUE(extension.get());
EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error));
EXPECT_NE(base::string16(), error);
error.clear();
......
......@@ -222,9 +222,9 @@ void ExternalCache::CheckCache() {
return;
// If request_context_ is missing we can't download anything.
if (!downloader_ && request_context_) {
if (!downloader_ && request_context_.get()) {
downloader_.reset(
new extensions::ExtensionDownloader(this, request_context_));
new extensions::ExtensionDownloader(this, request_context_.get()));
}
cached_extensions_->Clear();
......
......@@ -620,7 +620,7 @@ bool FileManagerPrivateInternalResolveIsolatedEntriesFunction::RunAsync() {
scoped_refptr<storage::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
GetProfile(), render_view_host());
DCHECK(file_system_context);
DCHECK(file_system_context.get());
const storage::ExternalFileSystemBackend* external_backend =
file_system_context->external_backend();
......
......@@ -158,7 +158,7 @@ TEST_F(EasyUnlockPrivateApiTest, PerformECDHKeyAgreement) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage) {
......@@ -203,7 +203,7 @@ TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage_EmptyOptions) {
......@@ -236,7 +236,7 @@ TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage_EmptyOptions) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage_AsymmetricSign) {
......@@ -276,7 +276,7 @@ TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage_AsymmetricSign) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage) {
......@@ -313,7 +313,7 @@ TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage_EmptyOptions) {
......@@ -343,7 +343,7 @@ TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage_EmptyOptions) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage_AsymmetricSign) {
......@@ -378,7 +378,7 @@ TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage_AsymmetricSign) {
browser(),
extension_function_test_utils::NONE));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function));
EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
}
} // namespace
......
......@@ -212,7 +212,7 @@ EnterprisePlatformKeysImportCertificateFunction::Run() {
const std::string& cert_der = params->certificate;
scoped_refptr<net::X509Certificate> cert_x509 =
net::X509Certificate::CreateFromBytes(cert_der.data(), cert_der.size());
if (!cert_x509)
if (!cert_x509.get())
return RespondNow(Error(kErrorInvalidX509Cert));
chromeos::platform_keys::ImportCertificate(
......@@ -250,7 +250,7 @@ EnterprisePlatformKeysRemoveCertificateFunction::Run() {
const std::string& cert_der = params->certificate;
scoped_refptr<net::X509Certificate> cert_x509 =
net::X509Certificate::CreateFromBytes(cert_der.data(), cert_der.size());
if (!cert_x509)
if (!cert_x509.get())
return RespondNow(Error(kErrorInvalidX509Cert));
chromeos::platform_keys::RemoveCertificate(
......
......@@ -101,7 +101,7 @@ class RemovableStorageProviderChromeOsUnitTest : public testing::Test {
const std::string& vendor,
const std::string& model,
uint64 capacity) {
RemovableStorageDevice* device = FindDevice(devices_, device_path);
RemovableStorageDevice* device = FindDevice(devices_.get(), device_path);
ASSERT_TRUE(device != NULL);
......@@ -139,8 +139,9 @@ TEST_F(RemovableStorageProviderChromeOsUnitTest, GetAllDevices) {
ASSERT_EQ(2U, devices_->data.size());
ExpectDevice(
devices_, kDevicePathUSB, kVendorName, kProductName, kDeviceSize);
ExpectDevice(devices_, kDevicePathSD, kVendorName, kProductName, kDeviceSize);
devices_.get(), kDevicePathUSB, kVendorName, kProductName, kDeviceSize);
ExpectDevice(
devices_.get(), kDevicePathSD, kVendorName, kProductName, kDeviceSize);
}
// Tests that a USB drive with an empty vendor and product gets a generic name.
......@@ -158,8 +159,10 @@ TEST_F(RemovableStorageProviderChromeOsUnitTest, EmptyProductAndModel) {
ASSERT_EQ(2U, devices_->data.size());
ExpectDevice(devices_, kDevicePathUSB, "", kUnknownUSBDiskModel, kDeviceSize);
ExpectDevice(devices_, kDevicePathSD, "", kUnknownSDDiskModel, kDeviceSize);
ExpectDevice(
devices_.get(), kDevicePathUSB, "", kUnknownUSBDiskModel, kDeviceSize);
ExpectDevice(
devices_.get(), kDevicePathSD, "", kUnknownSDDiskModel, kDeviceSize);
}
} // namespace extensions
......@@ -715,7 +715,7 @@ void UsbRequestAccessFunction::AsyncWorkStart() {
#if defined(OS_CHROMEOS)
scoped_refptr<UsbDevice> device =
GetDeviceOrCompleteWithError(parameters_->device);
if (!device)
if (!device.get())
return;
device->RequestUsbAccess(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment