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

Side by Side Diff: chrome/browser/chromeos/policy/upload_job_impl.h

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <string> 10 #include <string>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "chrome/browser/chromeos/policy/upload_job.h" 15 #include "chrome/browser/chromeos/policy/upload_job.h"
16 #include "google_apis/gaia/oauth2_token_service.h" 16 #include "google_apis/gaia/oauth2_token_service.h"
17 #include "net/url_request/url_fetcher.h" 17 #include "net/url_request/url_fetcher.h"
18 #include "net/url_request/url_fetcher_delegate.h" 18 #include "net/url_request/url_fetcher_delegate.h"
19 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 namespace policy { 22 namespace policy {
23 23
(...skipping 23 matching lines...) Expand all
47 ~RandomMimeBoundaryGenerator() override; 47 ~RandomMimeBoundaryGenerator() override;
48 48
49 std::string GenerateBoundary() const override; // MimeBoundaryGenerator 49 std::string GenerateBoundary() const override; // MimeBoundaryGenerator
50 }; 50 };
51 51
52 UploadJobImpl(const GURL& upload_url, 52 UploadJobImpl(const GURL& upload_url,
53 const std::string& account_id, 53 const std::string& account_id,
54 OAuth2TokenService* token_service, 54 OAuth2TokenService* token_service,
55 scoped_refptr<net::URLRequestContextGetter> url_context_getter, 55 scoped_refptr<net::URLRequestContextGetter> url_context_getter,
56 Delegate* delegate, 56 Delegate* delegate,
57 scoped_ptr<MimeBoundaryGenerator> boundary_generator); 57 std::unique_ptr<MimeBoundaryGenerator> boundary_generator);
58 ~UploadJobImpl() override; 58 ~UploadJobImpl() override;
59 59
60 // UploadJob: 60 // UploadJob:
61 void AddDataSegment(const std::string& name, 61 void AddDataSegment(const std::string& name,
62 const std::string& filename, 62 const std::string& filename,
63 const std::map<std::string, std::string>& header_entries, 63 const std::map<std::string, std::string>& header_entries,
64 scoped_ptr<std::string> data) override; 64 std::unique_ptr<std::string> data) override;
65 void Start() override; 65 void Start() override;
66 66
67 private: 67 private:
68 // Indicates the current state of the UploadJobImpl. 68 // Indicates the current state of the UploadJobImpl.
69 enum State { 69 enum State {
70 IDLE, // Start() has not been called. 70 IDLE, // Start() has not been called.
71 ACQUIRING_TOKEN, // Trying to acquire the access token. 71 ACQUIRING_TOKEN, // Trying to acquire the access token.
72 PREPARING_CONTENT, // Currently encoding the content. 72 PREPARING_CONTENT, // Currently encoding the content.
73 UPLOADING, // Upload started. 73 UPLOADING, // Upload started.
74 SUCCESS, // Upload successfully completed. 74 SUCCESS, // Upload successfully completed.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // This is used to initialize the net::URLFetcher object. 115 // This is used to initialize the net::URLFetcher object.
116 const scoped_refptr<net::URLRequestContextGetter> url_context_getter_; 116 const scoped_refptr<net::URLRequestContextGetter> url_context_getter_;
117 117
118 // The delegate to be notified of events. 118 // The delegate to be notified of events.
119 Delegate* const delegate_; 119 Delegate* const delegate_;
120 120
121 // An implementation of MimeBoundaryGenerator. This instance will be used to 121 // An implementation of MimeBoundaryGenerator. This instance will be used to
122 // generate MIME boundaries when assembling the multipart request in 122 // generate MIME boundaries when assembling the multipart request in
123 // SetUpMultipart(). 123 // SetUpMultipart().
124 scoped_ptr<MimeBoundaryGenerator> boundary_generator_; 124 std::unique_ptr<MimeBoundaryGenerator> boundary_generator_;
125 125
126 // Current state the uploader is in. 126 // Current state the uploader is in.
127 State state_; 127 State state_;
128 128
129 // Contains the cached MIME boundary. 129 // Contains the cached MIME boundary.
130 scoped_ptr<std::string> mime_boundary_; 130 std::unique_ptr<std::string> mime_boundary_;
131 131
132 // Contains the cached, encoded post data. 132 // Contains the cached, encoded post data.
133 scoped_ptr<std::string> post_data_; 133 std::unique_ptr<std::string> post_data_;
134 134
135 // Keeps track of the number of retries. 135 // Keeps track of the number of retries.
136 int retry_; 136 int retry_;
137 137
138 // The OAuth request to receive the access token. 138 // The OAuth request to receive the access token.
139 scoped_ptr<OAuth2TokenService::Request> access_token_request_; 139 std::unique_ptr<OAuth2TokenService::Request> access_token_request_;
140 140
141 // The OAuth access token. 141 // The OAuth access token.
142 std::string access_token_; 142 std::string access_token_;
143 143
144 // Helper to upload the data. 144 // Helper to upload the data.
145 scoped_ptr<net::URLFetcher> upload_fetcher_; 145 std::unique_ptr<net::URLFetcher> upload_fetcher_;
146 146
147 // The data chunks to be uploaded. 147 // The data chunks to be uploaded.
148 ScopedVector<DataSegment> data_segments_; 148 ScopedVector<DataSegment> data_segments_;
149 149
150 DISALLOW_COPY_AND_ASSIGN(UploadJobImpl); 150 DISALLOW_COPY_AND_ASSIGN(UploadJobImpl);
151 }; 151 };
152 152
153 } // namespace policy 153 } // namespace policy
154 154
155 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_ 155 #endif // CHROME_BROWSER_CHROMEOS_POLICY_UPLOAD_JOB_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/upload_job.h ('k') | chrome/browser/chromeos/policy/upload_job_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698