| 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/chromeos/gdata/gdata_wapi_feed_loader.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool UseLevelDB() { | 134 bool UseLevelDB() { |
| 135 return CommandLine::ForCurrentProcess()->HasSwitch( | 135 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 136 switches::kUseLevelDBForGData); | 136 switches::kUseLevelDBForGData); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace | 139 } // namespace |
| 140 | 140 |
| 141 LoadRootFeedParams::LoadRootFeedParams( | |
| 142 bool should_load_from_server, | |
| 143 const FileOperationCallback& callback) | |
| 144 : should_load_from_server(should_load_from_server), | |
| 145 load_error(GDATA_FILE_OK), | |
| 146 load_start_time(base::Time::Now()), | |
| 147 callback(callback) { | |
| 148 } | |
| 149 | |
| 150 LoadRootFeedParams::~LoadRootFeedParams() { | |
| 151 } | |
| 152 | |
| 153 GetDocumentsParams::GetDocumentsParams( | 141 GetDocumentsParams::GetDocumentsParams( |
| 154 int64 start_changestamp, | 142 int64 start_changestamp, |
| 155 int64 root_feed_changestamp, | 143 int64 root_feed_changestamp, |
| 156 std::vector<DocumentFeed*>* feed_list, | 144 std::vector<DocumentFeed*>* feed_list, |
| 157 bool should_fetch_multiple_feeds, | 145 bool should_fetch_multiple_feeds, |
| 158 const std::string& search_query, | 146 const std::string& search_query, |
| 159 const std::string& directory_resource_id, | 147 const std::string& directory_resource_id, |
| 160 const FileOperationCallback& callback, | 148 const FileOperationCallback& callback, |
| 161 GetDocumentsUiState* ui_state) | 149 GetDocumentsUiState* ui_state) |
| 162 : start_changestamp(start_changestamp), | 150 : start_changestamp(start_changestamp), |
| 163 root_feed_changestamp(root_feed_changestamp), | 151 root_feed_changestamp(root_feed_changestamp), |
| 164 feed_list(feed_list), | 152 feed_list(feed_list), |
| 165 should_fetch_multiple_feeds(should_fetch_multiple_feeds), | 153 should_fetch_multiple_feeds(should_fetch_multiple_feeds), |
| 166 search_query(search_query), | 154 search_query(search_query), |
| 167 directory_resource_id(directory_resource_id), | 155 directory_resource_id(directory_resource_id), |
| 168 callback(callback), | 156 callback(callback), |
| 169 ui_state(ui_state) { | 157 ui_state(ui_state) { |
| 170 } | 158 } |
| 171 | 159 |
| 172 GetDocumentsParams::~GetDocumentsParams() { | 160 GetDocumentsParams::~GetDocumentsParams() { |
| 173 STLDeleteElements(feed_list.get()); | 161 STLDeleteElements(feed_list.get()); |
| 174 } | 162 } |
| 175 | 163 |
| 164 LoadRootFeedParams::LoadRootFeedParams( |
| 165 bool should_load_from_server, |
| 166 const FileOperationCallback& callback) |
| 167 : should_load_from_server(should_load_from_server), |
| 168 load_error(GDATA_FILE_OK), |
| 169 load_start_time(base::Time::Now()), |
| 170 callback(callback) { |
| 171 } |
| 172 |
| 173 LoadRootFeedParams::~LoadRootFeedParams() { |
| 174 } |
| 175 |
| 176 LoadFeedParams::LoadFeedParams( |
| 177 ContentOrigin initial_origin, |
| 178 const LoadDocumentFeedCallback& feed_load_callback) |
| 179 : initial_origin(initial_origin), |
| 180 start_changestamp(0), |
| 181 root_feed_changestamp(0), |
| 182 should_fetch_multiple_feeds(true), |
| 183 feed_load_callback(feed_load_callback) { |
| 184 } |
| 185 |
| 186 LoadFeedParams::~LoadFeedParams() { |
| 187 } |
| 188 |
| 176 // Defines set of parameters sent to callback OnNotifyDocumentFeedFetched(). | 189 // Defines set of parameters sent to callback OnNotifyDocumentFeedFetched(). |
| 177 // This is a trick to update the number of fetched documents frequently on | 190 // This is a trick to update the number of fetched documents frequently on |
| 178 // UI. Due to performance reason, we need to fetch a number of files at | 191 // UI. Due to performance reason, we need to fetch a number of files at |
| 179 // a time. However, it'll take long time, and a user has no way to know | 192 // a time. However, it'll take long time, and a user has no way to know |
| 180 // the current update state. In order to make users confortable, | 193 // the current update state. In order to make users confortable, |
| 181 // we increment the number of fetched documents with more frequent but smaller | 194 // we increment the number of fetched documents with more frequent but smaller |
| 182 // steps than actual fetching. | 195 // steps than actual fetching. |
| 183 struct GetDocumentsUiState { | 196 struct GetDocumentsUiState { |
| 184 explicit GetDocumentsUiState(base::TimeTicks start_time) | 197 explicit GetDocumentsUiState(base::TimeTicks start_time) |
| 185 : num_fetched_documents(0), | 198 : num_fetched_documents(0), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 279 } |
| 267 | 280 |
| 268 void GDataWapiFeedLoader::OnGetAccountMetadata( | 281 void GDataWapiFeedLoader::OnGetAccountMetadata( |
| 269 ContentOrigin initial_origin, | 282 ContentOrigin initial_origin, |
| 270 int64 local_changestamp, | 283 int64 local_changestamp, |
| 271 const FileOperationCallback& callback, | 284 const FileOperationCallback& callback, |
| 272 GDataErrorCode status, | 285 GDataErrorCode status, |
| 273 scoped_ptr<base::Value> feed_data) { | 286 scoped_ptr<base::Value> feed_data) { |
| 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 275 | 288 |
| 289 LoadFeedParams param(initial_origin, |
| 290 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, |
| 291 weak_ptr_factory_.GetWeakPtr())); |
| 292 param.start_changestamp = local_changestamp + 1; |
| 293 param.load_finished_callback = callback; |
| 294 |
| 276 GDataFileError error = util::GDataToGDataFileError(status); | 295 GDataFileError error = util::GDataToGDataFileError(status); |
| 277 if (error != GDATA_FILE_OK) { | 296 if (error != GDATA_FILE_OK) { |
| 278 // Get changes starting from the next changestamp from what we have locally. | 297 // Get changes starting from the next changestamp from what we have locally. |
| 279 LoadFromServer(initial_origin, | 298 LoadFromServer(param); |
| 280 local_changestamp + 1, 0, | |
| 281 true, /* should_fetch_multiple_feeds */ | |
| 282 std::string() /* no search query */, | |
| 283 GURL(), /* feed not explicitly set */ | |
| 284 std::string() /* no directory resource ID */, | |
| 285 callback, | |
| 286 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, | |
| 287 weak_ptr_factory_.GetWeakPtr())); | |
| 288 return; | 299 return; |
| 289 } | 300 } |
| 290 | 301 |
| 291 scoped_ptr<AccountMetadataFeed> account_metadata; | 302 scoped_ptr<AccountMetadataFeed> account_metadata; |
| 292 if (feed_data.get()) { | 303 if (feed_data.get()) { |
| 293 account_metadata = AccountMetadataFeed::CreateFrom(*feed_data); | 304 account_metadata = AccountMetadataFeed::CreateFrom(*feed_data); |
| 294 #ifndef NDEBUG | 305 #ifndef NDEBUG |
| 295 // Save account metadata feed for analysis. | 306 // Save account metadata feed for analysis. |
| 296 const FilePath path = | 307 const FilePath path = |
| 297 cache_->GetCacheDirectoryPath(GDataCache::CACHE_TYPE_META).Append( | 308 cache_->GetCacheDirectoryPath(GDataCache::CACHE_TYPE_META).Append( |
| 298 kAccountMetadataFile); | 309 kAccountMetadataFile); |
| 299 util::PostBlockingPoolSequencedTask( | 310 util::PostBlockingPoolSequencedTask( |
| 300 FROM_HERE, | 311 FROM_HERE, |
| 301 blocking_task_runner_, | 312 blocking_task_runner_, |
| 302 base::Bind(&SaveFeedOnBlockingPoolForDebugging, | 313 base::Bind(&SaveFeedOnBlockingPoolForDebugging, |
| 303 path, base::Passed(&feed_data))); | 314 path, base::Passed(&feed_data))); |
| 304 #endif | 315 #endif |
| 305 } | 316 } |
| 306 | 317 |
| 307 if (!account_metadata.get()) { | 318 if (!account_metadata.get()) { |
| 308 LoadFromServer(initial_origin, | 319 LoadFromServer(param); |
| 309 local_changestamp + 1, 0, | |
| 310 true, /* should_fetch_multiple_feeds */ | |
| 311 std::string() /* no search query */, | |
| 312 GURL(), /* feed not explicitly set */ | |
| 313 std::string() /* no directory resource ID */, | |
| 314 callback, | |
| 315 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, | |
| 316 weak_ptr_factory_.GetWeakPtr())); | |
| 317 return; | 320 return; |
| 318 } | 321 } |
| 319 | 322 |
| 320 webapps_registry_->UpdateFromFeed(*account_metadata.get()); | 323 webapps_registry_->UpdateFromFeed(*account_metadata.get()); |
| 321 | 324 |
| 322 bool changes_detected = true; | 325 bool changes_detected = true; |
| 323 if (local_changestamp >= account_metadata->largest_changestamp()) { | 326 if (local_changestamp >= account_metadata->largest_changestamp()) { |
| 324 if (local_changestamp > account_metadata->largest_changestamp()) { | 327 if (local_changestamp > account_metadata->largest_changestamp()) { |
| 325 LOG(WARNING) << "Cached client feed is fresher than server, client = " | 328 LOG(WARNING) << "Cached client feed is fresher than server, client = " |
| 326 << local_changestamp | 329 << local_changestamp |
| 327 << ", server = " | 330 << ", server = " |
| 328 << account_metadata->largest_changestamp(); | 331 << account_metadata->largest_changestamp(); |
| 329 } | 332 } |
| 330 // If our cache holds the latest state from the server, change the | 333 // If our cache holds the latest state from the server, change the |
| 331 // state to FROM_SERVER. | 334 // state to FROM_SERVER. |
| 332 directory_service_->set_origin( | 335 directory_service_->set_origin( |
| 333 initial_origin == FROM_CACHE ? FROM_SERVER : initial_origin); | 336 initial_origin == FROM_CACHE ? FROM_SERVER : initial_origin); |
| 334 changes_detected = false; | 337 changes_detected = false; |
| 335 } | 338 } |
| 336 | 339 |
| 337 // No changes detected, tell the client that the loading was successful. | 340 // No changes detected, tell the client that the loading was successful. |
| 338 if (!changes_detected) { | 341 if (!changes_detected) { |
| 339 if (!callback.is_null()) | 342 if (!callback.is_null()) |
| 340 callback.Run(GDATA_FILE_OK); | 343 callback.Run(GDATA_FILE_OK); |
| 341 return; | 344 return; |
| 342 } | 345 } |
| 343 | 346 |
| 347 param.start_changestamp = local_changestamp > 0 ? local_changestamp + 1 : 0; |
| 348 param.root_feed_changestamp = account_metadata->largest_changestamp(); |
| 344 // Load changes from the server. | 349 // Load changes from the server. |
| 345 LoadFromServer(initial_origin, | 350 LoadFromServer(param); |
| 346 local_changestamp > 0 ? local_changestamp + 1 : 0, | |
| 347 account_metadata->largest_changestamp(), | |
| 348 true, /* should_fetch_multiple_feeds */ | |
| 349 std::string() /* no search query */, | |
| 350 GURL(), /* feed not explicitly set */ | |
| 351 std::string() /* no directory resource ID */, | |
| 352 callback, | |
| 353 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, | |
| 354 weak_ptr_factory_.GetWeakPtr())); | |
| 355 } | 351 } |
| 356 | 352 |
| 357 void GDataWapiFeedLoader::OnGetAboutResource( | 353 void GDataWapiFeedLoader::OnGetAboutResource( |
| 358 ContentOrigin initial_origin, | 354 ContentOrigin initial_origin, |
| 359 int64 local_changestamp, | 355 int64 local_changestamp, |
| 360 const FileOperationCallback& callback, | 356 const FileOperationCallback& callback, |
| 361 GDataErrorCode status, | 357 GDataErrorCode status, |
| 362 scoped_ptr<base::Value> feed_data) { | 358 scoped_ptr<base::Value> feed_data) { |
| 363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 364 | 360 |
| 361 LoadFeedParams param(initial_origin, |
| 362 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, |
| 363 weak_ptr_factory_.GetWeakPtr())); |
| 364 param.load_finished_callback = callback; |
| 365 |
| 365 GDataFileError error = util::GDataToGDataFileError(status); | 366 GDataFileError error = util::GDataToGDataFileError(status); |
| 366 if (error != GDATA_FILE_OK) { | 367 if (error != GDATA_FILE_OK) { |
| 367 // Get changes starting from the next changestamp from what we have locally. | 368 // Get changes starting from the next changestamp from what we have locally. |
| 368 LoadFromServer(initial_origin, | 369 LoadFromServer(param); |
| 369 local_changestamp + 1, 0, | |
| 370 true, /* should_fetch_multiple_feeds */ | |
| 371 std::string() /* no search query */, | |
| 372 GURL(), /* feed not explicitly set */ | |
| 373 std::string() /* no directory resource ID */, | |
| 374 callback, | |
| 375 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, | |
| 376 weak_ptr_factory_.GetWeakPtr())); | |
| 377 return; | 370 return; |
| 378 } | 371 } |
| 379 | 372 |
| 380 scoped_ptr<AboutResource> about_resource; | 373 scoped_ptr<AboutResource> about_resource; |
| 381 if (feed_data.get()) | 374 if (feed_data.get()) |
| 382 about_resource = AboutResource::CreateFrom(*feed_data); | 375 about_resource = AboutResource::CreateFrom(*feed_data); |
| 383 | 376 |
| 384 if (!about_resource.get()) { | 377 if (!about_resource.get()) { |
| 385 LoadFromServer(initial_origin, | 378 LoadFromServer(param); |
| 386 local_changestamp + 1, 0, | |
| 387 true, /* should_fetch_multiple_feeds */ | |
| 388 std::string() /* no search query */, | |
| 389 GURL(), /* feed not explicitly set */ | |
| 390 std::string() /* no directory resource ID */, | |
| 391 callback, | |
| 392 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, | |
| 393 weak_ptr_factory_.GetWeakPtr())); | |
| 394 return; | 379 return; |
| 395 } | 380 } |
| 396 | 381 |
| 397 bool changes_detected = true; | 382 bool changes_detected = true; |
| 398 int64 largest_changestamp = about_resource->largest_change_id(); | 383 int64 largest_changestamp = about_resource->largest_change_id(); |
| 399 directory_service_->InitializeRootEntry(about_resource->root_folder_id()); | 384 directory_service_->InitializeRootEntry(about_resource->root_folder_id()); |
| 400 | 385 |
| 401 if (local_changestamp >= largest_changestamp) { | 386 if (local_changestamp >= largest_changestamp) { |
| 402 if (local_changestamp > largest_changestamp) { | 387 if (local_changestamp > largest_changestamp) { |
| 403 LOG(WARNING) << "Cached client feed is fresher than server, client = " | 388 LOG(WARNING) << "Cached client feed is fresher than server, client = " |
| 404 << local_changestamp | 389 << local_changestamp |
| 405 << ", server = " | 390 << ", server = " |
| 406 << largest_changestamp; | 391 << largest_changestamp; |
| 407 } | 392 } |
| 408 // If our cache holds the latest state from the server, change the | 393 // If our cache holds the latest state from the server, change the |
| 409 // state to FROM_SERVER. | 394 // state to FROM_SERVER. |
| 410 directory_service_->set_origin( | 395 directory_service_->set_origin( |
| 411 initial_origin == FROM_CACHE ? FROM_SERVER : initial_origin); | 396 initial_origin == FROM_CACHE ? FROM_SERVER : initial_origin); |
| 412 changes_detected = false; | 397 changes_detected = false; |
| 413 } | 398 } |
| 414 | 399 |
| 415 // No changes detected, tell the client that the loading was successful. | 400 // No changes detected, tell the client that the loading was successful. |
| 416 if (!changes_detected) { | 401 if (!changes_detected) { |
| 417 if (!callback.is_null()) | 402 if (!callback.is_null()) |
| 418 callback.Run(GDATA_FILE_OK); | 403 callback.Run(GDATA_FILE_OK); |
| 419 return; | 404 return; |
| 420 } | 405 } |
| 421 | 406 |
| 422 // Load changes from the server. | 407 // Load changes from the server. |
| 423 LoadFromServer(initial_origin, | 408 param.start_changestamp = local_changestamp > 0 ? local_changestamp + 1 : 0; |
| 424 local_changestamp > 0 ? local_changestamp + 1 : 0, | 409 param.root_feed_changestamp = largest_changestamp; |
| 425 largest_changestamp, | 410 LoadFromServer(param); |
| 426 true, /* should_fetch_multiple_feeds */ | |
| 427 std::string() /* no search query */, | |
| 428 GURL(), /* feed not explicitly set */ | |
| 429 std::string() /* no directory resource ID */, | |
| 430 callback, | |
| 431 base::Bind(&GDataWapiFeedLoader::OnFeedFromServerLoaded, | |
| 432 weak_ptr_factory_.GetWeakPtr())); | |
| 433 } | 411 } |
| 434 | 412 |
| 435 void GDataWapiFeedLoader::OnGetApplicationList( | 413 void GDataWapiFeedLoader::OnGetApplicationList( |
| 436 GDataErrorCode status, | 414 GDataErrorCode status, |
| 437 scoped_ptr<base::Value> json) { | 415 scoped_ptr<base::Value> json) { |
| 438 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 439 | 417 |
| 440 GDataFileError error = util::GDataToGDataFileError(status); | 418 GDataFileError error = util::GDataToGDataFileError(status); |
| 441 if (error != GDATA_FILE_OK) | 419 if (error != GDATA_FILE_OK) |
| 442 return; | 420 return; |
| 443 | 421 |
| 444 if (json.get()) { | 422 if (json.get()) { |
| 445 scoped_ptr<AppList> applist(AppList::CreateFrom(*json)); | 423 scoped_ptr<AppList> applist(AppList::CreateFrom(*json)); |
| 446 if (applist.get()) { | 424 if (applist.get()) { |
| 447 VLOG(1) << "applist get success"; | 425 VLOG(1) << "applist get success"; |
| 448 webapps_registry_->UpdateFromApplicationList(*applist.get()); | 426 webapps_registry_->UpdateFromApplicationList(*applist.get()); |
| 449 } | 427 } |
| 450 } | 428 } |
| 451 } | 429 } |
| 452 | 430 |
| 453 // TODO(kochi): Fix too many parameters. http://crbug.com/141359 | 431 void GDataWapiFeedLoader::LoadFromServer(const LoadFeedParams& param) { |
| 454 void GDataWapiFeedLoader::LoadFromServer( | |
| 455 ContentOrigin initial_origin, | |
| 456 int64 start_changestamp, | |
| 457 int64 root_feed_changestamp, | |
| 458 bool should_fetch_multiple_feeds, | |
| 459 const std::string& search_query, | |
| 460 const GURL& feed_to_load, | |
| 461 const std::string& directory_resource_id, | |
| 462 const FileOperationCallback& load_finished_callback, | |
| 463 const LoadDocumentFeedCallback& feed_load_callback) { | |
| 464 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 465 DCHECK(!feed_load_callback.is_null()); | |
| 466 | 433 |
| 467 // |feed_list| will contain the list of all collected feed updates that | 434 // |feed_list| will contain the list of all collected feed updates that |
| 468 // we will receive through calls of DocumentsService::GetDocuments(). | 435 // we will receive through calls of DocumentsService::GetDocuments(). |
| 469 scoped_ptr<std::vector<DocumentFeed*> > feed_list( | 436 scoped_ptr<std::vector<DocumentFeed*> > feed_list( |
| 470 new std::vector<DocumentFeed*>); | 437 new std::vector<DocumentFeed*>); |
| 471 const base::TimeTicks start_time = base::TimeTicks::Now(); | 438 const base::TimeTicks start_time = base::TimeTicks::Now(); |
| 472 | 439 |
| 473 if (gdata::util::IsDriveV2ApiEnabled()) { | 440 if (gdata::util::IsDriveV2ApiEnabled()) { |
| 474 documents_service_->GetChangelist( | 441 documents_service_->GetChangelist( |
| 475 feed_to_load, | 442 param.feed_to_load, |
| 476 start_changestamp, | 443 param.start_changestamp, |
| 477 base::Bind(&GDataWapiFeedLoader::OnGetChangelist, | 444 base::Bind(&GDataWapiFeedLoader::OnGetChangelist, |
| 478 weak_ptr_factory_.GetWeakPtr(), | 445 weak_ptr_factory_.GetWeakPtr(), |
| 479 initial_origin, | 446 param.initial_origin, |
| 480 feed_load_callback, | 447 param.feed_load_callback, |
| 481 base::Owned(new GetDocumentsParams( | 448 base::Owned(new GetDocumentsParams( |
| 482 start_changestamp, | 449 param.start_changestamp, |
| 483 root_feed_changestamp, | 450 param.root_feed_changestamp, |
| 484 feed_list.release(), | 451 feed_list.release(), |
| 485 should_fetch_multiple_feeds, | 452 param.should_fetch_multiple_feeds, |
| 486 search_query, | 453 param.search_query, |
| 487 directory_resource_id, | 454 param.directory_resource_id, |
| 488 load_finished_callback, | 455 param.load_finished_callback, |
| 489 NULL)), | 456 NULL)), |
| 490 start_time)); | 457 start_time)); |
| 491 return; | 458 return; |
| 492 } | 459 } |
| 493 | 460 |
| 494 documents_service_->GetDocuments( | 461 documents_service_->GetDocuments( |
| 495 feed_to_load, | 462 param.feed_to_load, |
| 496 start_changestamp, | 463 param.start_changestamp, |
| 497 search_query, | 464 param.search_query, |
| 498 directory_resource_id, | 465 param.directory_resource_id, |
| 499 base::Bind(&GDataWapiFeedLoader::OnGetDocuments, | 466 base::Bind(&GDataWapiFeedLoader::OnGetDocuments, |
| 500 weak_ptr_factory_.GetWeakPtr(), | 467 weak_ptr_factory_.GetWeakPtr(), |
| 501 initial_origin, | 468 param.initial_origin, |
| 502 feed_load_callback, | 469 param.feed_load_callback, |
| 503 base::Owned(new GetDocumentsParams(start_changestamp, | 470 base::Owned( |
| 504 root_feed_changestamp, | 471 new GetDocumentsParams(param.start_changestamp, |
| 505 feed_list.release(), | 472 param.root_feed_changestamp, |
| 506 should_fetch_multiple_feeds, | 473 feed_list.release(), |
| 507 search_query, | 474 param.should_fetch_multiple_feeds, |
| 508 directory_resource_id, | 475 param.search_query, |
| 509 load_finished_callback, | 476 param.directory_resource_id, |
| 510 NULL)), | 477 param.load_finished_callback, |
| 478 NULL)), |
| 511 start_time)); | 479 start_time)); |
| 512 } | 480 } |
| 513 | 481 |
| 514 void GDataWapiFeedLoader::OnFeedFromServerLoaded(GetDocumentsParams* params, | 482 void GDataWapiFeedLoader::OnFeedFromServerLoaded(GetDocumentsParams* params, |
| 515 GDataFileError error) { | 483 GDataFileError error) { |
| 516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 484 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 517 | 485 |
| 518 if (error != GDATA_FILE_OK) { | 486 if (error != GDATA_FILE_OK) { |
| 519 if (!params->callback.is_null()) | 487 if (!params->callback.is_null()) |
| 520 params->callback.Run(error); | 488 params->callback.Run(error); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 dir_iter != changed_dirs.end(); ++dir_iter) { | 920 dir_iter != changed_dirs.end(); ++dir_iter) { |
| 953 FOR_EACH_OBSERVER(Observer, observers_, | 921 FOR_EACH_OBSERVER(Observer, observers_, |
| 954 OnDirectoryChanged(*dir_iter)); | 922 OnDirectoryChanged(*dir_iter)); |
| 955 } | 923 } |
| 956 } | 924 } |
| 957 | 925 |
| 958 return error; | 926 return error; |
| 959 } | 927 } |
| 960 | 928 |
| 961 } // namespace gdata | 929 } // namespace gdata |
| OLD | NEW |