| OLD | NEW |
| 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 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 5 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 operation_registry(), | 182 operation_registry(), |
| 183 url_request_context_getter_, | 183 url_request_context_getter_, |
| 184 url_generator_, | 184 url_generator_, |
| 185 url, | 185 url, |
| 186 static_cast<int>(start_changestamp), | 186 static_cast<int>(start_changestamp), |
| 187 search_query, | 187 search_query, |
| 188 directory_resource_id, | 188 directory_resource_id, |
| 189 callback)); | 189 callback)); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Because GData WAPI support is expected to be gone somehow soon by migration |
| 193 // to the Drive API v2, so we'll reuse GetResourceListOperation to implement |
| 194 // following methods, instead of cleaning the operation class. |
| 195 |
| 192 void GDataWapiService::GetAllResourceList( | 196 void GDataWapiService::GetAllResourceList( |
| 193 const GetResourceListCallback& callback) { | 197 const GetResourceListCallback& callback) { |
| 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 195 DCHECK(!callback.is_null()); | 199 DCHECK(!callback.is_null()); |
| 196 | 200 |
| 197 // TODO(hidehiko): Implement this. | 201 runner_->StartOperationWithRetry( |
| 198 NOTIMPLEMENTED(); | 202 new GetResourceListOperation( |
| 203 operation_registry(), |
| 204 url_request_context_getter_, |
| 205 url_generator_, |
| 206 GURL(), // No override url |
| 207 0, // start changestamp |
| 208 "", // empty search query |
| 209 "", // no directory resource id |
| 210 callback)); |
| 199 } | 211 } |
| 200 | 212 |
| 201 void GDataWapiService::GetResourceListInDirectory( | 213 void GDataWapiService::GetResourceListInDirectory( |
| 202 const std::string& directory_resource_id, | 214 const std::string& directory_resource_id, |
| 203 const GetResourceListCallback& callback) { | 215 const GetResourceListCallback& callback) { |
| 204 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 205 DCHECK(!directory_resource_id.empty()); | 217 DCHECK(!directory_resource_id.empty()); |
| 206 DCHECK(!callback.is_null()); | 218 DCHECK(!callback.is_null()); |
| 207 | 219 |
| 208 // TODO(hidehiko): Implement this. | 220 runner_->StartOperationWithRetry( |
| 209 NOTIMPLEMENTED(); | 221 new GetResourceListOperation( |
| 222 operation_registry(), |
| 223 url_request_context_getter_, |
| 224 url_generator_, |
| 225 GURL(), // No override url |
| 226 0, // start changestamp |
| 227 "", // empty search query |
| 228 directory_resource_id, |
| 229 callback)); |
| 210 } | 230 } |
| 211 | 231 |
| 212 void GDataWapiService::Search(const std::string& search_query, | 232 void GDataWapiService::Search(const std::string& search_query, |
| 213 const GetResourceListCallback& callback) { | 233 const GetResourceListCallback& callback) { |
| 214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 215 DCHECK(!search_query.empty()); | 235 DCHECK(!search_query.empty()); |
| 216 DCHECK(!callback.is_null()); | 236 DCHECK(!callback.is_null()); |
| 217 | 237 |
| 218 // TODO(hidehiko): Implement this. | 238 runner_->StartOperationWithRetry( |
| 219 NOTIMPLEMENTED(); | 239 new GetResourceListOperation( |
| 240 operation_registry(), |
| 241 url_request_context_getter_, |
| 242 url_generator_, |
| 243 GURL(), // No override url |
| 244 0, // start changestamp |
| 245 search_query, |
| 246 "", // no directory resource id |
| 247 callback)); |
| 220 } | 248 } |
| 221 | 249 |
| 222 void GDataWapiService::SearchInDirectory( | 250 void GDataWapiService::SearchInDirectory( |
| 223 const std::string& search_query, | 251 const std::string& search_query, |
| 224 const std::string& directory_resource_id, | 252 const std::string& directory_resource_id, |
| 225 const GetResourceListCallback& callback) { | 253 const GetResourceListCallback& callback) { |
| 226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 227 DCHECK(!search_query.empty()); | 255 DCHECK(!search_query.empty()); |
| 228 DCHECK(!directory_resource_id.empty()); | 256 DCHECK(!directory_resource_id.empty()); |
| 229 DCHECK(!callback.is_null()); | 257 DCHECK(!callback.is_null()); |
| 230 | 258 |
| 231 // TODO(hidehiko): Implement this. | 259 runner_->StartOperationWithRetry( |
| 232 NOTIMPLEMENTED(); | 260 new GetResourceListOperation( |
| 261 operation_registry(), |
| 262 url_request_context_getter_, |
| 263 url_generator_, |
| 264 GURL(), // No override url |
| 265 0, // start changestamp |
| 266 search_query, |
| 267 directory_resource_id, |
| 268 callback)); |
| 233 } | 269 } |
| 234 | 270 |
| 235 void GDataWapiService::GetChangeList(int64 start_changestamp, | 271 void GDataWapiService::GetChangeList(int64 start_changestamp, |
| 236 const GetResourceListCallback& callback) { | 272 const GetResourceListCallback& callback) { |
| 237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 238 DCHECK(!callback.is_null()); | 274 DCHECK(!callback.is_null()); |
| 239 | 275 |
| 240 // TODO(hidehiko): Implement this. | 276 runner_->StartOperationWithRetry( |
| 241 NOTIMPLEMENTED(); | 277 new GetResourceListOperation( |
| 278 operation_registry(), |
| 279 url_request_context_getter_, |
| 280 url_generator_, |
| 281 GURL(), // No override url |
| 282 start_changestamp, |
| 283 "", // empty search query |
| 284 "", // no directory resource id |
| 285 callback)); |
| 242 } | 286 } |
| 243 | 287 |
| 244 void GDataWapiService::ContinueGetResourceList( | 288 void GDataWapiService::ContinueGetResourceList( |
| 245 const GURL& override_url, | 289 const GURL& override_url, |
| 246 const GetResourceListCallback& callback) { | 290 const GetResourceListCallback& callback) { |
| 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 292 DCHECK(!override_url.is_empty()); |
| 248 DCHECK(!callback.is_null()); | 293 DCHECK(!callback.is_null()); |
| 249 | 294 |
| 250 // TODO(hidehiko): Implement this. | 295 runner_->StartOperationWithRetry( |
| 251 NOTIMPLEMENTED(); | 296 new GetResourceListOperation( |
| 297 operation_registry(), |
| 298 url_request_context_getter_, |
| 299 url_generator_, |
| 300 override_url, |
| 301 0, // start changestamp |
| 302 "", // empty search query |
| 303 "", // no directory resource id |
| 304 callback)); |
| 252 } | 305 } |
| 253 | 306 |
| 254 void GDataWapiService::GetResourceEntry( | 307 void GDataWapiService::GetResourceEntry( |
| 255 const std::string& resource_id, | 308 const std::string& resource_id, |
| 256 const GetResourceEntryCallback& callback) { | 309 const GetResourceEntryCallback& callback) { |
| 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 310 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 258 DCHECK(!callback.is_null()); | 311 DCHECK(!callback.is_null()); |
| 259 | 312 |
| 260 runner_->StartOperationWithRetry( | 313 runner_->StartOperationWithRetry( |
| 261 new GetResourceEntryOperation( | 314 new GetResourceEntryOperation( |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 624 } |
| 572 | 625 |
| 573 void GDataWapiService::OnProgressUpdate( | 626 void GDataWapiService::OnProgressUpdate( |
| 574 const OperationProgressStatusList& list) { | 627 const OperationProgressStatusList& list) { |
| 575 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 628 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 576 FOR_EACH_OBSERVER( | 629 FOR_EACH_OBSERVER( |
| 577 DriveServiceObserver, observers_, OnProgressUpdate(list)); | 630 DriveServiceObserver, observers_, OnProgressUpdate(list)); |
| 578 } | 631 } |
| 579 | 632 |
| 580 } // namespace google_apis | 633 } // namespace google_apis |
| OLD | NEW |