Skip to content

Commit

Permalink
gdata cleanup: stop passing Profile* around GData operations.
Browse files Browse the repository at this point in the history
After http://crosbug.com/29043 is resolved, Profile* is not used
in GData operations, except that GDataAuthService::Initialize (and
hence indirectly GDataOperationRunner) does indeed refers
to profile for OAuth2 refresh token.

BUG=none
TEST=existing tests (there should be no behavior change)

Review URL: https://chromiumcodereview.appspot.com/10831122

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150200 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
kinaba@chromium.org committed Aug 7, 2012
1 parent 8b2e85c commit 7834401
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 127 deletions.
16 changes: 6 additions & 10 deletions chrome/browser/chromeos/gdata/drive_api_operations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ namespace gdata {

//============================== GetAboutOperation =============================

GetAboutOperation::GetAboutOperation(
GDataOperationRegistry* registry,
Profile* profile,
const GetDataCallback& callback)
: GetDataOperation(registry, profile, callback) {}
GetAboutOperation::GetAboutOperation(GDataOperationRegistry* registry,
const GetDataCallback& callback)
: GetDataOperation(registry, callback) {}

GetAboutOperation::~GetAboutOperation() {}

Expand All @@ -30,11 +28,9 @@ GURL GetAboutOperation::GetURL() const {

//============================== GetApplistOperation ===========================

GetApplistOperation::GetApplistOperation(
GDataOperationRegistry* registry,
Profile* profile,
const GetDataCallback& callback)
: GetDataOperation(registry, profile, callback) {}
GetApplistOperation::GetApplistOperation(GDataOperationRegistry* registry,
const GetDataCallback& callback)
: GetDataOperation(registry, callback) {}

GetApplistOperation::~GetApplistOperation() {}

Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/chromeos/gdata/drive_api_operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace gdata {
class GetAboutOperation : public GetDataOperation {
public:
GetAboutOperation(GDataOperationRegistry* registry,
Profile* profile,
const GetDataCallback& callback);
virtual ~GetAboutOperation();

Expand All @@ -37,7 +36,6 @@ class GetAboutOperation : public GetDataOperation {
class GetApplistOperation : public GetDataOperation {
public:
GetApplistOperation(GDataOperationRegistry* registry,
Profile* profile,
const GetDataCallback& callback);
virtual ~GetApplistOperation();

Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/gdata/gdata_auth_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ void GDataAuthService::StartAuthenticationOnUIThread(
const AuthStatusCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// We have refresh token, let's gets authenticated.
(new AuthOperation(registry, profile_,
callback, refresh_token_))->Start();
(new AuthOperation(registry, callback, refresh_token_))->Start();
}

void GDataAuthService::OnAuthCompleted(
Expand Down
13 changes: 1 addition & 12 deletions chrome/browser/chromeos/gdata/gdata_contacts_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "chrome/browser/chromeos/gdata/gdata_operations.h"
#include "chrome/browser/chromeos/gdata/gdata_params.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"

using content::BrowserThread;
Expand Down Expand Up @@ -317,14 +316,12 @@ class GDataContactsService::DownloadContactsRequest
: public base::SupportsWeakPtr<DownloadContactsRequest> {
public:
DownloadContactsRequest(GDataContactsService* service,
Profile* profile,
GDataOperationRunner* runner,
SuccessCallback success_callback,
FailureCallback failure_callback,
const base::Time& min_update_time,
int max_simultaneous_photo_downloads)
: service_(service),
profile_(profile),
runner_(runner),
success_callback_(success_callback),
failure_callback_(failure_callback),
Expand All @@ -334,14 +331,12 @@ class GDataContactsService::DownloadContactsRequest
num_in_progress_photo_downloads_(0),
photo_download_failed_(false) {
DCHECK(service_);
DCHECK(profile_);
DCHECK(runner_);
}

~DownloadContactsRequest() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
service_ = NULL;
profile_ = NULL;
runner_ = NULL;
}

Expand All @@ -350,7 +345,6 @@ class GDataContactsService::DownloadContactsRequest
GetContactsOperation* operation =
new GetContactsOperation(
runner_->operation_registry(),
profile_,
min_update_time_,
base::Bind(&DownloadContactsRequest::HandleFeedData,
base::Unretained(this)));
Expand Down Expand Up @@ -494,7 +488,6 @@ class GDataContactsService::DownloadContactsRequest
runner_->StartOperationWithRetry(
new GetContactPhotoOperation(
runner_->operation_registry(),
profile_,
GURL(url),
base::Bind(&DownloadContactsRequest::HandlePhotoData,
AsWeakPtr(), contact)));
Expand Down Expand Up @@ -531,7 +524,6 @@ class GDataContactsService::DownloadContactsRequest
typedef std::map<contacts::Contact*, std::string> ContactPhotoUrls;

GDataContactsService* service_; // not owned
Profile* profile_; // not owned
GDataOperationRunner* runner_; // not owned

SuccessCallback success_callback_;
Expand Down Expand Up @@ -562,11 +554,9 @@ class GDataContactsService::DownloadContactsRequest
};

GDataContactsService::GDataContactsService(Profile* profile)
: profile_(profile),
runner_(new GDataOperationRunner(profile)),
: runner_(new GDataOperationRunner(profile)),
max_simultaneous_photo_downloads_(kMaxSimultaneousPhotoDownloads) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile_);
}

GDataContactsService::~GDataContactsService() {
Expand All @@ -591,7 +581,6 @@ void GDataContactsService::DownloadContacts(SuccessCallback success_callback,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DownloadContactsRequest* request =
new DownloadContactsRequest(this,
profile_,
runner_.get(),
success_callback,
failure_callback,
Expand Down
30 changes: 11 additions & 19 deletions chrome/browser/chromeos/gdata/gdata_documents_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ void DocumentsService::GetDocuments(const GURL& url,

GetDocumentsOperation* operation =
new GetDocumentsOperation(operation_registry(),
profile_,
start_changestamp,
search_query,
directory_resource_id,
Expand All @@ -119,7 +118,6 @@ void DocumentsService::GetDocumentEntry(const std::string& resource_id,

GetDocumentEntryOperation* operation =
new GetDocumentEntryOperation(operation_registry(),
profile_,
resource_id,
callback);
runner_->StartOperationWithRetry(operation);
Expand All @@ -129,25 +127,23 @@ void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

GetAccountMetadataOperation* operation =
new GetAccountMetadataOperation(operation_registry(),
profile_,
callback);
new GetAccountMetadataOperation(operation_registry(), callback);
runner_->StartOperationWithRetry(operation);
}

void DocumentsService::GetAboutResource(const GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

GetAboutOperation* operation =
new GetAboutOperation(operation_registry(), profile_, callback);
new GetAboutOperation(operation_registry(), callback);
runner_->StartOperationWithRetry(operation);
}

void DocumentsService::GetApplicationList(const GetDataCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

GetApplistOperation* operation =
new GetApplistOperation(operation_registry(), profile_, callback);
new GetApplistOperation(operation_registry(), callback);
runner_->StartOperationWithRetry(operation);
}

Expand Down Expand Up @@ -178,7 +174,7 @@ void DocumentsService::DownloadFile(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new DownloadFileOperation(operation_registry(), profile_,
new DownloadFileOperation(operation_registry(),
download_action_callback,
get_download_data_callback, document_url,
virtual_path, local_cache_path));
Expand All @@ -189,7 +185,7 @@ void DocumentsService::DeleteDocument(const GURL& document_url,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new DeleteDocumentOperation(operation_registry(), profile_, callback,
new DeleteDocumentOperation(operation_registry(), callback,
document_url));
}

Expand All @@ -200,7 +196,7 @@ void DocumentsService::CreateDirectory(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new CreateDirectoryOperation(operation_registry(), profile_, callback,
new CreateDirectoryOperation(operation_registry(), callback,
parent_content_url, directory_name));
}

Expand All @@ -210,7 +206,7 @@ void DocumentsService::CopyDocument(const std::string& resource_id,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new CopyDocumentOperation(operation_registry(), profile_, callback,
new CopyDocumentOperation(operation_registry(), callback,
resource_id, new_name));
}

Expand All @@ -220,7 +216,7 @@ void DocumentsService::RenameResource(const GURL& resource_url,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new RenameResourceOperation(operation_registry(), profile_, callback,
new RenameResourceOperation(operation_registry(), callback,
resource_url, new_name));
}

Expand All @@ -232,7 +228,6 @@ void DocumentsService::AddResourceToDirectory(

runner_->StartOperationWithRetry(
new AddResourceToDirectoryOperation(operation_registry(),
profile_,
callback,
parent_content_url,
resource_url));
Expand All @@ -247,7 +242,6 @@ void DocumentsService::RemoveResourceFromDirectory(

runner_->StartOperationWithRetry(
new RemoveResourceFromDirectoryOperation(operation_registry(),
profile_,
callback,
parent_content_url,
resource_url,
Expand All @@ -265,17 +259,15 @@ void DocumentsService::InitiateUpload(const InitiateUploadParams& params,
}

runner_->StartOperationWithRetry(
new InitiateUploadOperation(operation_registry(), profile_, callback,
params));
new InitiateUploadOperation(operation_registry(), callback, params));
}

void DocumentsService::ResumeUpload(const ResumeUploadParams& params,
const ResumeUploadCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new ResumeUploadOperation(operation_registry(), profile_, callback,
params));
new ResumeUploadOperation(operation_registry(), callback, params));
}


Expand All @@ -285,7 +277,7 @@ void DocumentsService::AuthorizeApp(const GURL& resource_url,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

runner_->StartOperationWithRetry(
new AuthorizeAppsOperation(operation_registry(), profile_, callback,
new AuthorizeAppsOperation(operation_registry(), callback,
resource_url, app_ids));
}

Expand Down
Loading

0 comments on commit 7834401

Please sign in to comment.