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

Side by Side Diff: chrome/browser/sync/api/sync_change.cc

Issue 6995008: Implement new SyncAPI and convert Preferences to it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and fix compile Created 9 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 | « chrome/browser/sync/api/sync_change.h ('k') | chrome/browser/sync/api/sync_change_processor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/api/sync_change.h"
6
7 SyncChange::SyncChange() : change_type_(ACTION_INVALID) {
8 }
9
10 SyncChange::SyncChange(SyncChangeType change_type, const SyncData& sync_data)
11 : change_type_(change_type),
12 sync_data_(sync_data) {
13 DCHECK(IsValid());
14 }
15
16 SyncChange::~SyncChange() {}
17
18 bool SyncChange::IsValid() const {
19 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid())
20 return false;
21
22 // Data from the syncer must always have specifics.
23 if (!sync_data_.IsLocal())
24 return (sync_data_.GetDataType() != syncable::UNSPECIFIED);
25
26 // Local changes must always have a tag.
27 if (sync_data_.GetTag().empty())
28 return false;
29
30 // Adds and updates must have valid specifics (checked by GetDataType())
31 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE)
32 return (sync_data_.GetDataType() != syncable::UNSPECIFIED);
33
34 return true;
35 }
36
37 SyncChange::SyncChangeType SyncChange::change_type() const {
38 return change_type_;
39 }
40
41 SyncData SyncChange::sync_data() const {
42 return sync_data_;
43 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/api/sync_change.h ('k') | chrome/browser/sync/api/sync_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698