Commit 28fa7ca6 authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in components/policy/

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

BUG=110610

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

Cr-Commit-Position: refs/heads/master@{#291928}
parent d40ebfeb
...@@ -469,7 +469,7 @@ void URLBlacklistManager::UpdateOnIO(scoped_ptr<base::ListValue> block, ...@@ -469,7 +469,7 @@ void URLBlacklistManager::UpdateOnIO(scoped_ptr<base::ListValue> block,
// The URLBlacklist is built on a worker thread. Once it's ready, it is passed // The URLBlacklist is built on a worker thread. Once it's ready, it is passed
// to the URLBlacklistManager on IO. // to the URLBlacklistManager on IO.
base::PostTaskAndReplyWithResult( base::PostTaskAndReplyWithResult(
background_task_runner_, background_task_runner_.get(),
FROM_HERE, FROM_HERE,
base::Bind(&BuildBlacklist, base::Bind(&BuildBlacklist,
base::Passed(&block), base::Passed(&block),
......
...@@ -155,7 +155,7 @@ CloudPolicyClientRegistrationHelper::CloudPolicyClientRegistrationHelper( ...@@ -155,7 +155,7 @@ CloudPolicyClientRegistrationHelper::CloudPolicyClientRegistrationHelper(
: context_(client->GetRequestContext()), : context_(client->GetRequestContext()),
client_(client), client_(client),
registration_type_(registration_type) { registration_type_(registration_type) {
DCHECK(context_); DCHECK(context_.get());
DCHECK(client_); DCHECK(client_);
} }
...@@ -197,7 +197,7 @@ void CloudPolicyClientRegistrationHelper::StartRegistrationWithLoginToken( ...@@ -197,7 +197,7 @@ void CloudPolicyClientRegistrationHelper::StartRegistrationWithLoginToken(
new CloudPolicyClientRegistrationHelper::LoginTokenHelper()); new CloudPolicyClientRegistrationHelper::LoginTokenHelper());
login_token_helper_->FetchAccessToken( login_token_helper_->FetchAccessToken(
login_refresh_token, login_refresh_token,
context_, context_.get(),
base::Bind(&CloudPolicyClientRegistrationHelper::OnTokenFetched, base::Bind(&CloudPolicyClientRegistrationHelper::OnTokenFetched,
base::Unretained(this))); base::Unretained(this)));
} }
...@@ -240,7 +240,7 @@ void CloudPolicyClientRegistrationHelper::OnTokenFetched( ...@@ -240,7 +240,7 @@ void CloudPolicyClientRegistrationHelper::OnTokenFetched(
DVLOG(1) << "Fetched new scoped OAuth token:" << oauth_access_token_; DVLOG(1) << "Fetched new scoped OAuth token:" << oauth_access_token_;
// Now we've gotten our access token - contact GAIA to see if this is a // Now we've gotten our access token - contact GAIA to see if this is a
// hosted domain. // hosted domain.
user_info_fetcher_.reset(new UserInfoFetcher(this, context_)); user_info_fetcher_.reset(new UserInfoFetcher(this, context_.get()));
user_info_fetcher_->Start(oauth_access_token_); user_info_fetcher_->Start(oauth_access_token_);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h" #include "components/policy/core/common/cloud/cloud_policy_client.h"
#include "components/policy/core/common/cloud/user_info_fetcher.h" #include "components/policy/core/common/cloud/user_info_fetcher.h"
...@@ -107,7 +108,7 @@ class POLICY_EXPORT CloudPolicyClientRegistrationHelper ...@@ -107,7 +108,7 @@ class POLICY_EXPORT CloudPolicyClientRegistrationHelper
// GAIA to get information about the signed in user. // GAIA to get information about the signed in user.
std::string oauth_access_token_; std::string oauth_access_token_;
net::URLRequestContextGetter* context_; scoped_refptr<net::URLRequestContextGetter> context_;
CloudPolicyClient* client_; CloudPolicyClient* client_;
enterprise_management::DeviceRegisterRequest::Type registration_type_; enterprise_management::DeviceRegisterRequest::Type registration_type_;
base::Closure callback_; base::Closure callback_;
......
...@@ -77,9 +77,8 @@ class DeviceManagementServiceTestBase : public testing::Test { ...@@ -77,9 +77,8 @@ class DeviceManagementServiceTestBase : public testing::Test {
} }
DeviceManagementRequestJob* StartRegistrationJob() { DeviceManagementRequestJob* StartRegistrationJob() {
DeviceManagementRequestJob* job = DeviceManagementRequestJob* job = service_->CreateJob(
service_->CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, DeviceManagementRequestJob::TYPE_REGISTRATION, request_context_.get());
request_context_);
job->SetGaiaToken(kGaiaAuthToken); job->SetGaiaToken(kGaiaAuthToken);
job->SetOAuthToken(kOAuthToken); job->SetOAuthToken(kOAuthToken);
job->SetClientID(kClientID); job->SetClientID(kClientID);
...@@ -94,7 +93,7 @@ class DeviceManagementServiceTestBase : public testing::Test { ...@@ -94,7 +93,7 @@ class DeviceManagementServiceTestBase : public testing::Test {
DeviceManagementRequestJob* StartApiAuthCodeFetchJob() { DeviceManagementRequestJob* StartApiAuthCodeFetchJob() {
DeviceManagementRequestJob* job = service_->CreateJob( DeviceManagementRequestJob* job = service_->CreateJob(
DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH, DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH,
request_context_); request_context_.get());
job->SetGaiaToken(kGaiaAuthToken); job->SetGaiaToken(kGaiaAuthToken);
job->SetOAuthToken(kOAuthToken); job->SetOAuthToken(kOAuthToken);
job->SetClientID(kClientID); job->SetClientID(kClientID);
...@@ -109,7 +108,7 @@ class DeviceManagementServiceTestBase : public testing::Test { ...@@ -109,7 +108,7 @@ class DeviceManagementServiceTestBase : public testing::Test {
DeviceManagementRequestJob* StartUnregistrationJob() { DeviceManagementRequestJob* StartUnregistrationJob() {
DeviceManagementRequestJob* job = DeviceManagementRequestJob* job =
service_->CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, service_->CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION,
request_context_); request_context_.get());
job->SetDMToken(kDMToken); job->SetDMToken(kDMToken);
job->SetClientID(kClientID); job->SetClientID(kClientID);
job->GetRequest()->mutable_unregister_request(); job->GetRequest()->mutable_unregister_request();
...@@ -121,9 +120,8 @@ class DeviceManagementServiceTestBase : public testing::Test { ...@@ -121,9 +120,8 @@ class DeviceManagementServiceTestBase : public testing::Test {
} }
DeviceManagementRequestJob* StartPolicyFetchJob() { DeviceManagementRequestJob* StartPolicyFetchJob() {
DeviceManagementRequestJob* job = DeviceManagementRequestJob* job = service_->CreateJob(
service_->CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, DeviceManagementRequestJob::TYPE_POLICY_FETCH, request_context_.get());
request_context_);
job->SetGaiaToken(kGaiaAuthToken); job->SetGaiaToken(kGaiaAuthToken);
job->SetOAuthToken(kOAuthToken); job->SetOAuthToken(kOAuthToken);
job->SetClientID(kClientID); job->SetClientID(kClientID);
...@@ -140,7 +138,7 @@ class DeviceManagementServiceTestBase : public testing::Test { ...@@ -140,7 +138,7 @@ class DeviceManagementServiceTestBase : public testing::Test {
DeviceManagementRequestJob* StartAutoEnrollmentJob() { DeviceManagementRequestJob* StartAutoEnrollmentJob() {
DeviceManagementRequestJob* job = DeviceManagementRequestJob* job =
service_->CreateJob(DeviceManagementRequestJob::TYPE_AUTO_ENROLLMENT, service_->CreateJob(DeviceManagementRequestJob::TYPE_AUTO_ENROLLMENT,
request_context_); request_context_.get());
job->SetClientID(kClientID); job->SetClientID(kClientID);
em::DeviceAutoEnrollmentRequest* request = em::DeviceAutoEnrollmentRequest* request =
job->GetRequest()->mutable_auto_enrollment_request(); job->GetRequest()->mutable_auto_enrollment_request();
......
...@@ -17,7 +17,7 @@ SystemPolicyRequestContext::SystemPolicyRequestContext( ...@@ -17,7 +17,7 @@ SystemPolicyRequestContext::SystemPolicyRequestContext(
const std::string& user_agent) const std::string& user_agent)
: system_context_getter_(system_context_getter), : system_context_getter_(system_context_getter),
http_user_agent_settings_("*", user_agent) { http_user_agent_settings_("*", user_agent) {
DCHECK(system_context_getter); DCHECK(system_context_getter.get());
} }
SystemPolicyRequestContext::~SystemPolicyRequestContext() { SystemPolicyRequestContext::~SystemPolicyRequestContext() {
......
...@@ -19,7 +19,7 @@ UserPolicyRequestContext::UserPolicyRequestContext( ...@@ -19,7 +19,7 @@ UserPolicyRequestContext::UserPolicyRequestContext(
: user_context_getter_(user_context_getter), : user_context_getter_(user_context_getter),
system_context_getter_(system_context_getter), system_context_getter_(system_context_getter),
http_user_agent_settings_("*", user_agent) { http_user_agent_settings_("*", user_agent) {
DCHECK(user_context_getter_); DCHECK(user_context_getter_.get());
} }
UserPolicyRequestContext::~UserPolicyRequestContext() { UserPolicyRequestContext::~UserPolicyRequestContext() {
......
...@@ -975,7 +975,7 @@ Schema Schema::Parse(const std::string& content, std::string* error) { ...@@ -975,7 +975,7 @@ Schema Schema::Parse(const std::string& content, std::string* error) {
scoped_refptr<const InternalStorage> storage = scoped_refptr<const InternalStorage> storage =
InternalStorage::ParseSchema(*dict, error); InternalStorage::ParseSchema(*dict, error);
if (!storage) if (!storage.get())
return Schema(); return Schema();
return Schema(storage, storage->root_node()); return Schema(storage, storage->root_node());
} }
......
...@@ -105,7 +105,7 @@ bool SchemaMap::HasComponents() const { ...@@ -105,7 +105,7 @@ bool SchemaMap::HasComponents() const {
void SchemaMap::GetChanges(const scoped_refptr<SchemaMap>& older, void SchemaMap::GetChanges(const scoped_refptr<SchemaMap>& older,
PolicyNamespaceList* removed, PolicyNamespaceList* removed,
PolicyNamespaceList* added) const { PolicyNamespaceList* added) const {
GetNamespacesNotInOther(older, added); GetNamespacesNotInOther(older.get(), added);
older->GetNamespacesNotInOther(this, removed); older->GetNamespacesNotInOther(this, removed);
} }
......
...@@ -96,7 +96,7 @@ TEST_F(SchemaMapTest, HasComponents) { ...@@ -96,7 +96,7 @@ TEST_F(SchemaMapTest, HasComponents) {
TEST_F(SchemaMapTest, Lookups) { TEST_F(SchemaMapTest, Lookups) {
scoped_refptr<SchemaMap> map = CreateTestMap(); scoped_refptr<SchemaMap> map = CreateTestMap();
ASSERT_TRUE(map); ASSERT_TRUE(map.get());
EXPECT_TRUE(map->HasComponents()); EXPECT_TRUE(map->HasComponents());
EXPECT_FALSE(map->GetSchema( EXPECT_FALSE(map->GetSchema(
......
...@@ -68,7 +68,7 @@ TEST(SchemaRegistryTest, Notifications) { ...@@ -68,7 +68,7 @@ TEST(SchemaRegistryTest, Notifications) {
SchemaRegistry registry; SchemaRegistry registry;
registry.AddObserver(&observer); registry.AddObserver(&observer);
ASSERT_TRUE(registry.schema_map()); ASSERT_TRUE(registry.schema_map().get());
EXPECT_FALSE(registry.schema_map()->GetSchema( EXPECT_FALSE(registry.schema_map()->GetSchema(
PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "abc"))); PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "abc")));
......
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