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

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

Issue 286203007: [SyncFS] Drop manual conflict resolution policy support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: drop more unused Created 6 years, 7 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 | Annotate | Revision Log
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/sync_file_system_service.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // It's possible to get an invalid FileEntry. 341 // It's possible to get an invalid FileEntry.
342 if (!url.is_valid()) { 342 if (!url.is_valid()) {
343 base::MessageLoopProxy::current()->PostTask( 343 base::MessageLoopProxy::current()->PostTask(
344 FROM_HERE, 344 FROM_HERE,
345 base::Bind(callback, 345 base::Bind(callback,
346 SYNC_FILE_ERROR_INVALID_URL, 346 SYNC_FILE_ERROR_INVALID_URL,
347 SYNC_FILE_STATUS_UNKNOWN)); 347 SYNC_FILE_STATUS_UNKNOWN));
348 return; 348 return;
349 } 349 }
350 350
351 if (GetRemoteService(url.origin())->IsConflicting(url)) {
352 base::MessageLoopProxy::current()->PostTask(
353 FROM_HERE,
354 base::Bind(callback,
355 SYNC_STATUS_OK,
356 SYNC_FILE_STATUS_CONFLICTING));
357 return;
358 }
359
360 local_service_->HasPendingLocalChanges( 351 local_service_->HasPendingLocalChanges(
361 url, 352 url,
362 base::Bind(&SyncFileSystemService::DidGetLocalChangeStatus, 353 base::Bind(&SyncFileSystemService::DidGetLocalChangeStatus,
363 AsWeakPtr(), callback)); 354 AsWeakPtr(), callback));
364 } 355 }
365 356
366 void SyncFileSystemService::AddSyncEventObserver(SyncEventObserver* observer) { 357 void SyncFileSystemService::AddSyncEventObserver(SyncEventObserver* observer) {
367 observers_.AddObserver(observer); 358 observers_.AddObserver(observer);
368 } 359 }
369 360
370 void SyncFileSystemService::RemoveSyncEventObserver( 361 void SyncFileSystemService::RemoveSyncEventObserver(
371 SyncEventObserver* observer) { 362 SyncEventObserver* observer) {
372 observers_.RemoveObserver(observer); 363 observers_.RemoveObserver(observer);
373 } 364 }
374 365
375 ConflictResolutionPolicy SyncFileSystemService::GetConflictResolutionPolicy(
376 const GURL& origin) {
377 return GetRemoteService(origin)->GetConflictResolutionPolicy(origin);
378 }
379
380 SyncStatusCode SyncFileSystemService::SetConflictResolutionPolicy(
381 const GURL& origin,
382 ConflictResolutionPolicy policy) {
383 UMA_HISTOGRAM_ENUMERATION("SyncFileSystem.ConflictResolutionPolicy",
384 policy, CONFLICT_RESOLUTION_POLICY_MAX);
385 return GetRemoteService(origin)->SetConflictResolutionPolicy(origin, policy);
386 }
387
388 LocalChangeProcessor* SyncFileSystemService::GetLocalChangeProcessor( 366 LocalChangeProcessor* SyncFileSystemService::GetLocalChangeProcessor(
389 const GURL& origin) { 367 const GURL& origin) {
390 return GetRemoteService(origin)->GetLocalChangeProcessor(); 368 return GetRemoteService(origin)->GetLocalChangeProcessor();
391 } 369 }
392 370
393 SyncFileSystemService::SyncFileSystemService(Profile* profile) 371 SyncFileSystemService::SyncFileSystemService(Profile* profile)
394 : profile_(profile), 372 : profile_(profile),
395 sync_enabled_(true) { 373 sync_enabled_(true) {
396 } 374 }
397 375
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 if (!v2_remote_service_) { 775 if (!v2_remote_service_) {
798 v2_remote_service_ = RemoteFileSyncService::CreateForBrowserContext( 776 v2_remote_service_ = RemoteFileSyncService::CreateForBrowserContext(
799 RemoteFileSyncService::V2, profile_); 777 RemoteFileSyncService::V2, profile_);
800 scoped_ptr<RemoteSyncRunner> v2_remote_syncer( 778 scoped_ptr<RemoteSyncRunner> v2_remote_syncer(
801 new RemoteSyncRunner(kRemoteSyncNameV2, this, 779 new RemoteSyncRunner(kRemoteSyncNameV2, this,
802 v2_remote_service_.get())); 780 v2_remote_service_.get()));
803 v2_remote_service_->AddServiceObserver(v2_remote_syncer.get()); 781 v2_remote_service_->AddServiceObserver(v2_remote_syncer.get());
804 v2_remote_service_->AddFileStatusObserver(this); 782 v2_remote_service_->AddFileStatusObserver(this);
805 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); 783 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get());
806 v2_remote_service_->SetSyncEnabled(sync_enabled_); 784 v2_remote_service_->SetSyncEnabled(sync_enabled_);
807 v2_remote_service_->SetDefaultConflictResolutionPolicy(
808 remote_service_->GetDefaultConflictResolutionPolicy());
809 remote_sync_runners_.push_back(v2_remote_syncer.release()); 785 remote_sync_runners_.push_back(v2_remote_syncer.release());
810 } 786 }
811 return v2_remote_service_.get(); 787 return v2_remote_service_.get();
812 } 788 }
813 789
814 } // namespace sync_file_system 790 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698