diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-02 12:21:57 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-12 08:13:00 +0000 |
commit | 606d85f2a5386472314d39923da28c70c60dc8e7 (patch) | |
tree | a8f4d7bf997f349f45605e6058259fba0630e4d7 /chromium/google_apis | |
parent | 5786336dda477d04fb98483dca1a5426eebde2d7 (diff) | |
download | qtwebengine-chromium-606d85f2a5386472314d39923da28c70c60dc8e7.tar.gz |
BASELINE: Update Chromium to 96.0.4664.181
Change-Id: I762cd1da89d73aa6313b4a753fe126c34833f046
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/google_apis')
61 files changed, 449 insertions, 284 deletions
diff --git a/chromium/google_apis/common/time_util.cc b/chromium/google_apis/common/time_util.cc index 0c98d9a9599..680d078be7f 100644 --- a/chromium/google_apis/common/time_util.cc +++ b/chromium/google_apis/common/time_util.cc @@ -145,7 +145,7 @@ bool GetTimeFromString(base::StringPiece raw_value, base::Time* parsed_time) { if (!base::Time::FromUTCExploded(exploded, parsed_time)) return false; if (offset_to_utc_in_minutes != 0) - *parsed_time -= base::TimeDelta::FromMinutes(offset_to_utc_in_minutes); + *parsed_time -= base::Minutes(offset_to_utc_in_minutes); } else { if (!base::Time::FromLocalExploded(exploded, parsed_time)) return false; diff --git a/chromium/google_apis/drive/DIR_METADATA b/chromium/google_apis/drive/DIR_METADATA index 6f9a3839c5c..d737de5f0bc 100644 --- a/chromium/google_apis/drive/DIR_METADATA +++ b/chromium/google_apis/drive/DIR_METADATA @@ -6,6 +6,4 @@ # For the schema of this file, see Metadata message: # https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/proto/dir_metadata.proto -monorail { - component: "Platform>Apps>FileManager" -}
\ No newline at end of file +mixins: "//components/drive/COMMON_METADATA" diff --git a/chromium/google_apis/drive/drive_api_parser.cc b/chromium/google_apis/drive/drive_api_parser.cc index a16af03b2d4..1b03e92a024 100644 --- a/chromium/google_apis/drive/drive_api_parser.cc +++ b/chromium/google_apis/drive/drive_api_parser.cc @@ -55,8 +55,8 @@ bool GetParentsFromValue(const base::Value* value, return false; base::JSONValueConverter<ParentReference> converter; - result->resize(list_value->GetSize()); - for (size_t i = 0; i < list_value->GetSize(); ++i) { + result->resize(list_value->GetList().size()); + for (size_t i = 0; i < list_value->GetList().size(); ++i) { const base::Value* parent_value = nullptr; if (!list_value->Get(i, &parent_value) || !converter.Convert(*parent_value, &(*result)[i])) @@ -81,13 +81,13 @@ bool GetOpenWithLinksFromDictionaryValue( result->reserve(dictionary_value->DictSize()); for (base::DictionaryValue::Iterator iter(*dictionary_value); !iter.IsAtEnd(); iter.Advance()) { - std::string string_value; - if (!iter.value().GetAsString(&string_value)) + const std::string* string_value = iter.value().GetIfString(); + if (!string_value) return false; FileResource::OpenWithLink open_with_link; open_with_link.app_id = iter.key(); - open_with_link.open_url = GURL(string_value); + open_with_link.open_url = GURL(*string_value); result->push_back(open_with_link); } diff --git a/chromium/google_apis/drive/drive_api_parser.h b/chromium/google_apis/drive/drive_api_parser.h index 665d518952a..1568f08a30e 100644 --- a/chromium/google_apis/drive/drive_api_parser.h +++ b/chromium/google_apis/drive/drive_api_parser.h @@ -229,6 +229,10 @@ class TeamDriveResource { class TeamDriveList { public: TeamDriveList(); + + TeamDriveList(const TeamDriveList&) = delete; + TeamDriveList& operator=(const TeamDriveList&) = delete; + ~TeamDriveList(); // Registers the mapping between JSON field names and the members in this @@ -268,8 +272,6 @@ class TeamDriveList { std::string next_page_token_; std::vector<std::unique_ptr<TeamDriveResource>> items_; - - DISALLOW_COPY_AND_ASSIGN(TeamDriveList); }; // ParentReference represents a directory. @@ -692,6 +694,10 @@ class FileResource { class FileList { public: FileList(); + + FileList(const FileList&) = delete; + FileList& operator=(const FileList&) = delete; + ~FileList(); // Registers the mapping between JSON field names and the members in this @@ -731,8 +737,6 @@ class FileList { GURL next_link_; std::vector<std::unique_ptr<FileResource>> items_; - - DISALLOW_COPY_AND_ASSIGN(FileList); }; // ChangeResource represents a change in a file. @@ -745,6 +749,10 @@ class ChangeResource { TEAM_DRIVE, }; ChangeResource(); + + ChangeResource(const ChangeResource&) = delete; + ChangeResource& operator=(const ChangeResource&) = delete; + ~ChangeResource(); // Registers the mapping between JSON field names and the members in this @@ -843,8 +851,6 @@ class ChangeResource { base::Time modification_date_; std::string team_drive_id_; std::unique_ptr<TeamDriveResource> team_drive_; - - DISALLOW_COPY_AND_ASSIGN(ChangeResource); }; // ChangeList represents a set of changes in the drive. @@ -852,6 +858,10 @@ class ChangeResource { class ChangeList { public: ChangeList(); + + ChangeList(const ChangeList&) = delete; + ChangeList& operator=(const ChangeList&) = delete; + ~ChangeList(); // Registers the mapping between JSON field names and the members in this @@ -908,8 +918,6 @@ class ChangeList { int64_t largest_change_id_; std::string new_start_page_token_; std::vector<std::unique_ptr<ChangeResource>> items_; - - DISALLOW_COPY_AND_ASSIGN(ChangeList); }; // StartPageToken represets the starting pageToken for listing changes in the diff --git a/chromium/google_apis/drive/drive_api_requests.h b/chromium/google_apis/drive/drive_api_requests.h index 3348986883e..ba512f68a72 100644 --- a/chromium/google_apis/drive/drive_api_requests.h +++ b/chromium/google_apis/drive/drive_api_requests.h @@ -115,6 +115,11 @@ bool ParseMultipartResponse(const std::string& content_type, class DriveApiPartialFieldRequest : public DriveUrlFetchRequestBase { public: explicit DriveApiPartialFieldRequest(RequestSender* sender); + + DriveApiPartialFieldRequest(const DriveApiPartialFieldRequest&) = delete; + DriveApiPartialFieldRequest& operator=(const DriveApiPartialFieldRequest&) = + delete; + ~DriveApiPartialFieldRequest() override; // Optional parameter. @@ -131,8 +136,6 @@ class DriveApiPartialFieldRequest : public DriveUrlFetchRequestBase { private: std::string fields_; - - DISALLOW_COPY_AND_ASSIGN(DriveApiPartialFieldRequest); }; //============================ DriveApiDataRequest =========================== @@ -151,6 +154,10 @@ class DriveApiDataRequest : public DriveApiPartialFieldRequest { : DriveApiPartialFieldRequest(sender), callback_(std::move(callback)) { DCHECK(!callback_.is_null()); } + + DriveApiDataRequest(const DriveApiDataRequest&) = delete; + DriveApiDataRequest& operator=(const DriveApiDataRequest&) = delete; + ~DriveApiDataRequest() override {} protected: @@ -201,8 +208,6 @@ class DriveApiDataRequest : public DriveApiPartialFieldRequest { // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<DriveApiDataRequest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(DriveApiDataRequest); }; //=============================== FilesGetRequest ============================= @@ -215,6 +220,10 @@ class FilesGetRequest : public DriveApiDataRequest<FileResource> { FilesGetRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, FileResourceCallback callback); + + FilesGetRequest(const FilesGetRequest&) = delete; + FilesGetRequest& operator=(const FilesGetRequest&) = delete; + ~FilesGetRequest() override; // Required parameter. @@ -235,8 +244,6 @@ class FilesGetRequest : public DriveApiDataRequest<FileResource> { const DriveApiUrlGenerator url_generator_; std::string file_id_; GURL embed_origin_; - - DISALLOW_COPY_AND_ASSIGN(FilesGetRequest); }; //============================ FilesInsertRequest ============================= @@ -257,6 +264,10 @@ class FilesInsertRequest : public DriveApiDataRequest<FileResource> { FilesInsertRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, FileResourceCallback callback); + + FilesInsertRequest(const FilesInsertRequest&) = delete; + FilesInsertRequest& operator=(const FilesInsertRequest&) = delete; + ~FilesInsertRequest() override; // Optional parameter @@ -308,8 +319,6 @@ class FilesInsertRequest : public DriveApiDataRequest<FileResource> { std::vector<std::string> parents_; std::string title_; Properties properties_; - - DISALLOW_COPY_AND_ASSIGN(FilesInsertRequest); }; //============================== FilesPatchRequest ============================ @@ -322,6 +331,10 @@ class FilesPatchRequest : public DriveApiDataRequest<FileResource> { FilesPatchRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, FileResourceCallback callback); + + FilesPatchRequest(const FilesPatchRequest&) = delete; + FilesPatchRequest& operator=(const FilesPatchRequest&) = delete; + ~FilesPatchRequest() override; // Required parameter. @@ -388,8 +401,6 @@ class FilesPatchRequest : public DriveApiDataRequest<FileResource> { base::Time last_viewed_by_me_date_; std::vector<std::string> parents_; Properties properties_; - - DISALLOW_COPY_AND_ASSIGN(FilesPatchRequest); }; //============================= FilesCopyRequest ============================== @@ -403,6 +414,10 @@ class FilesCopyRequest : public DriveApiDataRequest<FileResource> { FilesCopyRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, FileResourceCallback callback); + + FilesCopyRequest(const FilesCopyRequest&) = delete; + FilesCopyRequest& operator=(const FilesCopyRequest&) = delete; + ~FilesCopyRequest() override; // Required parameter. @@ -441,8 +456,6 @@ class FilesCopyRequest : public DriveApiDataRequest<FileResource> { base::Time modified_date_; std::vector<std::string> parents_; std::string title_; - - DISALLOW_COPY_AND_ASSIGN(FilesCopyRequest); }; //========================== TeamDriveListRequest ============================= @@ -458,6 +471,10 @@ class TeamDriveListRequest : public DriveApiDataRequest<TeamDriveList> { TeamDriveListRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, TeamDriveListCallback callback); + + TeamDriveListRequest(const TeamDriveListRequest&) = delete; + TeamDriveListRequest& operator=(const TeamDriveListRequest&) = delete; + ~TeamDriveListRequest() override; // Optional parameter @@ -477,8 +494,6 @@ class TeamDriveListRequest : public DriveApiDataRequest<TeamDriveList> { const DriveApiUrlGenerator url_generator_; int max_results_; std::string page_token_; - - DISALLOW_COPY_AND_ASSIGN(TeamDriveListRequest); }; //========================== StartPageTokenRequest ============================= @@ -493,6 +508,10 @@ class StartPageTokenRequest : public DriveApiDataRequest<StartPageToken> { StartPageTokenRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, StartPageTokenCallback callback); + + StartPageTokenRequest(const StartPageTokenRequest&) = delete; + StartPageTokenRequest& operator=(const StartPageTokenRequest&) = delete; + ~StartPageTokenRequest() override; // Optional parameter @@ -508,8 +527,6 @@ class StartPageTokenRequest : public DriveApiDataRequest<StartPageToken> { private: const DriveApiUrlGenerator url_generator_; std::string team_drive_id_; - - DISALLOW_COPY_AND_ASSIGN(StartPageTokenRequest); }; //============================= FilesListRequest ============================= @@ -525,6 +542,10 @@ class FilesListRequest : public DriveApiDataRequest<FileList> { FilesListRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, FileListCallback callback); + + FilesListRequest(const FilesListRequest&) = delete; + FilesListRequest& operator=(const FilesListRequest&) = delete; + ~FilesListRequest() override; // Optional parameter @@ -558,8 +579,6 @@ class FilesListRequest : public DriveApiDataRequest<FileList> { FilesListCorpora corpora_; std::string team_drive_id_; std::string q_; - - DISALLOW_COPY_AND_ASSIGN(FilesListRequest); }; //========================= FilesListNextPageRequest ========================== @@ -571,6 +590,10 @@ class FilesListRequest : public DriveApiDataRequest<FileList> { class FilesListNextPageRequest : public DriveApiDataRequest<FileList> { public: FilesListNextPageRequest(RequestSender* sender, FileListCallback callback); + + FilesListNextPageRequest(const FilesListNextPageRequest&) = delete; + FilesListNextPageRequest& operator=(const FilesListNextPageRequest&) = delete; + ~FilesListNextPageRequest() override; const GURL& next_link() const { return next_link_; } @@ -582,8 +605,6 @@ class FilesListNextPageRequest : public DriveApiDataRequest<FileList> { private: GURL next_link_; - - DISALLOW_COPY_AND_ASSIGN(FilesListNextPageRequest); }; //============================= FilesDeleteRequest ============================= @@ -596,6 +617,10 @@ class FilesDeleteRequest : public EntryActionRequest { FilesDeleteRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, EntryActionCallback callback); + + FilesDeleteRequest(const FilesDeleteRequest&) = delete; + FilesDeleteRequest& operator=(const FilesDeleteRequest&) = delete; + ~FilesDeleteRequest() override; // Required parameter. @@ -613,8 +638,6 @@ class FilesDeleteRequest : public EntryActionRequest { const DriveApiUrlGenerator url_generator_; std::string file_id_; std::string etag_; - - DISALLOW_COPY_AND_ASSIGN(FilesDeleteRequest); }; //============================= FilesTrashRequest ============================== @@ -627,6 +650,10 @@ class FilesTrashRequest : public DriveApiDataRequest<FileResource> { FilesTrashRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, FileResourceCallback callback); + + FilesTrashRequest(const FilesTrashRequest&) = delete; + FilesTrashRequest& operator=(const FilesTrashRequest&) = delete; + ~FilesTrashRequest() override; // Required parameter. @@ -643,8 +670,6 @@ class FilesTrashRequest : public DriveApiDataRequest<FileResource> { private: const DriveApiUrlGenerator url_generator_; std::string file_id_; - - DISALLOW_COPY_AND_ASSIGN(FilesTrashRequest); }; //============================== AboutGetRequest ============================= @@ -657,6 +682,10 @@ class AboutGetRequest : public DriveApiDataRequest<AboutResource> { AboutGetRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, AboutResourceCallback callback); + + AboutGetRequest(const AboutGetRequest&) = delete; + AboutGetRequest& operator=(const AboutGetRequest&) = delete; + ~AboutGetRequest() override; protected: @@ -665,8 +694,6 @@ class AboutGetRequest : public DriveApiDataRequest<AboutResource> { private: const DriveApiUrlGenerator url_generator_; - - DISALLOW_COPY_AND_ASSIGN(AboutGetRequest); }; //============================ ChangesListRequest ============================ @@ -682,6 +709,10 @@ class ChangesListRequest : public DriveApiDataRequest<ChangeList> { ChangesListRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, ChangeListCallback callback); + + ChangesListRequest(const ChangesListRequest&) = delete; + ChangesListRequest& operator=(const ChangesListRequest&) = delete; + ~ChangesListRequest() override; // Optional parameter @@ -719,8 +750,6 @@ class ChangesListRequest : public DriveApiDataRequest<ChangeList> { std::string page_token_; int64_t start_change_id_; std::string team_drive_id_; - - DISALLOW_COPY_AND_ASSIGN(ChangesListRequest); }; //======================== ChangesListNextPageRequest ========================= @@ -733,6 +762,11 @@ class ChangesListNextPageRequest : public DriveApiDataRequest<ChangeList> { public: ChangesListNextPageRequest(RequestSender* sender, ChangeListCallback callback); + + ChangesListNextPageRequest(const ChangesListNextPageRequest&) = delete; + ChangesListNextPageRequest& operator=(const ChangesListNextPageRequest&) = + delete; + ~ChangesListNextPageRequest() override; const GURL& next_link() const { return next_link_; } @@ -744,8 +778,6 @@ class ChangesListNextPageRequest : public DriveApiDataRequest<ChangeList> { private: GURL next_link_; - - DISALLOW_COPY_AND_ASSIGN(ChangesListNextPageRequest); }; //========================== ChildrenInsertRequest ============================ @@ -758,6 +790,10 @@ class ChildrenInsertRequest : public EntryActionRequest { ChildrenInsertRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, EntryActionCallback callback); + + ChildrenInsertRequest(const ChildrenInsertRequest&) = delete; + ChildrenInsertRequest& operator=(const ChildrenInsertRequest&) = delete; + ~ChildrenInsertRequest() override; // Required parameter. @@ -779,8 +815,6 @@ class ChildrenInsertRequest : public EntryActionRequest { const DriveApiUrlGenerator url_generator_; std::string folder_id_; std::string id_; - - DISALLOW_COPY_AND_ASSIGN(ChildrenInsertRequest); }; //========================== ChildrenDeleteRequest ============================ @@ -794,6 +828,10 @@ class ChildrenDeleteRequest : public EntryActionRequest { ChildrenDeleteRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, EntryActionCallback callback); + + ChildrenDeleteRequest(const ChildrenDeleteRequest&) = delete; + ChildrenDeleteRequest& operator=(const ChildrenDeleteRequest&) = delete; + ~ChildrenDeleteRequest() override; // Required parameter. @@ -812,8 +850,6 @@ class ChildrenDeleteRequest : public EntryActionRequest { const DriveApiUrlGenerator url_generator_; std::string child_id_; std::string folder_id_; - - DISALLOW_COPY_AND_ASSIGN(ChildrenDeleteRequest); }; //======================= InitiateUploadNewFileRequest ======================= @@ -832,6 +868,11 @@ class InitiateUploadNewFileRequest : public InitiateUploadRequestBase { const std::string& parent_resource_id, const std::string& title, InitiateUploadCallback callback); + + InitiateUploadNewFileRequest(const InitiateUploadNewFileRequest&) = delete; + InitiateUploadNewFileRequest& operator=(const InitiateUploadNewFileRequest&) = + delete; + ~InitiateUploadNewFileRequest() override; // Optional parameters. @@ -865,8 +906,6 @@ class InitiateUploadNewFileRequest : public InitiateUploadRequestBase { base::Time modified_date_; base::Time last_viewed_by_me_date_; Properties properties_; - - DISALLOW_COPY_AND_ASSIGN(InitiateUploadNewFileRequest); }; //==================== InitiateUploadExistingFileRequest ===================== @@ -887,6 +926,12 @@ class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase { const std::string& resource_id, const std::string& etag, InitiateUploadCallback callback); + + InitiateUploadExistingFileRequest(const InitiateUploadExistingFileRequest&) = + delete; + InitiateUploadExistingFileRequest& operator=( + const InitiateUploadExistingFileRequest&) = delete; + ~InitiateUploadExistingFileRequest() override; // Optional parameters. @@ -929,8 +974,6 @@ class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase { base::Time modified_date_; base::Time last_viewed_by_me_date_; Properties properties_; - - DISALLOW_COPY_AND_ASSIGN(InitiateUploadExistingFileRequest); }; // Callback used for ResumeUpload() and GetUploadStatus(). @@ -954,6 +997,10 @@ class ResumeUploadRequest : public ResumeUploadRequestBase { const base::FilePath& local_file_path, UploadRangeCallback callback, ProgressCallback progress_callback); + + ResumeUploadRequest(const ResumeUploadRequest&) = delete; + ResumeUploadRequest& operator=(const ResumeUploadRequest&) = delete; + ~ResumeUploadRequest() override; protected: @@ -963,8 +1010,6 @@ class ResumeUploadRequest : public ResumeUploadRequestBase { private: UploadRangeCallback callback_; - - DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequest); }; //========================== GetUploadStatusRequest ========================== @@ -978,6 +1023,10 @@ class GetUploadStatusRequest : public GetUploadStatusRequestBase { const GURL& upload_url, int64_t content_length, UploadRangeCallback callback); + + GetUploadStatusRequest(const GetUploadStatusRequest&) = delete; + GetUploadStatusRequest& operator=(const GetUploadStatusRequest&) = delete; + ~GetUploadStatusRequest() override; protected: @@ -987,8 +1036,6 @@ class GetUploadStatusRequest : public GetUploadStatusRequestBase { private: UploadRangeCallback callback_; - - DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequest); }; //======================= MultipartUploadNewFileDelegate ======================= @@ -1012,6 +1059,12 @@ class MultipartUploadNewFileDelegate : public MultipartUploadRequestBase { const DriveApiUrlGenerator& url_generator, FileResourceCallback callback, ProgressCallback progress_callback); + + MultipartUploadNewFileDelegate(const MultipartUploadNewFileDelegate&) = + delete; + MultipartUploadNewFileDelegate& operator=( + const MultipartUploadNewFileDelegate&) = delete; + ~MultipartUploadNewFileDelegate() override; protected: @@ -1022,8 +1075,6 @@ class MultipartUploadNewFileDelegate : public MultipartUploadRequestBase { private: const bool has_modified_date_; const DriveApiUrlGenerator url_generator_; - - DISALLOW_COPY_AND_ASSIGN(MultipartUploadNewFileDelegate); }; //====================== MultipartUploadExistingFileDelegate =================== @@ -1049,6 +1100,12 @@ class MultipartUploadExistingFileDelegate : public MultipartUploadRequestBase { const DriveApiUrlGenerator& url_generator, FileResourceCallback callback, ProgressCallback progress_callback); + + MultipartUploadExistingFileDelegate( + const MultipartUploadExistingFileDelegate&) = delete; + MultipartUploadExistingFileDelegate& operator=( + const MultipartUploadExistingFileDelegate&) = delete; + ~MultipartUploadExistingFileDelegate() override; protected: @@ -1062,8 +1119,6 @@ class MultipartUploadExistingFileDelegate : public MultipartUploadRequestBase { const std::string etag_; const bool has_modified_date_; const DriveApiUrlGenerator url_generator_; - - DISALLOW_COPY_AND_ASSIGN(MultipartUploadExistingFileDelegate); }; //========================== DownloadFileRequest ========================== @@ -1079,9 +1134,11 @@ class DownloadFileRequest : public DownloadFileRequestBase { DownloadActionCallback download_action_callback, const GetContentCallback& get_content_callback, ProgressCallback progress_callback); - ~DownloadFileRequest() override; - DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); + DownloadFileRequest(const DownloadFileRequest&) = delete; + DownloadFileRequest& operator=(const DownloadFileRequest&) = delete; + + ~DownloadFileRequest() override; }; //========================== PermissionsInsertRequest ========================== @@ -1109,6 +1166,10 @@ class PermissionsInsertRequest : public EntryActionRequest { PermissionsInsertRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, EntryActionCallback callback); + + PermissionsInsertRequest(const PermissionsInsertRequest&) = delete; + PermissionsInsertRequest& operator=(const PermissionsInsertRequest&) = delete; + ~PermissionsInsertRequest() override; void set_id(const std::string& id) { id_ = id; } @@ -1128,8 +1189,6 @@ class PermissionsInsertRequest : public EntryActionRequest { PermissionType type_; PermissionRole role_; std::string value_; - - DISALLOW_COPY_AND_ASSIGN(PermissionsInsertRequest); }; //======================= SingleBatchableDelegateRequest ======================= @@ -1139,6 +1198,12 @@ class SingleBatchableDelegateRequest : public DriveUrlFetchRequestBase { public: SingleBatchableDelegateRequest(RequestSender* sender, std::unique_ptr<BatchableDelegate> delegate); + + SingleBatchableDelegateRequest(const SingleBatchableDelegateRequest&) = + delete; + SingleBatchableDelegateRequest& operator=( + const SingleBatchableDelegateRequest&) = delete; + ~SingleBatchableDelegateRequest() override; private: @@ -1159,8 +1224,6 @@ class SingleBatchableDelegateRequest : public DriveUrlFetchRequestBase { // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<SingleBatchableDelegateRequest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(SingleBatchableDelegateRequest); }; //========================== BatchUploadRequest ========================== @@ -1168,20 +1231,25 @@ class SingleBatchableDelegateRequest : public DriveUrlFetchRequestBase { class BatchUploadChildEntry { public: explicit BatchUploadChildEntry(BatchableDelegate* request); + + BatchUploadChildEntry(const BatchUploadChildEntry&) = delete; + BatchUploadChildEntry& operator=(const BatchUploadChildEntry&) = delete; + ~BatchUploadChildEntry(); std::unique_ptr<BatchableDelegate> request; bool prepared; int64_t data_offset; int64_t data_size; - - private: - DISALLOW_COPY_AND_ASSIGN(BatchUploadChildEntry); }; class BatchUploadRequest : public DriveUrlFetchRequestBase { public: BatchUploadRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator); + + BatchUploadRequest(const BatchUploadRequest&) = delete; + BatchUploadRequest& operator=(const BatchUploadRequest&) = delete; + ~BatchUploadRequest() override; // Adds request to the batch request. The instance takes ownership of @@ -1256,8 +1324,6 @@ class BatchUploadRequest : public DriveUrlFetchRequestBase { // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<BatchUploadRequest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(BatchUploadRequest); }; } // namespace drive diff --git a/chromium/google_apis/drive/files_list_request_runner.h b/chromium/google_apis/drive/files_list_request_runner.h index 49db5adde61..06746331f2e 100644 --- a/chromium/google_apis/drive/files_list_request_runner.h +++ b/chromium/google_apis/drive/files_list_request_runner.h @@ -37,6 +37,9 @@ class FilesListRequestRunner { const std::string& fields, FileListCallback callback); + FilesListRequestRunner(const FilesListRequestRunner&) = delete; + FilesListRequestRunner& operator=(const FilesListRequestRunner&) = delete; + ~FilesListRequestRunner(); void SetRequestCompletedCallbackForTesting(base::OnceClosure callback); @@ -67,7 +70,6 @@ class FilesListRequestRunner { // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<FilesListRequestRunner> weak_ptr_factory_{this}; - DISALLOW_COPY_AND_ASSIGN(FilesListRequestRunner); }; } // namespace google_apis diff --git a/chromium/google_apis/gaia/fake_gaia.h b/chromium/google_apis/gaia/fake_gaia.h index 92d47d0e606..00e0680af82 100644 --- a/chromium/google_apis/gaia/fake_gaia.h +++ b/chromium/google_apis/gaia/fake_gaia.h @@ -100,6 +100,10 @@ class FakeGaia { }; FakeGaia(); + + FakeGaia(const FakeGaia&) = delete; + FakeGaia& operator=(const FakeGaia&) = delete; + virtual ~FakeGaia(); void SetFakeMergeSessionParams(const std::string& email, @@ -344,7 +348,6 @@ class FakeGaia { GaiaAuthConsumer::ReAuthProofTokenStatus next_reauth_status_ = GaiaAuthConsumer::ReAuthProofTokenStatus::kSuccess; GURL embedded_setup_chromeos_iframe_url_; - DISALLOW_COPY_AND_ASSIGN(FakeGaia); }; #endif // GOOGLE_APIS_GAIA_FAKE_GAIA_H_ diff --git a/chromium/google_apis/gaia/fake_oauth2_access_token_manager.h b/chromium/google_apis/gaia/fake_oauth2_access_token_manager.h index 58209869fac..4fef68ffc34 100644 --- a/chromium/google_apis/gaia/fake_oauth2_access_token_manager.h +++ b/chromium/google_apis/gaia/fake_oauth2_access_token_manager.h @@ -33,6 +33,11 @@ class FakeOAuth2AccessTokenManager : public OAuth2AccessTokenManager { explicit FakeOAuth2AccessTokenManager( OAuth2AccessTokenManager::Delegate* delegate); + + FakeOAuth2AccessTokenManager(const FakeOAuth2AccessTokenManager&) = delete; + FakeOAuth2AccessTokenManager& operator=(const FakeOAuth2AccessTokenManager&) = + delete; + ~FakeOAuth2AccessTokenManager() override; // Gets a list of active requests (can be used by tests to validate that the @@ -117,8 +122,6 @@ class FakeOAuth2AccessTokenManager : public OAuth2AccessTokenManager { bool auto_post_fetch_response_on_message_loop_; base::WeakPtrFactory<FakeOAuth2AccessTokenManager> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(FakeOAuth2AccessTokenManager); }; #endif // GOOGLE_APIS_GAIA_FAKE_OAUTH2_ACCESS_TOKEN_MANAGER_H_ diff --git a/chromium/google_apis/gaia/gaia_auth_fetcher.h b/chromium/google_apis/gaia/gaia_auth_fetcher.h index a448d715e89..f1ef340aa68 100644 --- a/chromium/google_apis/gaia/gaia_auth_fetcher.h +++ b/chromium/google_apis/gaia/gaia_auth_fetcher.h @@ -90,6 +90,10 @@ class GaiaAuthFetcher { GaiaAuthConsumer* consumer, gaia::GaiaSource source, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); + + GaiaAuthFetcher(const GaiaAuthFetcher&) = delete; + GaiaAuthFetcher& operator=(const GaiaAuthFetcher&) = delete; + virtual ~GaiaAuthFetcher(); // Start a request to revoke |auth_token|. @@ -405,8 +409,6 @@ class GaiaAuthFetcher { FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); - - DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); }; #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ diff --git a/chromium/google_apis/gaia/gaia_auth_util.cc b/chromium/google_apis/gaia/gaia_auth_util.cc index 462d9997a89..262cdafe284 100644 --- a/chromium/google_apis/gaia/gaia_auth_util.cc +++ b/chromium/google_apis/gaia/gaia_auth_util.cc @@ -171,10 +171,10 @@ bool ParseListAccountsData(const std::string& data, listed_account.signed_out = signed_out != 0; listed_account.verified = verified != 0; listed_account.raw_email = email; - auto* list = + auto* accounts_ptr = listed_account.signed_out ? signed_out_accounts : accounts; - if (list) - list->push_back(listed_account); + if (accounts_ptr) + accounts_ptr->push_back(listed_account); } } } diff --git a/chromium/google_apis/gaia/gaia_config.cc b/chromium/google_apis/gaia/gaia_config.cc index 1785e58baed..c864eb2ce1e 100644 --- a/chromium/google_apis/gaia/gaia_config.cc +++ b/chromium/google_apis/gaia/gaia_config.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "google_apis/gaia/gaia_config.h" -#include <memory> #include "base/command_line.h" #include "base/files/file_util.h" @@ -13,66 +12,12 @@ #include "base/memory/ptr_util.h" #include "base/no_destructor.h" #include "base/strings/string_piece.h" +#include "base/threading/thread_restrictions.h" #include "google_apis/gaia/gaia_switches.h" #include "google_apis/google_api_keys.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" -namespace { - -std::unique_ptr<GaiaConfig> ReadConfigFromString( - const std::string& config_contents) { - absl::optional<base::Value> dict = base::JSONReader::Read(config_contents); - if (!dict || !dict->is_dict()) { - LOG(FATAL) << "Couldn't parse Gaia config file"; - return nullptr; - } - - return std::make_unique<GaiaConfig>(std::move(dict.value())); -} - -std::unique_ptr<GaiaConfig> ReadConfigFromDisk( - const base::FilePath& config_path) { - std::string config_contents; - if (!base::ReadFileToString(config_path, &config_contents)) { - LOG(FATAL) << "Couldn't read Gaia config file " << config_path; - return nullptr; - } - return ReadConfigFromString(config_contents); -} - -std::unique_ptr<GaiaConfig> ReadConfigFromCommandLineSwitches( - const base::CommandLine* command_line) { - if (command_line->HasSwitch(switches::kGaiaConfigPath) && - command_line->HasSwitch(switches::kGaiaConfigContents)) { - LOG(FATAL) << "Either a Gaia config file path or a config file contents " - "can be provided; " - << "not both"; - return nullptr; - } - - if (command_line->HasSwitch(switches::kGaiaConfigContents)) { - return ReadConfigFromString( - command_line->GetSwitchValueASCII(switches::kGaiaConfigContents)); - } - - if (command_line->HasSwitch(switches::kGaiaConfigPath)) { - return ReadConfigFromDisk( - command_line->GetSwitchValuePath(switches::kGaiaConfigPath)); - } - - return nullptr; -} - -std::unique_ptr<GaiaConfig>* GetGlobalConfig() { - static base::NoDestructor<std::unique_ptr<GaiaConfig>> config( - ReadConfigFromCommandLineSwitches( - base::CommandLine::ForCurrentProcess())); - return config.get(); -} - -} // namespace - // static GaiaConfig* GaiaConfig::GetInstance() { return GetGlobalConfig()->get(); @@ -143,3 +88,63 @@ void GaiaConfig::ResetInstanceForTesting() { *GetGlobalConfig() = ReadConfigFromCommandLineSwitches(base::CommandLine::ForCurrentProcess()); } + +// static +std::unique_ptr<GaiaConfig>* GaiaConfig::GetGlobalConfig() { + static base::NoDestructor<std::unique_ptr<GaiaConfig>> config( + ReadConfigFromCommandLineSwitches( + base::CommandLine::ForCurrentProcess())); + return config.get(); +} + +// static +std::unique_ptr<GaiaConfig> GaiaConfig::ReadConfigFromString( + const std::string& config_contents) { + absl::optional<base::Value> dict = base::JSONReader::Read(config_contents); + if (!dict || !dict->is_dict()) { + LOG(FATAL) << "Couldn't parse Gaia config file"; + return nullptr; + } + + return std::make_unique<GaiaConfig>(std::move(dict.value())); +} + +// static +std::unique_ptr<GaiaConfig> GaiaConfig::ReadConfigFromDisk( + const base::FilePath& config_path) { + // Blocking is okay here because this code is executed only when the + // --gaia-config command line flag is specified. --gaia-config is only used + // for development. + base::ScopedAllowBlocking scoped_allow_blocking; + + std::string config_contents; + if (!base::ReadFileToString(config_path, &config_contents)) { + LOG(FATAL) << "Couldn't read Gaia config file " << config_path; + return nullptr; + } + return ReadConfigFromString(config_contents); +} + +// static +std::unique_ptr<GaiaConfig> GaiaConfig::ReadConfigFromCommandLineSwitches( + const base::CommandLine* command_line) { + if (command_line->HasSwitch(switches::kGaiaConfigPath) && + command_line->HasSwitch(switches::kGaiaConfigContents)) { + LOG(FATAL) << "Either a Gaia config file path or a config file contents " + "can be provided; " + << "not both"; + return nullptr; + } + + if (command_line->HasSwitch(switches::kGaiaConfigContents)) { + return ReadConfigFromString( + command_line->GetSwitchValueASCII(switches::kGaiaConfigContents)); + } + + if (command_line->HasSwitch(switches::kGaiaConfigPath)) { + return ReadConfigFromDisk( + command_line->GetSwitchValuePath(switches::kGaiaConfigPath)); + } + + return nullptr; +} diff --git a/chromium/google_apis/gaia/gaia_config.h b/chromium/google_apis/gaia/gaia_config.h index ee511fa4682..1484b411bdf 100644 --- a/chromium/google_apis/gaia/gaia_config.h +++ b/chromium/google_apis/gaia/gaia_config.h @@ -6,6 +6,7 @@ #define GOOGLE_APIS_GAIA_GAIA_CONFIG_H_ #include <memory> +#include <string> #include "base/gtest_prod_util.h" #include "base/strings/string_piece_forward.h" @@ -16,6 +17,7 @@ class GURL; namespace base { class CommandLine; +class FilePath; } // namespace base // Class representing a configuration for Gaia URLs and Google API keys. @@ -77,6 +79,15 @@ class GaiaConfig { friend class GaiaUrlsTest; FRIEND_TEST_ALL_PREFIXES(GoogleAPIKeysTest, OverrideAllKeysUsingConfig); + static std::unique_ptr<GaiaConfig>* GetGlobalConfig(); + + static std::unique_ptr<GaiaConfig> ReadConfigFromString( + const std::string& config_contents); + static std::unique_ptr<GaiaConfig> ReadConfigFromDisk( + const base::FilePath& config_path); + static std::unique_ptr<GaiaConfig> ReadConfigFromCommandLineSwitches( + const base::CommandLine* command_line); + // Re-reads the config from disk and resets the global instance of GaiaConfig. static void ResetInstanceForTesting(); diff --git a/chromium/google_apis/gaia/gaia_constants.cc b/chromium/google_apis/gaia/gaia_constants.cc index 07990e3df5f..8d77b6d1541 100644 --- a/chromium/google_apis/gaia/gaia_constants.cc +++ b/chromium/google_apis/gaia/gaia_constants.cc @@ -128,6 +128,10 @@ const char kDriveReadOnlyOAuth2Scope[] = const char kAssistantOAuth2Scope[] = "https://www.googleapis.com/auth/assistant-sdk-prototype"; +// OAuth2 scope for access to nearby devices (fast pair) APIs. +const char kCloudPlatformProjectsOAuth2Scope[] = + "https://www.googleapis.com/auth/cloudplatformprojects"; + // OAuth2 scope for access to nearby sharing. const char kNearbyShareOAuth2Scope[] = "https://www.googleapis.com/auth/nearbysharing-pa"; @@ -149,6 +153,14 @@ const char kAccountCapabilitiesOAuth2Scope[] = const char kSupportContentOAuth2Scope[] = "https://www.googleapis.com/auth/supportcontent"; +// OAuth 2 scope for NTP Photos module API. +const char kPhotosModuleOAuth2Scope[] = + "https://www.googleapis.com/auth/photos.firstparty.readonly"; + +// OAuth 2 scope for NTP Photos module image API. +const char kPhotosModuleImageOAuth2Scope[] = + "https://www.googleapis.com/auth/photos.image.readonly"; + // Used to mint uber auth tokens when needed. const char kGaiaSid[] = "sid"; const char kGaiaLsid[] = "lsid"; diff --git a/chromium/google_apis/gaia/gaia_constants.h b/chromium/google_apis/gaia/gaia_constants.h index a6306a2e0a6..491c23ab0e6 100644 --- a/chromium/google_apis/gaia/gaia_constants.h +++ b/chromium/google_apis/gaia/gaia_constants.h @@ -52,12 +52,15 @@ extern const char kCryptAuthOAuth2Scope[]; extern const char kDriveOAuth2Scope[]; extern const char kDriveReadOnlyOAuth2Scope[]; extern const char kAssistantOAuth2Scope[]; +extern const char kCloudPlatformProjectsOAuth2Scope[]; extern const char kNearbyShareOAuth2Scope[]; extern const char kGCMGroupServerOAuth2Scope[]; extern const char kGCMCheckinServerOAuth2Scope[]; extern const char kChromeWebstoreOAuth2Scope[]; extern const char kAccountCapabilitiesOAuth2Scope[]; extern const char kSupportContentOAuth2Scope[]; +extern const char kPhotosModuleOAuth2Scope[]; +extern const char kPhotosModuleImageOAuth2Scope[]; // Used with uber auth tokens when needed. extern const char kGaiaSid[]; diff --git a/chromium/google_apis/gaia/gaia_oauth_client_unittest.cc b/chromium/google_apis/gaia/gaia_oauth_client_unittest.cc index 20c805b470b..f372ddce849 100644 --- a/chromium/google_apis/gaia/gaia_oauth_client_unittest.cc +++ b/chromium/google_apis/gaia/gaia_oauth_client_unittest.cc @@ -50,6 +50,9 @@ class ResponseInjector { base::Unretained(this))); } + ResponseInjector(const ResponseInjector&) = delete; + ResponseInjector& operator=(const ResponseInjector&) = delete; + ~ResponseInjector() { url_loader_factory_->SetInterceptor( base::BindRepeating([](const network::ResourceRequest& request) { @@ -126,7 +129,6 @@ class ResponseInjector { int current_failure_count_; int max_failure_count_; std::string results_; - DISALLOW_COPY_AND_ASSIGN(ResponseInjector); }; const std::string kTestAccessToken = "1/fFAGRNJru1FTz70BzhT3Zg"; @@ -316,7 +318,7 @@ TEST_F(GaiaOAuthClientTest, NetworkFailureRecoverBackoff) { // // ... so the whole thing should take at least 307s EXPECT_GE(task_environment_.GetMockTickClock()->NowTicks() - start, - base::TimeDelta::FromSeconds(307)); + base::Seconds(307)); } TEST_F(GaiaOAuthClientTest, OAuthFailure) { diff --git a/chromium/google_apis/gaia/oauth2_access_token_consumer.cc b/chromium/google_apis/gaia/oauth2_access_token_consumer.cc index db7c8466e78..936b45b5a3c 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_consumer.cc +++ b/chromium/google_apis/gaia/oauth2_access_token_consumer.cc @@ -38,29 +38,29 @@ OAuth2AccessTokenConsumer::TokenResponse::Builder::~Builder() = default; OAuth2AccessTokenConsumer::TokenResponse::Builder& OAuth2AccessTokenConsumer::TokenResponse::Builder::WithAccessToken( - const std::string& access_token) { - access_token_ = access_token; + const std::string& token) { + access_token_ = token; return *this; } OAuth2AccessTokenConsumer::TokenResponse::Builder& OAuth2AccessTokenConsumer::TokenResponse::Builder::WithRefreshToken( - const std::string& refresh_token) { - refresh_token_ = refresh_token; + const std::string& token) { + refresh_token_ = token; return *this; } OAuth2AccessTokenConsumer::TokenResponse::Builder& OAuth2AccessTokenConsumer::TokenResponse::Builder::WithExpirationTime( - const base::Time& expiration_time) { - expiration_time_ = expiration_time; + const base::Time& time) { + expiration_time_ = time; return *this; } OAuth2AccessTokenConsumer::TokenResponse::Builder& OAuth2AccessTokenConsumer::TokenResponse::Builder::WithIdToken( - const std::string& id_token) { - id_token_ = id_token; + const std::string& token) { + id_token_ = token; return *this; } diff --git a/chromium/google_apis/gaia/oauth2_access_token_consumer.h b/chromium/google_apis/gaia/oauth2_access_token_consumer.h index 9bffd7fe3ea..53e2f398d45 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_consumer.h +++ b/chromium/google_apis/gaia/oauth2_access_token_consumer.h @@ -45,10 +45,10 @@ class OAuth2AccessTokenConsumer { Builder(); ~Builder(); - Builder& WithAccessToken(const std::string& access_token); - Builder& WithRefreshToken(const std::string& refresh_token); - Builder& WithExpirationTime(const base::Time& expiration_time); - Builder& WithIdToken(const std::string& id_token); + Builder& WithAccessToken(const std::string& token); + Builder& WithRefreshToken(const std::string& token); + Builder& WithExpirationTime(const base::Time& time); + Builder& WithIdToken(const std::string& token); TokenResponse build(); diff --git a/chromium/google_apis/gaia/oauth2_access_token_fetcher.h b/chromium/google_apis/gaia/oauth2_access_token_fetcher.h index 3c3a351ccc8..43bf900151b 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_fetcher.h +++ b/chromium/google_apis/gaia/oauth2_access_token_fetcher.h @@ -24,6 +24,10 @@ class OAuth2AccessTokenFetcher { public: explicit OAuth2AccessTokenFetcher(OAuth2AccessTokenConsumer* consumer); + + OAuth2AccessTokenFetcher(const OAuth2AccessTokenFetcher&) = delete; + OAuth2AccessTokenFetcher& operator=(const OAuth2AccessTokenFetcher&) = delete; + virtual ~OAuth2AccessTokenFetcher(); // Starts the flow with the given parameters. @@ -49,8 +53,6 @@ class OAuth2AccessTokenFetcher { private: OAuth2AccessTokenConsumer* const consumer_; - - DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher); }; #endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ diff --git a/chromium/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h b/chromium/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h index 4af0b8fec66..c7c19d6caa5 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h +++ b/chromium/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h @@ -32,6 +32,12 @@ class OAuth2AccessTokenFetcherImmediateError : public OAuth2AccessTokenFetcher { public: OAuth2AccessTokenFetcherImmediateError(OAuth2AccessTokenConsumer* consumer, const GoogleServiceAuthError& error); + + OAuth2AccessTokenFetcherImmediateError( + const OAuth2AccessTokenFetcherImmediateError&) = delete; + OAuth2AccessTokenFetcherImmediateError& operator=( + const OAuth2AccessTokenFetcherImmediateError&) = delete; + ~OAuth2AccessTokenFetcherImmediateError() override; void Start(const std::string& client_id, @@ -59,7 +65,6 @@ class OAuth2AccessTokenFetcherImmediateError : public OAuth2AccessTokenFetcher { scoped_refptr<FailCaller> failer_; GoogleServiceAuthError immediate_error_; - DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcherImmediateError); }; #endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMMEDIATE_ERROR_H_ diff --git a/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.cc b/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.cc index 24c8ecdd86f..e7a582a2c05 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.cc +++ b/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.cc @@ -340,7 +340,7 @@ bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenSuccessResponse( value->GetInteger(kExpiresInKey, &expires_in); if (ok) { token_response->expiration_time = - base::Time::Now() + base::TimeDelta::FromSeconds(9 * expires_in / 10); + base::Time::Now() + base::Seconds(9 * expires_in / 10); } return ok; } diff --git a/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.h b/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.h index 55448bb5bc2..95f17067a39 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.h +++ b/chromium/google_apis/gaia/oauth2_access_token_fetcher_impl.h @@ -60,6 +60,11 @@ class OAuth2AccessTokenFetcherImpl : public OAuth2AccessTokenFetcher { scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, const std::string& refresh_token, const std::string& auth_code = std::string()); + + OAuth2AccessTokenFetcherImpl(const OAuth2AccessTokenFetcherImpl&) = delete; + OAuth2AccessTokenFetcherImpl& operator=(const OAuth2AccessTokenFetcherImpl&) = + delete; + ~OAuth2AccessTokenFetcherImpl() override; // Implementation of OAuth2AccessTokenFetcher @@ -146,7 +151,6 @@ class OAuth2AccessTokenFetcherImpl : public OAuth2AccessTokenFetcher { ParseGetAccessTokenFailure); FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherImplTest, ParseGetAccessTokenFailureInvalidError); - DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcherImpl); }; #endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMPL_H_ diff --git a/chromium/google_apis/gaia/oauth2_access_token_manager.cc b/chromium/google_apis/gaia/oauth2_access_token_manager.cc index 62e4c145016..c41ef4b4dc1 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_manager.cc +++ b/chromium/google_apis/gaia/oauth2_access_token_manager.cc @@ -150,6 +150,10 @@ class OAuth2AccessTokenManager::Fetcher : public OAuth2AccessTokenConsumer { const ScopeSet& scopes, const std::string& consumer_name, base::WeakPtr<RequestImpl> waiting_request); + + Fetcher(const Fetcher&) = delete; + Fetcher& operator=(const Fetcher&) = delete; + ~Fetcher() override; // Add a request that is waiting for the result of this Fetcher. @@ -225,8 +229,6 @@ class OAuth2AccessTokenManager::Fetcher : public OAuth2AccessTokenConsumer { // Ensures that the fetcher is deleted only once. bool scheduled_for_deletion_ = false; - - DISALLOW_COPY_AND_ASSIGN(Fetcher); }; // static @@ -341,7 +343,7 @@ OAuth2AccessTokenManager::Fetcher::ComputeExponentialBackOffMilliseconds( bool OAuth2AccessTokenManager::Fetcher::RetryIfPossible( const GoogleServiceAuthError& error) { if (retry_number_ < oauth2_access_token_manager_->max_fetch_retry_num_) { - base::TimeDelta backoff = base::TimeDelta::FromMilliseconds( + base::TimeDelta backoff = base::Milliseconds( ComputeExponentialBackOffMilliseconds(retry_number_)); ++retry_number_; UMA_HISTOGRAM_ENUMERATION("Signin.OAuth2TokenGetRetry", error.state(), diff --git a/chromium/google_apis/gaia/oauth2_access_token_manager.h b/chromium/google_apis/gaia/oauth2_access_token_manager.h index c60b11ea476..350a92f1010 100644 --- a/chromium/google_apis/gaia/oauth2_access_token_manager.h +++ b/chromium/google_apis/gaia/oauth2_access_token_manager.h @@ -8,6 +8,7 @@ #include <map> #include <set> +#include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/sequence_checker.h" #include "base/time/time.h" @@ -179,6 +180,10 @@ class OAuth2AccessTokenManager { explicit OAuth2AccessTokenManager( OAuth2AccessTokenManager::Delegate* delegate); + + OAuth2AccessTokenManager(const OAuth2AccessTokenManager&) = delete; + OAuth2AccessTokenManager& operator=(const OAuth2AccessTokenManager&) = delete; + virtual ~OAuth2AccessTokenManager(); OAuth2AccessTokenManager::Delegate* GetDelegate(); @@ -344,8 +349,6 @@ class OAuth2AccessTokenManager { FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenManagerTest, ClearCache); FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenManagerTest, ClearCacheForAccount); FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenManagerTest, OnAccessTokenRemoved); - - DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenManager); }; #endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_MANAGER_H_ diff --git a/chromium/google_apis/gaia/oauth2_api_call_flow.h b/chromium/google_apis/gaia/oauth2_api_call_flow.h index 0684d497aba..04f61715424 100644 --- a/chromium/google_apis/gaia/oauth2_api_call_flow.h +++ b/chromium/google_apis/gaia/oauth2_api_call_flow.h @@ -31,6 +31,9 @@ class OAuth2ApiCallFlow { public: OAuth2ApiCallFlow(); + OAuth2ApiCallFlow(const OAuth2ApiCallFlow&) = delete; + OAuth2ApiCallFlow& operator=(const OAuth2ApiCallFlow&) = delete; + virtual ~OAuth2ApiCallFlow(); // Start the flow. @@ -99,8 +102,6 @@ class OAuth2ApiCallFlow { State state_; std::unique_ptr<network::SimpleURLLoader> url_loader_; - - DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); }; #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ diff --git a/chromium/google_apis/gaia/oauth2_mint_token_flow.cc b/chromium/google_apis/gaia/oauth2_mint_token_flow.cc index c71bc59f16e..7a0881b920e 100644 --- a/chromium/google_apis/gaia/oauth2_mint_token_flow.cc +++ b/chromium/google_apis/gaia/oauth2_mint_token_flow.cc @@ -400,7 +400,7 @@ bool OAuth2MintTokenFlow::ParseRemoteConsentResponse( base::Time expiration_time = base::Time(); if (max_age > 0) - expiration_time = time_now + base::TimeDelta::FromSeconds(max_age); + expiration_time = time_now + base::Seconds(max_age); std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::CreateSanitizedCookie( diff --git a/chromium/google_apis/gaia/oauth_multilogin_result.cc b/chromium/google_apis/gaia/oauth_multilogin_result.cc index f2eab6d2687..b1613cc688c 100644 --- a/chromium/google_apis/gaia/oauth_multilogin_result.cc +++ b/chromium/google_apis/gaia/oauth_multilogin_result.cc @@ -103,7 +103,7 @@ void OAuthMultiloginResult::TryParseCookiesFromValue(base::Value* json_value) { const std::string* same_site = cookie.FindStringKey("sameSite"); base::TimeDelta before_expiration = - base::TimeDelta::FromSecondsD(expiration_delta.value_or(0.0)); + base::Seconds(expiration_delta.value_or(0.0)); std::string cookie_domain = domain ? *domain : ""; std::string cookie_host = host ? *host : ""; if (cookie_domain.empty() && !cookie_host.empty() && diff --git a/chromium/google_apis/gaia/oauth_multilogin_result.h b/chromium/google_apis/gaia/oauth_multilogin_result.h index 25e8a1fc2cd..a4333d71de9 100644 --- a/chromium/google_apis/gaia/oauth_multilogin_result.h +++ b/chromium/google_apis/gaia/oauth_multilogin_result.h @@ -7,6 +7,7 @@ #include <string> +#include "base/gtest_prod_util.h" #include "base/values.h" #include "google_apis/gaia/gaia_auth_util.h" #include "net/cookies/canonical_cookie.h" diff --git a/chromium/google_apis/gaia/oauth_multilogin_result_unittest.cc b/chromium/google_apis/gaia/oauth_multilogin_result_unittest.cc index d136f01e4f2..3c56e883f86 100644 --- a/chromium/google_apis/gaia/oauth_multilogin_result_unittest.cc +++ b/chromium/google_apis/gaia/oauth_multilogin_result_unittest.cc @@ -79,8 +79,7 @@ TEST(OAuthMultiloginResultTest, TryParseCookiesFromValue) { result.TryParseCookiesFromValue(dictionary_value.get()); base::Time time_now = base::Time::Now(); - base::Time expiration_time = - (time_now + base::TimeDelta::FromSecondsD(63070000.)); + base::Time expiration_time = (time_now + base::Seconds(63070000.)); double now = time_now.ToDoubleT(); double expiration = expiration_time.ToDoubleT(); const std::vector<CanonicalCookie> cookies = { diff --git a/chromium/google_apis/gcm/base/gcm_constants.cc b/chromium/google_apis/gcm/base/gcm_constants.cc index 0db30e86e9a..b0bd3f52ac7 100644 --- a/chromium/google_apis/gcm/base/gcm_constants.cc +++ b/chromium/google_apis/gcm/base/gcm_constants.cc @@ -6,6 +6,6 @@ namespace gcm { -constexpr base::TimeDelta kIncomingMessageTTL = base::TimeDelta::FromDays(7); +constexpr base::TimeDelta kIncomingMessageTTL = base::Days(7); } // namespace gcm diff --git a/chromium/google_apis/gcm/base/socket_stream.h b/chromium/google_apis/gcm/base/socket_stream.h index 109f4168d9e..9af1517db55 100644 --- a/chromium/google_apis/gcm/base/socket_stream.h +++ b/chromium/google_apis/gcm/base/socket_stream.h @@ -65,6 +65,10 @@ class GCM_EXPORT SocketInputStream // |socket| should already be connected. explicit SocketInputStream(mojo::ScopedDataPipeConsumerHandle stream); + + SocketInputStream(const SocketInputStream&) = delete; + SocketInputStream& operator=(const SocketInputStream&) = delete; + ~SocketInputStream() override; // ZeroCopyInputStream implementation. @@ -129,8 +133,6 @@ class GCM_EXPORT SocketInputStream net::Error last_error_; base::WeakPtrFactory<SocketInputStream> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(SocketInputStream); }; // A helper class for writing to a mojo producer handle with protobuf encoded @@ -161,6 +163,10 @@ class GCM_EXPORT SocketOutputStream }; explicit SocketOutputStream(mojo::ScopedDataPipeProducerHandle stream); + + SocketOutputStream(const SocketOutputStream&) = delete; + SocketOutputStream& operator=(const SocketOutputStream&) = delete; + ~SocketOutputStream() override; // ZeroCopyOutputStream implementation. @@ -202,8 +208,6 @@ class GCM_EXPORT SocketOutputStream net::Error last_error_; base::WeakPtrFactory<SocketOutputStream> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(SocketOutputStream); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/base/socket_stream_unittest.cc b/chromium/google_apis/gcm/base/socket_stream_unittest.cc index 193d3fe8b83..6c9e282c934 100644 --- a/chromium/google_apis/gcm/base/socket_stream_unittest.cc +++ b/chromium/google_apis/gcm/base/socket_stream_unittest.cc @@ -471,10 +471,7 @@ TEST_F(GCMSocketStreamTest, WritePartialWithLengthChecking) { // to make sure data is as what we expected, and there is no trailing garbage // data. while (true) { - char buffer[5]; - uint32_t read_size = sizeof(buffer); - MojoResult r = - consumer_handle->ReadData(buffer, &read_size, MOJO_READ_DATA_FLAG_NONE); + r = consumer_handle->ReadData(buffer, &read_size, MOJO_READ_DATA_FLAG_NONE); if (r == MOJO_RESULT_SHOULD_WAIT) continue; if (r != MOJO_RESULT_OK) diff --git a/chromium/google_apis/gcm/engine/checkin_request.h b/chromium/google_apis/gcm/engine/checkin_request.h index ec345fc9cb4..093bfafadde 100644 --- a/chromium/google_apis/gcm/engine/checkin_request.h +++ b/chromium/google_apis/gcm/engine/checkin_request.h @@ -71,6 +71,10 @@ class GCM_EXPORT CheckinRequest { scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, scoped_refptr<base::SequencedTaskRunner> io_task_runner, GCMStatsRecorder* recorder); + + CheckinRequest(const CheckinRequest&) = delete; + CheckinRequest& operator=(const CheckinRequest&) = delete; + ~CheckinRequest(); void Start(); @@ -98,8 +102,6 @@ class GCM_EXPORT CheckinRequest { GCMStatsRecorder* recorder_; base::WeakPtrFactory<CheckinRequest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(CheckinRequest); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/connection_event_tracker.h b/chromium/google_apis/gcm/engine/connection_event_tracker.h index 44cb7481c5b..5be60f88812 100644 --- a/chromium/google_apis/gcm/engine/connection_event_tracker.h +++ b/chromium/google_apis/gcm/engine/connection_event_tracker.h @@ -19,6 +19,10 @@ class GCM_EXPORT ConnectionEventTracker { public: // TODO(harkness): Pass in the storage information. ConnectionEventTracker(); + + ConnectionEventTracker(const ConnectionEventTracker&) = delete; + ConnectionEventTracker& operator=(const ConnectionEventTracker&) = delete; + ~ConnectionEventTracker(); // Returns a boolean indicating whether an attempt is currently in progress. @@ -56,8 +60,6 @@ class GCM_EXPORT ConnectionEventTracker { // Number of events which were discarded due to exceeding the total number of // events collected. This is sent to GCM to represent those events. uint32_t number_discarded_events_ = 0; - - DISALLOW_COPY_AND_ASSIGN(ConnectionEventTracker); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/connection_factory_impl.cc b/chromium/google_apis/gcm/engine/connection_factory_impl.cc index 5f0fc24d53c..223d99ac8df 100644 --- a/chromium/google_apis/gcm/engine/connection_factory_impl.cc +++ b/chromium/google_apis/gcm/engine/connection_factory_impl.cc @@ -48,8 +48,7 @@ const int kConnectionResetWindowSecs = 10; // 10 seconds. bool ShouldRestorePreviousBackoff(const base::TimeTicks& login_time, const base::TimeTicks& now_ticks) { return !login_time.is_null() && - now_ticks - login_time <= - base::TimeDelta::FromSeconds(kConnectionResetWindowSecs); + now_ticks - login_time <= base::Seconds(kConnectionResetWindowSecs); } } // namespace @@ -114,8 +113,7 @@ ConnectionHandler* ConnectionFactoryImpl::GetConnectionHandler() const { void ConnectionFactoryImpl::Connect() { if (!connection_handler_) { connection_handler_ = CreateConnectionHandler( - base::TimeDelta::FromMilliseconds(kReadTimeoutMs), read_callback_, - write_callback_, + base::Milliseconds(kReadTimeoutMs), read_callback_, write_callback_, base::BindRepeating(&ConnectionFactoryImpl::ConnectionHandlerCallback, weak_ptr_factory_.GetWeakPtr())); } @@ -208,10 +206,8 @@ void ConnectionFactoryImpl::SignalConnectionReset( recorder_->RecordConnectionResetSignaled(reason); if (!last_login_time_.is_null()) { UMA_HISTOGRAM_CUSTOM_TIMES("GCM.ConnectionUpTime", - NowTicks() - last_login_time_, - base::TimeDelta::FromSeconds(1), - base::TimeDelta::FromHours(24), - 50); + NowTicks() - last_login_time_, base::Seconds(1), + base::Hours(24), 50); // |last_login_time_| will be reset below, before attempting the new // connection. } diff --git a/chromium/google_apis/gcm/engine/connection_factory_impl.h b/chromium/google_apis/gcm/engine/connection_factory_impl.h index 057386faa2f..a91e196fff6 100644 --- a/chromium/google_apis/gcm/engine/connection_factory_impl.h +++ b/chromium/google_apis/gcm/engine/connection_factory_impl.h @@ -39,6 +39,10 @@ class GCM_EXPORT ConnectionFactoryImpl scoped_refptr<base::SequencedTaskRunner> io_task_runner, GCMStatsRecorder* recorder, network::NetworkConnectionTracker* network_connection_tracker); + + ConnectionFactoryImpl(const ConnectionFactoryImpl&) = delete; + ConnectionFactoryImpl& operator=(const ConnectionFactoryImpl&) = delete; + ~ConnectionFactoryImpl() override; // ConnectionFactory implementation. @@ -196,8 +200,6 @@ class GCM_EXPORT ConnectionFactoryImpl ConnectionListener* listener_; base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/connection_factory_impl_unittest.cc b/chromium/google_apis/gcm/engine/connection_factory_impl_unittest.cc index 07ae83d3430..0bd7af25c88 100644 --- a/chromium/google_apis/gcm/engine/connection_factory_impl_unittest.cc +++ b/chromium/google_apis/gcm/engine/connection_factory_impl_unittest.cc @@ -176,7 +176,7 @@ TestConnectionFactoryImpl::TestConnectionFactoryImpl( base::BindRepeating(&WriteContinuation))), fake_handler_(scoped_handler_.get()) { // Set a non-null time. - tick_clock_.Advance(base::TimeDelta::FromMilliseconds(1)); + tick_clock_.Advance(base::Milliseconds(1)); EXPECT_EQ(mojo::CreateDataPipe(nullptr, receive_pipe_producer_, receive_pipe_consumer_), @@ -524,8 +524,7 @@ TEST_F(ConnectionFactoryImplTest, CanarySucceedsRetryDuringLogin) { // Pump the loop, to ensure the pending backoff retry has no effect. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, GetRunLoop()->QuitWhenIdleClosure(), - base::TimeDelta::FromMilliseconds(1)); + FROM_HERE, GetRunLoop()->QuitWhenIdleClosure(), base::Milliseconds(1)); WaitForConnections(); } @@ -611,7 +610,7 @@ TEST_F(ConnectionFactoryImplTest, DISABLED_SuppressConnectWhenNoNetwork) { EXPECT_TRUE(factory()->IsEndpointReachable()); // Advance clock so the login window reset isn't encountered. - factory()->tick_clock()->Advance(base::TimeDelta::FromSeconds(11)); + factory()->tick_clock()->Advance(base::Seconds(11)); // Will trigger reset, but will not attempt a new connection. factory()->OnConnectionChanged( diff --git a/chromium/google_apis/gcm/engine/connection_handler_impl.h b/chromium/google_apis/gcm/engine/connection_handler_impl.h index 5bb5514edf3..dacd5b77869 100644 --- a/chromium/google_apis/gcm/engine/connection_handler_impl.h +++ b/chromium/google_apis/gcm/engine/connection_handler_impl.h @@ -44,6 +44,10 @@ class GCM_EXPORT ConnectionHandlerImpl : public ConnectionHandler { const ProtoReceivedCallback& read_callback, const ProtoSentCallback& write_callback, const ConnectionChangedCallback& connection_callback); + + ConnectionHandlerImpl(const ConnectionHandlerImpl&) = delete; + ConnectionHandlerImpl& operator=(const ConnectionHandlerImpl&) = delete; + ~ConnectionHandlerImpl() override; // ConnectionHandler implementation. @@ -135,8 +139,6 @@ class GCM_EXPORT ConnectionHandlerImpl : public ConnectionHandler { std::vector<uint8_t> payload_input_buffer_; base::WeakPtrFactory<ConnectionHandlerImpl> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/fake_connection_factory.h b/chromium/google_apis/gcm/engine/fake_connection_factory.h index 83caf242bbd..8bcb111b113 100644 --- a/chromium/google_apis/gcm/engine/fake_connection_factory.h +++ b/chromium/google_apis/gcm/engine/fake_connection_factory.h @@ -19,6 +19,10 @@ class FakeConnectionHandler; class FakeConnectionFactory : public ConnectionFactory { public: FakeConnectionFactory(); + + FakeConnectionFactory(const FakeConnectionFactory&) = delete; + FakeConnectionFactory& operator=(const FakeConnectionFactory&) = delete; + ~FakeConnectionFactory() override; // ConnectionFactory implementation. @@ -53,8 +57,6 @@ class FakeConnectionFactory : public ConnectionFactory { bool delay_reconnect_; ConnectionListener* connection_listener_; - - DISALLOW_COPY_AND_ASSIGN(FakeConnectionFactory); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/fake_connection_handler.h b/chromium/google_apis/gcm/engine/fake_connection_handler.h index 70afb6494ff..fef70140dc1 100644 --- a/chromium/google_apis/gcm/engine/fake_connection_handler.h +++ b/chromium/google_apis/gcm/engine/fake_connection_handler.h @@ -21,6 +21,10 @@ class FakeConnectionHandler : public ConnectionHandler { FakeConnectionHandler( const ConnectionHandler::ProtoReceivedCallback& read_callback, const ConnectionHandler::ProtoSentCallback& write_callback); + + FakeConnectionHandler(const FakeConnectionHandler&) = delete; + FakeConnectionHandler& operator=(const FakeConnectionHandler&) = delete; + ~FakeConnectionHandler() override; // ConnectionHandler implementation. @@ -78,8 +82,6 @@ class FakeConnectionHandler : public ConnectionHandler { // Whether an error was encountered after a successful login. bool had_error_; - - DISALLOW_COPY_AND_ASSIGN(FakeConnectionHandler); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gcm_registration_request_handler.h b/chromium/google_apis/gcm/engine/gcm_registration_request_handler.h index 6970794ae6b..56d4c938596 100644 --- a/chromium/google_apis/gcm/engine/gcm_registration_request_handler.h +++ b/chromium/google_apis/gcm/engine/gcm_registration_request_handler.h @@ -15,6 +15,11 @@ class GCM_EXPORT GCMRegistrationRequestHandler : public RegistrationRequest::CustomRequestHandler { public: GCMRegistrationRequestHandler(const std::string& senders); + + GCMRegistrationRequestHandler(const GCMRegistrationRequestHandler&) = delete; + GCMRegistrationRequestHandler& operator=( + const GCMRegistrationRequestHandler&) = delete; + ~GCMRegistrationRequestHandler() override; // RegistrationRequest::RequestHandler overrides: @@ -24,8 +29,6 @@ class GCM_EXPORT GCMRegistrationRequestHandler private: std::string senders_; - - DISALLOW_COPY_AND_ASSIGN(GCMRegistrationRequestHandler); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gcm_request_test_base.cc b/chromium/google_apis/gcm/engine/gcm_request_test_base.cc index fb90e157bd1..d6bca76d87b 100644 --- a/chromium/google_apis/gcm/engine/gcm_request_test_base.cc +++ b/chromium/google_apis/gcm/engine/gcm_request_test_base.cc @@ -130,8 +130,7 @@ void GCMRequestTestBase::FastForwardToTriggerNextRetry() { int next_retry_delay_ms = kDefaultBackoffPolicy.initial_delay_ms; next_retry_delay_ms *= pow(kDefaultBackoffPolicy.multiply_factor, retry_count_); - task_environment_.FastForwardBy( - base::TimeDelta::FromMilliseconds(next_retry_delay_ms)); + task_environment_.FastForwardBy(base::Milliseconds(next_retry_delay_ms)); } } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gcm_request_test_base.h b/chromium/google_apis/gcm/engine/gcm_request_test_base.h index 4fe9ba2f0e2..68fa6b891ef 100644 --- a/chromium/google_apis/gcm/engine/gcm_request_test_base.h +++ b/chromium/google_apis/gcm/engine/gcm_request_test_base.h @@ -24,6 +24,10 @@ namespace gcm { class GCMRequestTestBase : public testing::Test { public: GCMRequestTestBase(); + + GCMRequestTestBase(const GCMRequestTestBase&) = delete; + GCMRequestTestBase& operator=(const GCMRequestTestBase&) = delete; + ~GCMRequestTestBase() override; const net::BackoffEntry::Policy& GetBackoffPolicy() const; @@ -69,8 +73,6 @@ class GCMRequestTestBase : public testing::Test { // Tracks the number of retries so far. int retry_count_; - - DISALLOW_COPY_AND_ASSIGN(GCMRequestTestBase); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gcm_store.h b/chromium/google_apis/gcm/engine/gcm_store.h index 0cbce3e024f..2689c1d443e 100644 --- a/chromium/google_apis/gcm/engine/gcm_store.h +++ b/chromium/google_apis/gcm/engine/gcm_store.h @@ -72,6 +72,10 @@ class GCM_EXPORT GCMStore { using UpdateCallback = base::OnceCallback<void(bool success)>; GCMStore(); + + GCMStore(const GCMStore&) = delete; + GCMStore& operator=(const GCMStore&) = delete; + virtual ~GCMStore(); // Load the data from persistent store and pass the initial state back to @@ -159,9 +163,6 @@ class GCM_EXPORT GCMStore { UpdateCallback callback) = 0; virtual void RemoveInstanceIDData(const std::string& app_id, UpdateCallback callback) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(GCMStore); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gcm_store_impl.cc b/chromium/google_apis/gcm/engine/gcm_store_impl.cc index df6a1454651..54239649a87 100644 --- a/chromium/google_apis/gcm/engine/gcm_store_impl.cc +++ b/chromium/google_apis/gcm/engine/gcm_store_impl.cc @@ -713,19 +713,19 @@ void GCMStoreImpl::Backend::SetGServicesSettings( // Remove all existing settings. leveldb::ReadOptions read_options; read_options.verify_checksums = true; - std::unique_ptr<leveldb::Iterator> iter(db_->NewIterator(read_options)); - for (iter->Seek(MakeSlice(kGServiceSettingKeyStart)); - iter->Valid() && iter->key().ToString() < kGServiceSettingKeyEnd; - iter->Next()) { - write_batch.Delete(iter->key()); + std::unique_ptr<leveldb::Iterator> db_it(db_->NewIterator(read_options)); + for (db_it->Seek(MakeSlice(kGServiceSettingKeyStart)); + db_it->Valid() && db_it->key().ToString() < kGServiceSettingKeyEnd; + db_it->Next()) { + write_batch.Delete(db_it->key()); } // Add the new settings. - for (std::map<std::string, std::string>::const_iterator iter = + for (std::map<std::string, std::string>::const_iterator map_it = settings.begin(); - iter != settings.end(); ++iter) { - write_batch.Put(MakeSlice(MakeGServiceSettingKey(iter->first)), - MakeSlice(iter->second)); + map_it != settings.end(); ++map_it) { + write_batch.Put(MakeSlice(MakeGServiceSettingKey(map_it->first)), + MakeSlice(map_it->second)); } // Update the settings digest. @@ -1019,9 +1019,8 @@ bool GCMStoreImpl::Backend::LoadIncomingMessages( << data; expiration_time = 0LL; } - if (base::Time::Now() < - base::Time::FromDeltaSinceWindowsEpoch( - base::TimeDelta::FromMicroseconds(expiration_time))) { + if (base::Time::Now() < base::Time::FromDeltaSinceWindowsEpoch( + base::Microseconds(expiration_time))) { incoming_messages->push_back(std::move(persistent_id)); } else { expired_incoming_messages.push_back(std::move(persistent_id)); @@ -1165,8 +1164,7 @@ bool GCMStoreImpl::Backend::LoadAccountMappingInfo( account_mapping.account_id.IsEmail(); base::UmaHistogramBoolean("GCM.RemoveAccountMappingWhenLoading", remove); if (remove) { - RemoveAccountMapping(account_mapping.account_id, - base::DoNothing::Repeatedly<bool>()); + RemoveAccountMapping(account_mapping.account_id, base::DoNothing()); } else { account_mappings->push_back(account_mapping); } diff --git a/chromium/google_apis/gcm/engine/gcm_store_impl.h b/chromium/google_apis/gcm/engine/gcm_store_impl.h index 872cc5f66c6..2d1dc77d7e3 100644 --- a/chromium/google_apis/gcm/engine/gcm_store_impl.h +++ b/chromium/google_apis/gcm/engine/gcm_store_impl.h @@ -34,6 +34,10 @@ class GCM_EXPORT GCMStoreImpl : public GCMStore { bool remove_account_mappings_with_email_key, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, std::unique_ptr<Encryptor> encryptor); + + GCMStoreImpl(const GCMStoreImpl&) = delete; + GCMStoreImpl& operator=(const GCMStoreImpl&) = delete; + ~GCMStoreImpl() override; // Load the directory and pass the initial state back to caller. @@ -151,8 +155,6 @@ class GCM_EXPORT GCMStoreImpl : public GCMStore { scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gcm_store_impl_unittest.cc b/chromium/google_apis/gcm/engine/gcm_store_impl_unittest.cc index b2b989594c7..834ec2e62a0 100644 --- a/chromium/google_apis/gcm/engine/gcm_store_impl_unittest.cc +++ b/chromium/google_apis/gcm/engine/gcm_store_impl_unittest.cc @@ -396,7 +396,6 @@ TEST_F(GCMStoreImplTest, OutgoingMessages) { LoadGCMStore(gcm_store.get(), &load_result); std::vector<std::string> persistent_ids; - const int kNumPersistentIds = 10; for (int i = 0; i < kNumPersistentIds; ++i) { persistent_ids.push_back(GetNextPersistentId()); mcs_proto::DataMessageStanza message; @@ -444,7 +443,6 @@ TEST_F(GCMStoreImplTest, IncomingAndOutgoingMessages) { LoadGCMStore(gcm_store.get(), &load_result); std::vector<std::string> persistent_ids; - const int kNumPersistentIds = 10; for (int i = 0; i < kNumPersistentIds; ++i) { persistent_ids.push_back(GetNextPersistentId()); gcm_store->AddIncomingMessage( diff --git a/chromium/google_apis/gcm/engine/gcm_unregistration_request_handler.h b/chromium/google_apis/gcm/engine/gcm_unregistration_request_handler.h index dead670a6a8..796459a6a29 100644 --- a/chromium/google_apis/gcm/engine/gcm_unregistration_request_handler.h +++ b/chromium/google_apis/gcm/engine/gcm_unregistration_request_handler.h @@ -16,6 +16,12 @@ class GCM_EXPORT GCMUnregistrationRequestHandler : public UnregistrationRequest::CustomRequestHandler { public: GCMUnregistrationRequestHandler(const std::string& app_id); + + GCMUnregistrationRequestHandler(const GCMUnregistrationRequestHandler&) = + delete; + GCMUnregistrationRequestHandler& operator=( + const GCMUnregistrationRequestHandler&) = delete; + ~GCMUnregistrationRequestHandler() override; // UnregistrationRequest::CustomRequestHandler overrides: @@ -26,8 +32,6 @@ class GCM_EXPORT GCMUnregistrationRequestHandler : private: std::string app_id_; - - DISALLOW_COPY_AND_ASSIGN(GCMUnregistrationRequestHandler); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gservices_settings.cc b/chromium/google_apis/gcm/engine/gservices_settings.cc index 5b5c864002e..1068ba956c4 100644 --- a/chromium/google_apis/gcm/engine/gservices_settings.cc +++ b/chromium/google_apis/gcm/engine/gservices_settings.cc @@ -178,7 +178,7 @@ namespace gcm { // static const base::TimeDelta GServicesSettings::MinimumCheckinInterval() { - return base::TimeDelta::FromSeconds(kMinimumCheckinInterval); + return base::Seconds(kMinimumCheckinInterval); } // static @@ -279,7 +279,7 @@ base::TimeDelta GServicesSettings::GetCheckinInterval() const { if (checkin_interval < kMinimumCheckinInterval) checkin_interval = kMinimumCheckinInterval; - return base::TimeDelta::FromSeconds(checkin_interval); + return base::Seconds(checkin_interval); } GURL GServicesSettings::GetCheckinURL() const { diff --git a/chromium/google_apis/gcm/engine/gservices_settings.h b/chromium/google_apis/gcm/engine/gservices_settings.h index 92a96c12d6b..090f5a5135d 100644 --- a/chromium/google_apis/gcm/engine/gservices_settings.h +++ b/chromium/google_apis/gcm/engine/gservices_settings.h @@ -31,6 +31,10 @@ class GCM_EXPORT GServicesSettings { static std::string CalculateDigest(const SettingsMap& settings); GServicesSettings(); + + GServicesSettings(const GServicesSettings&) = delete; + GServicesSettings& operator=(const GServicesSettings&) = delete; + ~GServicesSettings(); // Updates the settings based on |checkin_response|. @@ -71,8 +75,6 @@ class GCM_EXPORT GServicesSettings { // Factory for creating references in callbacks. base::WeakPtrFactory<GServicesSettings> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(GServicesSettings); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/gservices_settings_unittest.cc b/chromium/google_apis/gcm/engine/gservices_settings_unittest.cc index 1826ca8b607..469840d4627 100644 --- a/chromium/google_apis/gcm/engine/gservices_settings_unittest.cc +++ b/chromium/google_apis/gcm/engine/gservices_settings_unittest.cc @@ -66,7 +66,7 @@ GServicesSettingsTest::GServicesSettingsTest() GServicesSettingsTest::~GServicesSettingsTest() {} void GServicesSettingsTest::CheckAllSetToDefault() { - EXPECT_EQ(base::TimeDelta::FromSeconds(kDefaultCheckinInterval), + EXPECT_EQ(base::Seconds(kDefaultCheckinInterval), settings().GetCheckinInterval()); EXPECT_EQ(GURL(kDefaultCheckinURL), settings().GetCheckinURL()); EXPECT_EQ(GURL("https://mtalk.google.com:5228"), @@ -135,7 +135,7 @@ TEST_F(GServicesSettingsTest, UpdateFromLoadResult) { result.gservices_digest = kAlternativeSettingsDigest; settings().UpdateFromLoadResult(result); - EXPECT_EQ(base::TimeDelta::FromSeconds(kAlternativeCheckinInterval), + EXPECT_EQ(base::Seconds(kAlternativeCheckinInterval), settings().GetCheckinInterval()); EXPECT_EQ(GURL(kAlternativeCheckinURL), settings().GetCheckinURL()); EXPECT_EQ(GURL("https://alternative.gcm.host:7777"), @@ -174,8 +174,7 @@ TEST_F(GServicesSettingsTest, CheckinResponseUpdateCheckinInterval) { EXPECT_TRUE(settings().UpdateFromCheckinResponse(checkin_response)); // Only the checkin interval was updated: - EXPECT_EQ(base::TimeDelta::FromSeconds(86400), - settings().GetCheckinInterval()); + EXPECT_EQ(base::Seconds(86400), settings().GetCheckinInterval()); // Other settings still set to default. EXPECT_EQ(GURL("https://mtalk.google.com:5228"), @@ -203,7 +202,7 @@ TEST_F(GServicesSettingsTest, CheckinResponseUpdateRegistrationURL) { settings().GetRegistrationURL()); // Other settings still set to default. - EXPECT_EQ(base::TimeDelta::FromSeconds(kDefaultCheckinInterval), + EXPECT_EQ(base::Seconds(kDefaultCheckinInterval), settings().GetCheckinInterval()); EXPECT_EQ(GURL("https://mtalk.google.com:5228"), settings().GetMCSMainEndpoint()); @@ -228,7 +227,7 @@ TEST_F(GServicesSettingsTest, CheckinResponseUpdateCheckinURL) { EXPECT_EQ(GURL("https://new.checkin.url"), settings().GetCheckinURL()); // Other settings still set to default. - EXPECT_EQ(base::TimeDelta::FromSeconds(kDefaultCheckinInterval), + EXPECT_EQ(base::Seconds(kDefaultCheckinInterval), settings().GetCheckinInterval()); EXPECT_EQ(GURL("https://mtalk.google.com:5228"), settings().GetMCSMainEndpoint()); @@ -256,7 +255,7 @@ TEST_F(GServicesSettingsTest, CheckinResponseUpdateMCSHostname) { settings().GetMCSFallbackEndpoint()); // Other settings still set to default. - EXPECT_EQ(base::TimeDelta::FromSeconds(kDefaultCheckinInterval), + EXPECT_EQ(base::Seconds(kDefaultCheckinInterval), settings().GetCheckinInterval()); EXPECT_EQ(GURL(kDefaultCheckinURL), settings().GetCheckinURL()); EXPECT_EQ(GURL(kDefaultRegistrationURL), settings().GetRegistrationURL()); @@ -279,7 +278,7 @@ TEST_F(GServicesSettingsTest, CheckinResponseUpdateMCSSecurePort) { settings().GetMCSMainEndpoint()); // Other settings still set to default. - EXPECT_EQ(base::TimeDelta::FromSeconds(kDefaultCheckinInterval), + EXPECT_EQ(base::Seconds(kDefaultCheckinInterval), settings().GetCheckinInterval()); EXPECT_EQ(GURL(kDefaultCheckinURL), settings().GetCheckinURL()); EXPECT_EQ(GURL("https://mtalk.google.com:443"), diff --git a/chromium/google_apis/gcm/engine/heartbeat_manager.cc b/chromium/google_apis/gcm/engine/heartbeat_manager.cc index da36c09d349..00cc0d83b40 100644 --- a/chromium/google_apis/gcm/engine/heartbeat_manager.cc +++ b/chromium/google_apis/gcm/engine/heartbeat_manager.cc @@ -156,7 +156,7 @@ void HeartbeatManager::OnResume() { // avoid any tight loop scenarios. // If the |send_heartbeat_callback_| is null, it means the heartbeat manager // hasn't been started, so do nothing. - if (elapsed > base::TimeDelta::FromMilliseconds(kMinSuspendTimeMs) && + if (elapsed > base::Milliseconds(kMinSuspendTimeMs) && !send_heartbeat_callback_.is_null()) OnHeartbeatTriggered(); } @@ -186,9 +186,9 @@ void HeartbeatManager::RestartTimer() { } heartbeat_expected_time_ = - base::Time::Now() + base::TimeDelta::FromMilliseconds(interval_ms); + base::Time::Now() + base::Milliseconds(interval_ms); heartbeat_timer_->Start( - FROM_HERE, base::TimeDelta::FromMilliseconds(interval_ms), + FROM_HERE, base::Milliseconds(interval_ms), base::BindRepeating(&HeartbeatManager::OnHeartbeatTriggered, weak_ptr_factory_.GetWeakPtr())); @@ -200,7 +200,7 @@ void HeartbeatManager::RestartTimer() { FROM_HERE, base::BindOnce(&HeartbeatManager::CheckForMissedHeartbeat, weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kHeartbeatMissedCheckMs)); + base::Milliseconds(kHeartbeatMissedCheckMs)); #endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) } @@ -223,7 +223,7 @@ void HeartbeatManager::CheckForMissedHeartbeat() { FROM_HERE, base::BindOnce(&HeartbeatManager::CheckForMissedHeartbeat, weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kHeartbeatMissedCheckMs)); + base::Milliseconds(kHeartbeatMissedCheckMs)); #endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) } diff --git a/chromium/google_apis/gcm/engine/heartbeat_manager.h b/chromium/google_apis/gcm/engine/heartbeat_manager.h index 6034497c56d..d8535e34194 100644 --- a/chromium/google_apis/gcm/engine/heartbeat_manager.h +++ b/chromium/google_apis/gcm/engine/heartbeat_manager.h @@ -40,6 +40,10 @@ class GCM_EXPORT HeartbeatManager : public base::PowerSuspendObserver { scoped_refptr<base::SequencedTaskRunner> io_task_runner, scoped_refptr<base::SequencedTaskRunner> maybe_power_wrapped_io_task_runner); + + HeartbeatManager(const HeartbeatManager&) = delete; + HeartbeatManager& operator=(const HeartbeatManager&) = delete; + ~HeartbeatManager() override; // Start the heartbeat logic. @@ -137,8 +141,6 @@ class GCM_EXPORT HeartbeatManager : public base::PowerSuspendObserver { ReconnectCallback trigger_reconnect_callback_; base::WeakPtrFactory<HeartbeatManager> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(HeartbeatManager); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/heartbeat_manager_unittest.cc b/chromium/google_apis/gcm/engine/heartbeat_manager_unittest.cc index 94de8cfa0fd..2466fcd4ab8 100644 --- a/chromium/google_apis/gcm/engine/heartbeat_manager_unittest.cc +++ b/chromium/google_apis/gcm/engine/heartbeat_manager_unittest.cc @@ -156,7 +156,7 @@ TEST_F(HeartbeatManagerTest, UpdateIntervalThenStart) { EXPECT_TRUE(manager()->GetNextHeartbeatTime().is_null()); StartManager(); EXPECT_LE(manager()->GetNextHeartbeatTime() - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kIntervalMs)); + base::Milliseconds(kIntervalMs)); } // Updating the heartbeat interval after starting should only use the new @@ -166,7 +166,7 @@ TEST_F(HeartbeatManagerTest, StartThenUpdateInterval) { StartManager(); base::TimeTicks heartbeat = manager()->GetNextHeartbeatTime(); EXPECT_GT(heartbeat - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kIntervalMs)); + base::Milliseconds(kIntervalMs)); // Updating the interval should not affect an outstanding heartbeat. manager()->UpdateHeartbeatConfig(BuildHeartbeatConfig(kIntervalMs)); @@ -178,7 +178,7 @@ TEST_F(HeartbeatManagerTest, StartThenUpdateInterval) { manager()->OnHeartbeatAcked(); EXPECT_LE(manager()->GetNextHeartbeatTime() - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kIntervalMs)); + base::Milliseconds(kIntervalMs)); EXPECT_NE(heartbeat, manager()->GetNextHeartbeatTime()); } @@ -215,7 +215,7 @@ TEST_F(HeartbeatManagerTest, SetClientHeartbeatInterval) { base::TimeTicks heartbeat = manager()->GetNextHeartbeatTime(); EXPECT_GT(heartbeat - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kIntervalMs)); + base::Milliseconds(kIntervalMs)); manager()->SetClientHeartbeatIntervalMs(kIntervalMs); EXPECT_EQ(1, reconnects_triggered()); @@ -226,7 +226,7 @@ TEST_F(HeartbeatManagerTest, SetClientHeartbeatInterval) { manager()->OnHeartbeatAcked(); EXPECT_LE(manager()->GetNextHeartbeatTime() - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kIntervalMs)); + base::Milliseconds(kIntervalMs)); EXPECT_GT(heartbeat, manager()->GetNextHeartbeatTime()); const int kLongerIntervalMs = 2 * kIntervalMs; @@ -241,7 +241,7 @@ TEST_F(HeartbeatManagerTest, SetClientHeartbeatInterval) { manager()->OnHeartbeatAcked(); EXPECT_LE(manager()->GetNextHeartbeatTime() - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kIntervalMs)); + base::Milliseconds(kIntervalMs)); } // Verifies that setting the client interval too low or too high will set it to @@ -254,10 +254,10 @@ TEST_F(HeartbeatManagerTest, ClientIntervalInvalid) { StartManager(); base::TimeDelta till_heartbeat = manager()->GetNextHeartbeatTime() - base::TimeTicks::Now(); - EXPECT_GT(till_heartbeat, base::TimeDelta::FromMilliseconds( - manager()->GetMinClientHeartbeatIntervalMs())); - EXPECT_LE(till_heartbeat, base::TimeDelta::FromMilliseconds( - manager()->GetMaxClientHeartbeatIntervalMs())); + EXPECT_GT(till_heartbeat, + base::Milliseconds(manager()->GetMinClientHeartbeatIntervalMs())); + EXPECT_LE(till_heartbeat, + base::Milliseconds(manager()->GetMaxClientHeartbeatIntervalMs())); // More than max value. interval_ms = manager()->GetMaxClientHeartbeatIntervalMs() + 60 * 1000; @@ -267,8 +267,8 @@ TEST_F(HeartbeatManagerTest, ClientIntervalInvalid) { manager()->OnHeartbeatAcked(); till_heartbeat = manager()->GetNextHeartbeatTime() - base::TimeTicks::Now(); - EXPECT_LE(till_heartbeat, base::TimeDelta::FromMilliseconds( - manager()->GetMaxClientHeartbeatIntervalMs())); + EXPECT_LE(till_heartbeat, + base::Milliseconds(manager()->GetMaxClientHeartbeatIntervalMs())); } // Verifies that client interval is reset appropriately after the heartbeat is @@ -283,15 +283,15 @@ TEST_F(HeartbeatManagerTest, ClientIntervalAfterHeartbeatTriggered) { const int kDefaultAckIntervalMs = 60 * 1000; // 60 seconds. base::TimeTicks heartbeat = manager()->GetNextHeartbeatTime(); EXPECT_LE(heartbeat - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kDefaultAckIntervalMs)); + base::Milliseconds(kDefaultAckIntervalMs)); // This should reset the interval to the custom interval. manager()->OnHeartbeatAcked(); heartbeat = manager()->GetNextHeartbeatTime(); EXPECT_GT(heartbeat - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kDefaultAckIntervalMs)); + base::Milliseconds(kDefaultAckIntervalMs)); EXPECT_LE(heartbeat - base::TimeTicks::Now(), - base::TimeDelta::FromMilliseconds(kCustomIntervalMs)); + base::Milliseconds(kCustomIntervalMs)); } } // namespace diff --git a/chromium/google_apis/gcm/engine/instance_id_delete_token_request_handler.h b/chromium/google_apis/gcm/engine/instance_id_delete_token_request_handler.h index 73bf76c4317..7ca8c0ccf63 100644 --- a/chromium/google_apis/gcm/engine/instance_id_delete_token_request_handler.h +++ b/chromium/google_apis/gcm/engine/instance_id_delete_token_request_handler.h @@ -21,6 +21,12 @@ class GCM_EXPORT InstanceIDDeleteTokenRequestHandler : const std::string& authorized_entity, const std::string& scope, int gcm_version); + + InstanceIDDeleteTokenRequestHandler( + const InstanceIDDeleteTokenRequestHandler&) = delete; + InstanceIDDeleteTokenRequestHandler& operator=( + const InstanceIDDeleteTokenRequestHandler&) = delete; + ~InstanceIDDeleteTokenRequestHandler() override; // UnregistrationRequest overrides: @@ -34,8 +40,6 @@ class GCM_EXPORT InstanceIDDeleteTokenRequestHandler : std::string authorized_entity_; std::string scope_; int gcm_version_; - - DISALLOW_COPY_AND_ASSIGN(InstanceIDDeleteTokenRequestHandler); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/instance_id_get_token_request_handler.h b/chromium/google_apis/gcm/engine/instance_id_get_token_request_handler.h index 1882b02ea4a..7a5fea94d19 100644 --- a/chromium/google_apis/gcm/engine/instance_id_get_token_request_handler.h +++ b/chromium/google_apis/gcm/engine/instance_id_get_token_request_handler.h @@ -22,6 +22,12 @@ class GCM_EXPORT InstanceIDGetTokenRequestHandler const std::string& scope, int gcm_version, base::TimeDelta time_to_live); + + InstanceIDGetTokenRequestHandler(const InstanceIDGetTokenRequestHandler&) = + delete; + InstanceIDGetTokenRequestHandler& operator=( + const InstanceIDGetTokenRequestHandler&) = delete; + ~InstanceIDGetTokenRequestHandler() override; // RegistrationRequest overrides: @@ -35,8 +41,6 @@ class GCM_EXPORT InstanceIDGetTokenRequestHandler std::string scope_; int gcm_version_; base::TimeDelta time_to_live_; - - DISALLOW_COPY_AND_ASSIGN(InstanceIDGetTokenRequestHandler); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/mcs_client.h b/chromium/google_apis/gcm/engine/mcs_client.h index b069b95c8e4..741dd3c7970 100644 --- a/chromium/google_apis/gcm/engine/mcs_client.h +++ b/chromium/google_apis/gcm/engine/mcs_client.h @@ -106,6 +106,10 @@ class GCM_EXPORT MCSClient { GCMStore* gcm_store, scoped_refptr<base::SequencedTaskRunner> io_task_runner, GCMStatsRecorder* recorder); + + MCSClient(const MCSClient&) = delete; + MCSClient& operator=(const MCSClient&) = delete; + virtual ~MCSClient(); // Initialize the client. Will load any previous id/token information as well @@ -312,8 +316,6 @@ class GCM_EXPORT MCSClient { GCMStatsRecorder* recorder_; base::WeakPtrFactory<MCSClient> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(MCSClient); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/mcs_client_unittest.cc b/chromium/google_apis/gcm/engine/mcs_client_unittest.cc index 55cde78c1da..0f8bfedf703 100644 --- a/chromium/google_apis/gcm/engine/mcs_client_unittest.cc +++ b/chromium/google_apis/gcm/engine/mcs_client_unittest.cc @@ -200,7 +200,7 @@ MCSClientTest::MCSClientTest() run_loop_ = std::make_unique<base::RunLoop>(); // Advance the clock to a non-zero time. - clock_.Advance(base::TimeDelta::FromSeconds(1)); + clock_.Advance(base::Seconds(1)); } MCSClientTest::~MCSClientTest() {} @@ -438,7 +438,7 @@ TEST_F(MCSClientTest, SendMessageRMQWhileDisconnected) { EXPECT_EQ("X", sent_message_id()); EXPECT_FALSE(GetFakeHandler()->AllOutgoingMessagesReceived()); GetFakeHandler()->set_fail_send(false); - clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue - 1)); + clock()->Advance(base::Seconds(kTTLValue - 1)); connection_factory()->Connect(); WaitForMCSEvent(); // Wait for the login to finish. PumpLoop(); // Wait for the send to happen. @@ -477,7 +477,7 @@ TEST_F(MCSClientTest, SendMessageRMQOnRestart) { BuildMCSClient(); InitializeClient(); - clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue - 1)); + clock()->Advance(base::Seconds(kTTLValue - 1)); MCSMessage message2(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, kTTLValue - 1, "", 0, IMMEDIATE_ACK_NO)); @@ -793,7 +793,7 @@ TEST_F(MCSClientTest, ExpiredTTLOnSend) { IMMEDIATE_ACK_NO)); // Advance time to after the TTL. - clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue + 2)); + clock()->Advance(base::Seconds(kTTLValue + 2)); EXPECT_TRUE(sent_message_id().empty()); mcs_client()->SendMessage(message); @@ -821,7 +821,7 @@ TEST_F(MCSClientTest, ExpiredTTLOnRestart) { // Move the clock forward and rebuild the client, which should fail the // message send on restart. - clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue + 2)); + clock()->Advance(base::Seconds(kTTLValue + 2)); StoreCredentials(); BuildMCSClient(); InitializeClient(); diff --git a/chromium/google_apis/gcm/engine/registration_request.h b/chromium/google_apis/gcm/engine/registration_request.h index c50321d3840..b779336c4c9 100644 --- a/chromium/google_apis/gcm/engine/registration_request.h +++ b/chromium/google_apis/gcm/engine/registration_request.h @@ -124,6 +124,10 @@ class GCM_EXPORT RegistrationRequest { scoped_refptr<base::SequencedTaskRunner> io_task_runner, GCMStatsRecorder* recorder, const std::string& source_to_record); + + RegistrationRequest(const RegistrationRequest&) = delete; + RegistrationRequest& operator=(const RegistrationRequest&) = delete; + ~RegistrationRequest(); void Start(); @@ -162,8 +166,6 @@ class GCM_EXPORT RegistrationRequest { std::string source_to_record_; base::WeakPtrFactory<RegistrationRequest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(RegistrationRequest); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/engine/registration_request_unittest.cc b/chromium/google_apis/gcm/engine/registration_request_unittest.cc index 5a82de8ccab..26b6dfc1a61 100644 --- a/chromium/google_apis/gcm/engine/registration_request_unittest.cc +++ b/chromium/google_apis/gcm/engine/registration_request_unittest.cc @@ -489,7 +489,7 @@ TEST_F(InstanceIDGetTokenRequestTest, RequestDataAndURL) { TEST_F(InstanceIDGetTokenRequestTest, RequestDataWithTTL) { CreateRequest(false, kInstanceId, kDeveloperId, kScope, - /*time_to_live=*/base::TimeDelta::FromSeconds(100)); + /*time_to_live=*/base::Seconds(100)); request_->Start(); // Same as RequestDataAndURL except "ttl" and "X-Foo". diff --git a/chromium/google_apis/gcm/engine/unregistration_request.h b/chromium/google_apis/gcm/engine/unregistration_request.h index 287ab27a27e..81534efed3b 100644 --- a/chromium/google_apis/gcm/engine/unregistration_request.h +++ b/chromium/google_apis/gcm/engine/unregistration_request.h @@ -119,6 +119,10 @@ class GCM_EXPORT UnregistrationRequest { scoped_refptr<base::SequencedTaskRunner> io_task_runner, GCMStatsRecorder* recorder, const std::string& source_to_record); + + UnregistrationRequest(const UnregistrationRequest&) = delete; + UnregistrationRequest& operator=(const UnregistrationRequest&) = delete; + ~UnregistrationRequest(); // Starts an unregistration request. @@ -154,8 +158,6 @@ class GCM_EXPORT UnregistrationRequest { std::string source_to_record_; base::WeakPtrFactory<UnregistrationRequest> weak_ptr_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(UnregistrationRequest); }; } // namespace gcm diff --git a/chromium/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h b/chromium/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h index f81dcf9aaff..9af12e7d99c 100644 --- a/chromium/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h +++ b/chromium/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h @@ -16,6 +16,10 @@ namespace gcm { class FakeGCMStatsRecorder : public GCMStatsRecorder { public: FakeGCMStatsRecorder(); + + FakeGCMStatsRecorder(const FakeGCMStatsRecorder&) = delete; + FakeGCMStatsRecorder& operator=(const FakeGCMStatsRecorder&) = delete; + ~FakeGCMStatsRecorder() override; void RecordCheckinInitiated(uint64_t android_id) override; @@ -66,9 +70,6 @@ class FakeGCMStatsRecorder : public GCMStatsRecorder { void RecordIncomingSendError(const std::string& app_id, const std::string& receiver_id, const std::string& message_id) override; - - private: - DISALLOW_COPY_AND_ASSIGN(FakeGCMStatsRecorder); }; } // namespace gcm |