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

Side by Side Diff: chrome/browser/sync/engine/syncer_command.cc

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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/engine/syncer_command.h"
6
7 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
8 #include "chrome/browser/sync/engine/syncer_session.h"
9 #include "chrome/browser/sync/engine/syncer_status.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h"
11 #include "chrome/browser/sync/util/event_sys-inl.h"
12 #include "chrome/browser/sync/util/sync_types.h"
13
14 namespace browser_sync {
15
16 SyncerCommand::SyncerCommand() {}
17 SyncerCommand::~SyncerCommand() {}
18
19 void SyncerCommand::Execute(SyncerSession *session) {
idana 2009/09/10 05:44:37 "SyncerSession *session" -> "SyncerSessio* session
20 ExecuteImpl(session);
21 SendNotifications(session);
22 }
23
24 void SyncerCommand::SendNotifications(SyncerSession *session) {
25 syncable::ScopedDirLookup dir(session->dirman(), session->account_name());
26 if (!dir.good()) {
27 LOG(ERROR) << "Scoped dir lookup failed!";
28 return;
29 }
30
31 SyncerStatus status(session);
32
33 if (status.IsDirty()) {
34 SyncerEvent event = { SyncerEvent::STATUS_CHANGED};
35 event.last_session = session;
36 session->syncer_event_channel()->NotifyListeners(event);
37 if (status.over_quota()) {
38 SyncerEvent quota_event = {SyncerEvent::OVER_QUOTA};
39 quota_event.last_session = session;
40 session->syncer_event_channel()->NotifyListeners(quota_event);
41 }
42 status.SetClean();
43 }
44 if (status.IsAuthDirty()) {
45 ServerConnectionEvent event;
46 event.what_happened = ServerConnectionEvent::STATUS_CHANGED;
47 event.server_reachable = true;
48 event.connection_code = HttpResponse::SYNC_AUTH_ERROR;
49 session->connection_manager()->channel()->NotifyListeners(event);
50 status.SetAuthClean();
51 }
52 }
53
54 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698