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

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 11421222: Fix DriveFileSyncService::GetOriginForEntry (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 | no next file » | 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 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 } 1454 }
1455 1455
1456 bool DriveFileSyncService::GetOriginForEntry( 1456 bool DriveFileSyncService::GetOriginForEntry(
1457 const google_apis::DocumentEntry& entry, 1457 const google_apis::DocumentEntry& entry,
1458 GURL* origin_out) { 1458 GURL* origin_out) {
1459 typedef ScopedVector<google_apis::Link>::const_iterator iterator; 1459 typedef ScopedVector<google_apis::Link>::const_iterator iterator;
1460 for (iterator itr = entry.links().begin(); 1460 for (iterator itr = entry.links().begin();
1461 itr != entry.links().end(); ++itr) { 1461 itr != entry.links().end(); ++itr) {
1462 if ((*itr)->type() != google_apis::Link::LINK_PARENT) 1462 if ((*itr)->type() != google_apis::Link::LINK_PARENT)
1463 continue; 1463 continue;
1464 GURL origin(UTF16ToUTF8((*itr)->title())); 1464 GURL origin(DriveFileSyncClient::DirectoryTitleToOrigin(
1465 if (!origin.is_valid()) 1465 UTF16ToUTF8((*itr)->title())));
1466 continue; 1466 DCHECK(origin.is_valid());
1467 1467
1468 if (!metadata_store_->IsBatchSyncOrigin(origin) && 1468 if (!metadata_store_->IsBatchSyncOrigin(origin) &&
1469 !metadata_store_->IsIncrementalSyncOrigin(origin)) 1469 !metadata_store_->IsIncrementalSyncOrigin(origin))
1470 continue; 1470 continue;
1471 std::string resource_id(metadata_store_->GetResourceIdForOrigin(origin)); 1471 std::string resource_id(metadata_store_->GetResourceIdForOrigin(origin));
1472 GURL resource_link(sync_client_->ResourceIdToResourceLink(resource_id)); 1472 GURL resource_link(sync_client_->ResourceIdToResourceLink(resource_id));
1473 if ((*itr)->href().GetOrigin() != resource_link.GetOrigin() || 1473 if ((*itr)->href().GetOrigin() != resource_link.GetOrigin() ||
1474 (*itr)->href().path() != resource_link.path()) 1474 (*itr)->href().path() != resource_link.path())
1475 continue; 1475 continue;
1476 1476
(...skipping 30 matching lines...) Expand all
1507 fileapi::SyncStatusCode 1507 fileapi::SyncStatusCode
1508 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper( 1508 DriveFileSyncService::GDataErrorCodeToSyncStatusCodeWrapper(
1509 google_apis::GDataErrorCode error) const { 1509 google_apis::GDataErrorCode error) const {
1510 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); 1510 fileapi::SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
1511 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated()) 1511 if (status != fileapi::SYNC_STATUS_OK && !sync_client_->IsAuthenticated())
1512 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED; 1512 return fileapi::SYNC_STATUS_AUTHENTICATION_FAILED;
1513 return status; 1513 return status;
1514 } 1514 }
1515 1515
1516 } // namespace sync_file_system 1516 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698