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

Side by Side Diff: sync/internal_api/attachments/attachment_uploader_impl.cc

Issue 642023004: Standardize usage of virtual/override/final in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/internal_api/public/attachments/attachment_uploader_impl.h" 5 #include "sync/internal_api/public/attachments/attachment_uploader_impl.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const GURL& upload_url, 48 const GURL& upload_url,
49 const scoped_refptr<net::URLRequestContextGetter>& 49 const scoped_refptr<net::URLRequestContextGetter>&
50 url_request_context_getter, 50 url_request_context_getter,
51 const Attachment& attachment, 51 const Attachment& attachment,
52 const UploadCallback& user_callback, 52 const UploadCallback& user_callback,
53 const std::string& account_id, 53 const std::string& account_id,
54 const OAuth2TokenService::ScopeSet& scopes, 54 const OAuth2TokenService::ScopeSet& scopes,
55 OAuth2TokenServiceRequest::TokenServiceProvider* token_service_provider, 55 OAuth2TokenServiceRequest::TokenServiceProvider* token_service_provider,
56 const base::WeakPtr<AttachmentUploaderImpl>& owner); 56 const base::WeakPtr<AttachmentUploaderImpl>& owner);
57 57
58 virtual ~UploadState(); 58 ~UploadState() override;
59 59
60 // Returns true if this object is stopped. Once stopped, this object is 60 // Returns true if this object is stopped. Once stopped, this object is
61 // effectively dead and can be destroyed. 61 // effectively dead and can be destroyed.
62 bool IsStopped() const; 62 bool IsStopped() const;
63 63
64 // Add |user_callback| to the list of callbacks to be invoked when this upload 64 // Add |user_callback| to the list of callbacks to be invoked when this upload
65 // completed. 65 // completed.
66 // 66 //
67 // It is an error to call |AddUserCallback| on a stopped UploadState (see 67 // It is an error to call |AddUserCallback| on a stopped UploadState (see
68 // |IsStopped|). 68 // |IsStopped|).
69 void AddUserCallback(const UploadCallback& user_callback); 69 void AddUserCallback(const UploadCallback& user_callback);
70 70
71 // Return the Attachment this object is uploading. 71 // Return the Attachment this object is uploading.
72 const Attachment& GetAttachment(); 72 const Attachment& GetAttachment();
73 73
74 // URLFetcher implementation. 74 // URLFetcher implementation.
75 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; 75 void OnURLFetchComplete(const net::URLFetcher* source) override;
76 76
77 // OAuth2TokenService::Consumer. 77 // OAuth2TokenService::Consumer.
78 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 78 void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
79 const std::string& access_token, 79 const std::string& access_token,
80 const base::Time& expiration_time) override; 80 const base::Time& expiration_time) override;
81 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 81 void OnGetTokenFailure(const OAuth2TokenService::Request* request,
82 const GoogleServiceAuthError& error) override; 82 const GoogleServiceAuthError& error) override;
83 83
84 private: 84 private:
85 typedef std::vector<UploadCallback> UploadCallbackList; 85 typedef std::vector<UploadCallback> UploadCallbackList;
86 86
87 void GetToken(); 87 void GetToken();
88 88
89 void StopAndReportResult(const UploadResult& result, 89 void StopAndReportResult(const UploadResult& result,
90 const AttachmentId& attachment_id); 90 const AttachmentId& attachment_id);
91 91
92 bool is_stopped_; 92 bool is_stopped_;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 const uint32_t crc32c_big_endian = 350 const uint32_t crc32c_big_endian =
351 base::HostToNet32(leveldb::crc32c::Value(data, size)); 351 base::HostToNet32(leveldb::crc32c::Value(data, size));
352 const base::StringPiece raw(reinterpret_cast<const char*>(&crc32c_big_endian), 352 const base::StringPiece raw(reinterpret_cast<const char*>(&crc32c_big_endian),
353 sizeof(crc32c_big_endian)); 353 sizeof(crc32c_big_endian));
354 std::string encoded; 354 std::string encoded;
355 base::Base64Encode(raw, &encoded); 355 base::Base64Encode(raw, &encoded);
356 return encoded; 356 return encoded;
357 } 357 }
358 358
359 } // namespace syncer 359 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698