OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/engine/build_commit_command.h" | 5 #include "chrome/browser/sync/engine/build_commit_command.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 using syncable::ExtendedAttribute; | 23 using syncable::ExtendedAttribute; |
24 using syncable::Id; | 24 using syncable::Id; |
25 using syncable::MutableEntry; | 25 using syncable::MutableEntry; |
26 using syncable::Name; | 26 using syncable::Name; |
27 | 27 |
28 namespace browser_sync { | 28 namespace browser_sync { |
29 | 29 |
30 BuildCommitCommand::BuildCommitCommand() {} | 30 BuildCommitCommand::BuildCommitCommand() {} |
31 BuildCommitCommand::~BuildCommitCommand() {} | 31 BuildCommitCommand::~BuildCommitCommand() {} |
32 | 32 |
| 33 void BuildCommitCommand::AddExtensionsActivityToMessage( |
| 34 SyncerSession* session, CommitMessage* message) { |
| 35 const ExtensionsActivityMonitor::Records& records = |
| 36 session->extensions_activity(); |
| 37 for (ExtensionsActivityMonitor::Records::const_iterator it = records.begin(); |
| 38 it != records.end(); ++it) { |
| 39 sync_pb::CommitMessage_ChromiumExtensionsActivity* activity_message = |
| 40 message->add_extensions_activity(); |
| 41 activity_message->set_extension_id(it->second.extension_id); |
| 42 activity_message->set_bookmark_writes_since_last_commit( |
| 43 it->second.bookmark_write_count); |
| 44 } |
| 45 } |
| 46 |
33 void BuildCommitCommand::ExecuteImpl(SyncerSession* session) { | 47 void BuildCommitCommand::ExecuteImpl(SyncerSession* session) { |
34 ClientToServerMessage message; | 48 ClientToServerMessage message; |
35 message.set_share(ToUTF8(session->account_name()).get_string()); | 49 message.set_share(ToUTF8(session->account_name()).get_string()); |
36 message.set_message_contents(ClientToServerMessage::COMMIT); | 50 message.set_message_contents(ClientToServerMessage::COMMIT); |
37 | 51 |
38 CommitMessage* commit_message = message.mutable_commit(); | 52 CommitMessage* commit_message = message.mutable_commit(); |
39 commit_message->set_cache_guid( | 53 commit_message->set_cache_guid( |
40 session->write_transaction()->directory()->cache_guid()); | 54 session->write_transaction()->directory()->cache_guid()); |
| 55 AddExtensionsActivityToMessage(session, commit_message); |
41 | 56 |
42 const vector<Id>& commit_ids = session->commit_ids(); | 57 const vector<Id>& commit_ids = session->commit_ids(); |
43 for (size_t i = 0; i < commit_ids.size(); i++) { | 58 for (size_t i = 0; i < commit_ids.size(); i++) { |
44 Id id = commit_ids[i]; | 59 Id id = commit_ids[i]; |
45 SyncEntity* sync_entry = | 60 SyncEntity* sync_entry = |
46 static_cast<SyncEntity*>(commit_message->add_entries()); | 61 static_cast<SyncEntity*>(commit_message->add_entries()); |
47 sync_entry->set_id(id); | 62 sync_entry->set_id(id); |
48 MutableEntry meta_entry(session->write_transaction(), | 63 MutableEntry meta_entry(session->write_transaction(), |
49 syncable::GET_BY_ID, | 64 syncable::GET_BY_ID, |
50 id); | 65 id); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 SyncerProtoUtil::CopyBlobIntoProtoBytes( | 148 SyncerProtoUtil::CopyBlobIntoProtoBytes( |
134 meta_entry.Get(syncable::BOOKMARK_FAVICON), | 149 meta_entry.Get(syncable::BOOKMARK_FAVICON), |
135 bookmark->mutable_bookmark_favicon()); | 150 bookmark->mutable_bookmark_favicon()); |
136 } | 151 } |
137 } | 152 } |
138 } | 153 } |
139 session->set_commit_message(message); | 154 session->set_commit_message(message); |
140 } | 155 } |
141 | 156 |
142 } // namespace browser_sync | 157 } // namespace browser_sync |
OLD | NEW |