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

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_api.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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc » ('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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 info.quota_bytes = quota; 338 info.quota_bytes = quota;
339 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); 339 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info);
340 SendResponse(true); 340 SendResponse(true);
341 } 341 }
342 342
343 bool SyncFileSystemSetConflictResolutionPolicyFunction::RunSync() { 343 bool SyncFileSystemSetConflictResolutionPolicyFunction::RunSync() {
344 std::string policy_string; 344 std::string policy_string;
345 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &policy_string)); 345 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &policy_string));
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_LAST_WRITE_WIN) {
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 =
354 GetSyncFileSystemService(GetProfile());
355 DCHECK(service);
356 SyncStatusCode status = service->SetConflictResolutionPolicy(
357 source_url().GetOrigin(), policy);
358 if (status != sync_file_system::SYNC_STATUS_OK) {
359 SetError(ErrorToString(status));
360 return false;
361 }
362 return true; 353 return true;
363 } 354 }
364 355
365 bool SyncFileSystemGetConflictResolutionPolicyFunction::RunSync() { 356 bool SyncFileSystemGetConflictResolutionPolicyFunction::RunSync() {
366 sync_file_system::SyncFileSystemService* service =
367 GetSyncFileSystemService(GetProfile());
368 DCHECK(service);
369 api::sync_file_system::ConflictResolutionPolicy policy =
370 ConflictResolutionPolicyToExtensionEnum(
371 service->GetConflictResolutionPolicy(source_url().GetOrigin()));
372 SetResult(new base::StringValue( 357 SetResult(new base::StringValue(
373 api::sync_file_system::ToString(policy))); 358 api::sync_file_system::ToString(
359 api::sync_file_system::CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN)));
374 return true; 360 return true;
375 } 361 }
376 362
377 bool SyncFileSystemGetServiceStatusFunction::RunSync() { 363 bool SyncFileSystemGetServiceStatusFunction::RunSync() {
378 sync_file_system::SyncFileSystemService* service = 364 sync_file_system::SyncFileSystemService* service =
379 GetSyncFileSystemService(GetProfile()); 365 GetSyncFileSystemService(GetProfile());
380 results_ = api::sync_file_system::GetServiceStatus::Results::Create( 366 results_ = api::sync_file_system::GetServiceStatus::Results::Create(
381 SyncServiceStateToExtensionEnum(service->GetSyncServiceState())); 367 SyncServiceStateToExtensionEnum(service->GetSyncServiceState()));
382 return true; 368 return true;
383 } 369 }
384 370
385 } // namespace extensions 371 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698