Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Unified Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
index 7fd40477b798d770b8f224efdec0e61067ba7fc6..b0fa30f973725b6dee03efd879621e9b116ba136 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -9,6 +9,7 @@
#include <utility>
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
@@ -179,8 +180,9 @@ void ConvertSearchResultInfoListToEntryDefinitionList(
class SingleEntryPropertiesGetterForDrive {
public:
- typedef base::Callback<void(scoped_ptr<EntryProperties> properties,
- base::File::Error error)> ResultCallback;
+ typedef base::Callback<void(std::unique_ptr<EntryProperties> properties,
+ base::File::Error error)>
+ ResultCallback;
// Creates an instance and starts the process.
static void Start(const base::FilePath local_path,
@@ -244,7 +246,7 @@ class SingleEntryPropertiesGetterForDrive {
}
void OnGetFileInfo(drive::FileError error,
- scoped_ptr<drive::ResourceEntry> entry) {
+ std::unique_ptr<drive::ResourceEntry> entry) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error != drive::FILE_ERROR_OK) {
@@ -299,7 +301,7 @@ class SingleEntryPropertiesGetterForDrive {
}
void OnGetShareInfo(drive::FileError error,
- scoped_ptr<drive::ResourceEntry> entry) {
+ std::unique_ptr<drive::ResourceEntry> entry) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error != drive::FILE_ERROR_OK) {
@@ -381,18 +383,19 @@ class SingleEntryPropertiesGetterForDrive {
Profile* const running_profile_;
// Values used in the process.
- scoped_ptr<EntryProperties> properties_;
+ std::unique_ptr<EntryProperties> properties_;
Profile* file_owner_profile_;
base::FilePath file_path_;
- scoped_ptr<drive::ResourceEntry> owner_resource_entry_;
+ std::unique_ptr<drive::ResourceEntry> owner_resource_entry_;
base::WeakPtrFactory<SingleEntryPropertiesGetterForDrive> weak_ptr_factory_;
}; // class SingleEntryPropertiesGetterForDrive
class SingleEntryPropertiesGetterForFileSystemProvider {
public:
- typedef base::Callback<void(scoped_ptr<EntryProperties> properties,
- base::File::Error error)> ResultCallback;
+ typedef base::Callback<void(std::unique_ptr<EntryProperties> properties,
+ base::File::Error error)>
+ ResultCallback;
// Creates an instance and starts the process.
static void Start(const storage::FileSystemURL file_system_url,
@@ -462,7 +465,7 @@ class SingleEntryPropertiesGetterForFileSystemProvider {
weak_ptr_factory_.GetWeakPtr()));
}
- void OnGetMetadataCompleted(scoped_ptr<EntryMetadata> metadata,
+ void OnGetMetadataCompleted(std::unique_ptr<EntryMetadata> metadata,
base::File::Error result) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -515,7 +518,7 @@ class SingleEntryPropertiesGetterForFileSystemProvider {
const std::set<EntryPropertyName> names_;
// Values used in the process.
- scoped_ptr<EntryProperties> properties_;
+ std::unique_ptr<EntryProperties> properties_;
base::WeakPtrFactory<SingleEntryPropertiesGetterForFileSystemProvider>
weak_ptr_factory_;
@@ -536,7 +539,7 @@ bool FileManagerPrivateInternalGetEntryPropertiesFunction::RunAsync() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
using api::file_manager_private_internal::GetEntryProperties::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
scoped_refptr<storage::FileSystemContext> file_system_context =
@@ -570,7 +573,7 @@ bool FileManagerPrivateInternalGetEntryPropertiesFunction::RunAsync() {
// integrate fileManagerPrivate.getMimeType to this method.
LOG(ERROR) << "Not supported file system type.";
CompleteGetEntryProperties(i, file_system_url,
- make_scoped_ptr(new EntryProperties),
+ base::WrapUnique(new EntryProperties),
base::File::FILE_ERROR_INVALID_OPERATION);
}
}
@@ -581,7 +584,7 @@ bool FileManagerPrivateInternalGetEntryPropertiesFunction::RunAsync() {
void FileManagerPrivateInternalGetEntryPropertiesFunction::
CompleteGetEntryProperties(size_t index,
const storage::FileSystemURL& url,
- scoped_ptr<EntryProperties> properties,
+ std::unique_ptr<EntryProperties> properties,
base::File::Error error) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(0 <= processed_count_ && processed_count_ < properties_list_.size());
@@ -605,7 +608,7 @@ bool FileManagerPrivateInternalPinDriveFileFunction::RunAsync() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
using extensions::api::file_manager_private_internal::PinDriveFile::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
drive::FileSystemInterface* const file_system =
@@ -647,7 +650,7 @@ void FileManagerPrivateInternalPinDriveFileFunction::OnPinStateSet(
bool FileManagerPrivateInternalCancelFileTransfersFunction::RunAsync() {
using extensions::api::file_manager_private_internal::CancelFileTransfers::
Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
drive::DriveIntegrationService* integration_service =
@@ -709,7 +712,7 @@ bool FileManagerPrivateCancelAllFileTransfersFunction::RunAsync() {
bool FileManagerPrivateSearchDriveFunction::RunAsync() {
using extensions::api::file_manager_private::SearchDrive::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
drive::FileSystemInterface* const file_system =
@@ -728,7 +731,7 @@ bool FileManagerPrivateSearchDriveFunction::RunAsync() {
void FileManagerPrivateSearchDriveFunction::OnSearch(
drive::FileError error,
const GURL& next_link,
- scoped_ptr<SearchResultInfoList> results) {
+ std::unique_ptr<SearchResultInfoList> results) {
if (error != drive::FILE_ERROR_OK) {
SendResponse(false);
return;
@@ -751,8 +754,8 @@ void FileManagerPrivateSearchDriveFunction::OnSearch(
void FileManagerPrivateSearchDriveFunction::OnEntryDefinitionList(
const GURL& next_link,
- scoped_ptr<SearchResultInfoList> search_result_info_list,
- scoped_ptr<EntryDefinitionList> entry_definition_list) {
+ std::unique_ptr<SearchResultInfoList> search_result_info_list,
+ std::unique_ptr<EntryDefinitionList> entry_definition_list) {
DCHECK_EQ(search_result_info_list->size(), entry_definition_list->size());
base::ListValue* entries = new base::ListValue();
@@ -778,7 +781,7 @@ void FileManagerPrivateSearchDriveFunction::OnEntryDefinitionList(
bool FileManagerPrivateSearchDriveMetadataFunction::RunAsync() {
using api::file_manager_private::SearchDriveMetadata::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile());
@@ -828,7 +831,7 @@ bool FileManagerPrivateSearchDriveMetadataFunction::RunAsync() {
void FileManagerPrivateSearchDriveMetadataFunction::OnSearchMetadata(
drive::FileError error,
- scoped_ptr<drive::MetadataSearchResultVector> results) {
+ std::unique_ptr<drive::MetadataSearchResultVector> results) {
if (error != drive::FILE_ERROR_OK) {
SendResponse(false);
return;
@@ -850,8 +853,8 @@ void FileManagerPrivateSearchDriveMetadataFunction::OnSearchMetadata(
}
void FileManagerPrivateSearchDriveMetadataFunction::OnEntryDefinitionList(
- scoped_ptr<drive::MetadataSearchResultVector> search_result_info_list,
- scoped_ptr<EntryDefinitionList> entry_definition_list) {
+ std::unique_ptr<drive::MetadataSearchResultVector> search_result_info_list,
+ std::unique_ptr<EntryDefinitionList> entry_definition_list) {
DCHECK_EQ(search_result_info_list->size(), entry_definition_list->size());
base::ListValue* results_list = new base::ListValue();
@@ -924,7 +927,7 @@ bool FileManagerPrivateGetDriveConnectionStateFunction::RunSync() {
bool FileManagerPrivateRequestAccessTokenFunction::RunAsync() {
using extensions::api::file_manager_private::RequestAccessToken::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
drive::DriveServiceInterface* const drive_service =
@@ -958,7 +961,7 @@ void FileManagerPrivateRequestAccessTokenFunction::OnAccessTokenFetched(
bool FileManagerPrivateInternalGetShareUrlFunction::RunAsync() {
using extensions::api::file_manager_private_internal::GetShareUrl::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const base::FilePath path = file_manager::util::GetLocalPathFromURL(
@@ -998,7 +1001,7 @@ void FileManagerPrivateInternalGetShareUrlFunction::OnGetShareUrl(
bool FileManagerPrivateInternalRequestDriveShareFunction::RunAsync() {
using extensions::api::file_manager_private_internal::RequestDriveShare::
Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const base::FilePath path = file_manager::util::GetLocalPathFromURL(
@@ -1058,7 +1061,7 @@ FileManagerPrivateInternalGetDownloadUrlFunction::
bool FileManagerPrivateInternalGetDownloadUrlFunction::RunAsync() {
using extensions::api::file_manager_private_internal::GetShareUrl::Params;
- const scoped_ptr<Params> params(Params::Create(*args_));
+ const std::unique_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
// Start getting the file info.
@@ -1090,7 +1093,7 @@ bool FileManagerPrivateInternalGetDownloadUrlFunction::RunAsync() {
void FileManagerPrivateInternalGetDownloadUrlFunction::OnGetResourceEntry(
drive::FileError error,
- scoped_ptr<drive::ResourceEntry> entry) {
+ std::unique_ptr<drive::ResourceEntry> entry) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error != drive::FILE_ERROR_OK) {

Powered by Google App Engine
This is Rietveld 408576698