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

Side by Side Diff: chrome/browser/google_apis/base_operations.h

Issue 11571002: google_apis: Change protected data members to private (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/google_apis/base_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file provides base classes used to implement operations for Google APIs. 5 // This file provides base classes used to implement operations for Google APIs.
6 6
7 #ifndef CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ 7 #ifndef CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_
8 #define CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ 8 #define CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // an user operation. Must be implemented by a derived class. 130 // an user operation. Must be implemented by a derived class.
131 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) = 0; 131 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) = 0;
132 132
133 // Invoked when ProcessURLFetchResults() is completed. 133 // Invoked when ProcessURLFetchResults() is completed.
134 void OnProcessURLFetchResultsComplete(bool result); 134 void OnProcessURLFetchResultsComplete(bool result);
135 135
136 // Returns an appropriate GDataErrorCode based on the HTTP response code and 136 // Returns an appropriate GDataErrorCode based on the HTTP response code and
137 // the status of the URLFetcher. 137 // the status of the URLFetcher.
138 static GDataErrorCode GetErrorCode(const net::URLFetcher* source); 138 static GDataErrorCode GetErrorCode(const net::URLFetcher* source);
139 139
140 // The following members are used by DownloadFileOperation. 140 // By default, no temporary file will be saved. Derived classes can set
141 // TODO(satorux): Make them private. 141 // this to true in their constructors, if they want to save the downloaded
142 bool save_temp_file_; 142 // content to a temporary file.
143 FilePath output_file_path_; 143 void set_save_temp_file(bool save_temp_file) {
144 save_temp_file_ = save_temp_file;
145 }
146
147 // By default, no file will be saved. Derived classes can set an output
148 // file path in their constructors, if they want to save the donwloaded
149 // content to a file at a specific path.
150 void set_output_file_path(const FilePath& output_file_path) {
151 output_file_path_ = output_file_path;
152 }
144 153
145 private: 154 private:
146 // OperationRegistry::Operation overrides. 155 // OperationRegistry::Operation overrides.
147 virtual void DoCancel() OVERRIDE; 156 virtual void DoCancel() OVERRIDE;
148 157
149 // URLFetcherDelegate overrides. 158 // URLFetcherDelegate overrides.
150 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 159 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
151 160
152 // AuthenticatedOperationInterface overrides. 161 // AuthenticatedOperationInterface overrides.
153 virtual void OnAuthFailed(GDataErrorCode code) OVERRIDE; 162 virtual void OnAuthFailed(GDataErrorCode code) OVERRIDE;
154 163
155 net::URLRequestContextGetter* url_request_context_getter_; 164 net::URLRequestContextGetter* url_request_context_getter_;
156 ReAuthenticateCallback re_authenticate_callback_; 165 ReAuthenticateCallback re_authenticate_callback_;
157 int re_authenticate_count_; 166 int re_authenticate_count_;
158 scoped_ptr<net::URLFetcher> url_fetcher_; 167 scoped_ptr<net::URLFetcher> url_fetcher_;
159 bool started_; 168 bool started_;
160 169
170 bool save_temp_file_;
171 FilePath output_file_path_;
172
161 // WeakPtrFactory bound to the UI thread. 173 // WeakPtrFactory bound to the UI thread.
162 // Note: This should remain the last member so it'll be destroyed and 174 // Note: This should remain the last member so it'll be destroyed and
163 // invalidate its weak pointers before any other members are destroyed. 175 // invalidate its weak pointers before any other members are destroyed.
164 base::WeakPtrFactory<UrlFetchOperationBase> weak_ptr_factory_; 176 base::WeakPtrFactory<UrlFetchOperationBase> weak_ptr_factory_;
165 }; 177 };
166 178
167 //============================ EntryActionOperation ============================ 179 //============================ EntryActionOperation ============================
168 180
169 // Callback type for Delete/Move DocumentServiceInterface calls. 181 // Callback type for Delete/Move DocumentServiceInterface calls.
170 typedef base::Callback<void(GDataErrorCode error)> EntryActionCallback; 182 typedef base::Callback<void(GDataErrorCode error)> EntryActionCallback;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 245
234 // Note: This should remain the last member so it'll be destroyed and 246 // Note: This should remain the last member so it'll be destroyed and
235 // invalidate its weak pointers before any other members are destroyed. 247 // invalidate its weak pointers before any other members are destroyed.
236 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_; 248 base::WeakPtrFactory<GetDataOperation> weak_ptr_factory_;
237 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); 249 DISALLOW_COPY_AND_ASSIGN(GetDataOperation);
238 }; 250 };
239 251
240 } // namespace google_apis 252 } // namespace google_apis
241 253
242 #endif // CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_ 254 #endif // CHROME_BROWSER_GOOGLE_APIS_BASE_OPERATIONS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/google_apis/base_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698