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

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc

Issue 185563011: [SyncFS] Change RemoteFileSyncService interface to accept per-app conflict resolution policy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/sync_engine.h » ('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 #include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h" 5 #include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 ConflictResolutionPolicy policy = ExtensionEnumToConflictResolutionPolicy( 346 ConflictResolutionPolicy policy = ExtensionEnumToConflictResolutionPolicy(
347 api::sync_file_system::ParseConflictResolutionPolicy(policy_string)); 347 api::sync_file_system::ParseConflictResolutionPolicy(policy_string));
348 if (policy == sync_file_system::CONFLICT_RESOLUTION_POLICY_UNKNOWN) { 348 if (policy == sync_file_system::CONFLICT_RESOLUTION_POLICY_UNKNOWN) {
349 SetError(base::StringPrintf(kUnsupportedConflictResolutionPolicy, 349 SetError(base::StringPrintf(kUnsupportedConflictResolutionPolicy,
350 policy_string.c_str())); 350 policy_string.c_str()));
351 return false; 351 return false;
352 } 352 }
353 sync_file_system::SyncFileSystemService* service = 353 sync_file_system::SyncFileSystemService* service =
354 GetSyncFileSystemService(GetProfile()); 354 GetSyncFileSystemService(GetProfile());
355 DCHECK(service); 355 DCHECK(service);
356 SyncStatusCode status = service->SetConflictResolutionPolicy(policy); 356 SyncStatusCode status = service->SetConflictResolutionPolicy(
357 source_url().GetOrigin(), policy);
357 if (status != sync_file_system::SYNC_STATUS_OK) { 358 if (status != sync_file_system::SYNC_STATUS_OK) {
358 SetError(ErrorToString(status)); 359 SetError(ErrorToString(status));
359 return false; 360 return false;
360 } 361 }
361 return true; 362 return true;
362 } 363 }
363 364
364 bool SyncFileSystemGetConflictResolutionPolicyFunction::RunImpl() { 365 bool SyncFileSystemGetConflictResolutionPolicyFunction::RunImpl() {
365 sync_file_system::SyncFileSystemService* service = 366 sync_file_system::SyncFileSystemService* service =
366 GetSyncFileSystemService(GetProfile()); 367 GetSyncFileSystemService(GetProfile());
367 DCHECK(service); 368 DCHECK(service);
368 api::sync_file_system::ConflictResolutionPolicy policy = 369 api::sync_file_system::ConflictResolutionPolicy policy =
369 ConflictResolutionPolicyToExtensionEnum( 370 ConflictResolutionPolicyToExtensionEnum(
370 service->GetConflictResolutionPolicy()); 371 service->GetConflictResolutionPolicy(source_url().GetOrigin()));
371 SetResult(new base::StringValue( 372 SetResult(new base::StringValue(
372 api::sync_file_system::ToString(policy))); 373 api::sync_file_system::ToString(policy)));
373 return true; 374 return true;
374 } 375 }
375 376
376 bool SyncFileSystemGetServiceStatusFunction::RunImpl() { 377 bool SyncFileSystemGetServiceStatusFunction::RunImpl() {
377 sync_file_system::SyncFileSystemService* service = 378 sync_file_system::SyncFileSystemService* service =
378 GetSyncFileSystemService(GetProfile()); 379 GetSyncFileSystemService(GetProfile());
379 results_ = api::sync_file_system::GetServiceStatus::Results::Create( 380 results_ = api::sync_file_system::GetServiceStatus::Results::Create(
380 SyncServiceStateToExtensionEnum(service->GetSyncServiceState())); 381 SyncServiceStateToExtensionEnum(service->GetSyncServiceState()));
381 return true; 382 return true;
382 } 383 }
383 384
384 } // namespace extensions 385 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/sync_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698