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

Side by Side Diff: chrome/browser/sync/internal_api/sync_manager.cc

Issue 7719011: Move some files from sync/engine to internal_api (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Refresh the diff and remove unintended change Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/internal_api/sync_manager.h" 5 #include "chrome/browser/sync/internal_api/sync_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/sync/engine/all_status.h" 14 #include "chrome/browser/sync/engine/all_status.h"
15 #include "chrome/browser/sync/engine/change_reorder_buffer.h"
16 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 15 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
17 #include "chrome/browser/sync/engine/net/syncapi_server_connection_manager.h"
18 #include "chrome/browser/sync/engine/nigori_util.h" 16 #include "chrome/browser/sync/engine/nigori_util.h"
19 #include "chrome/browser/sync/engine/syncapi_internal.h" 17 #include "chrome/browser/sync/engine/syncapi_internal.h"
20 #include "chrome/browser/sync/engine/syncer_types.h" 18 #include "chrome/browser/sync/engine/syncer_types.h"
21 #include "chrome/browser/sync/engine/sync_scheduler.h" 19 #include "chrome/browser/sync/engine/sync_scheduler.h"
22 #include "chrome/browser/sync/internal_api/base_node.h" 20 #include "chrome/browser/sync/internal_api/base_node.h"
21 #include "chrome/browser/sync/internal_api/change_reorder_buffer.h"
22 #include "chrome/browser/sync/internal_api/configure_reason.h"
23 #include "chrome/browser/sync/internal_api/read_node.h" 23 #include "chrome/browser/sync/internal_api/read_node.h"
24 #include "chrome/browser/sync/internal_api/read_transaction.h" 24 #include "chrome/browser/sync/internal_api/read_transaction.h"
25 #include "chrome/browser/sync/internal_api/syncapi_server_connection_manager.h"
25 #include "chrome/browser/sync/internal_api/user_share.h" 26 #include "chrome/browser/sync/internal_api/user_share.h"
26 #include "chrome/browser/sync/internal_api/write_node.h" 27 #include "chrome/browser/sync/internal_api/write_node.h"
27 #include "chrome/browser/sync/internal_api/write_transaction.h" 28 #include "chrome/browser/sync/internal_api/write_transaction.h"
28 #include "chrome/browser/sync/js/js_arg_list.h" 29 #include "chrome/browser/sync/js/js_arg_list.h"
29 #include "chrome/browser/sync/js/js_backend.h" 30 #include "chrome/browser/sync/js/js_backend.h"
30 #include "chrome/browser/sync/js/js_event_details.h" 31 #include "chrome/browser/sync/js/js_event_details.h"
31 #include "chrome/browser/sync/js/js_event_handler.h" 32 #include "chrome/browser/sync/js/js_event_handler.h"
32 #include "chrome/browser/sync/js/js_reply_handler.h" 33 #include "chrome/browser/sync/js/js_reply_handler.h"
33 #include "chrome/browser/sync/js/js_sync_manager_observer.h" 34 #include "chrome/browser/sync/js/js_sync_manager_observer.h"
34 #include "chrome/browser/sync/js/js_transaction_observer.h" 35 #include "chrome/browser/sync/js/js_transaction_observer.h"
35 #include "chrome/browser/sync/notifier/sync_notifier.h" 36 #include "chrome/browser/sync/notifier/sync_notifier.h"
36 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" 37 #include "chrome/browser/sync/notifier/sync_notifier_observer.h"
37 #include "chrome/browser/sync/protocol/proto_value_conversions.h" 38 #include "chrome/browser/sync/protocol/proto_value_conversions.h"
39 #include "chrome/browser/sync/protocol/sync.pb.h"
38 #include "chrome/browser/sync/syncable/directory_change_delegate.h" 40 #include "chrome/browser/sync/syncable/directory_change_delegate.h"
39 #include "chrome/browser/sync/syncable/directory_manager.h" 41 #include "chrome/browser/sync/syncable/directory_manager.h"
40 #include "chrome/browser/sync/syncable/model_type.h" 42 #include "chrome/browser/sync/syncable/model_type.h"
41 #include "chrome/browser/sync/syncable/model_type_payload_map.h" 43 #include "chrome/browser/sync/syncable/model_type_payload_map.h"
42 #include "chrome/browser/sync/syncable/syncable.h" 44 #include "chrome/browser/sync/syncable/syncable.h"
43 #include "chrome/browser/sync/util/cryptographer.h" 45 #include "chrome/browser/sync/util/cryptographer.h"
44 #include "chrome/browser/sync/weak_handle.h" 46 #include "chrome/browser/sync/weak_handle.h"
45 #include "net/base/network_change_notifier.h" 47 #include "net/base/network_change_notifier.h"
46 48
47 using std::string; 49 using std::string;
(...skipping 20 matching lines...) Expand all
68 using browser_sync::SyncEngineEventListener; 70 using browser_sync::SyncEngineEventListener;
69 using browser_sync::SyncScheduler; 71 using browser_sync::SyncScheduler;
70 using browser_sync::Syncer; 72 using browser_sync::Syncer;
71 using browser_sync::WeakHandle; 73 using browser_sync::WeakHandle;
72 using browser_sync::sessions::SyncSessionContext; 74 using browser_sync::sessions::SyncSessionContext;
73 using syncable::DirectoryManager; 75 using syncable::DirectoryManager;
74 using syncable::EntryKernelMutationSet; 76 using syncable::EntryKernelMutationSet;
75 using syncable::ModelType; 77 using syncable::ModelType;
76 using syncable::ModelTypeBitSet; 78 using syncable::ModelTypeBitSet;
77 using syncable::SPECIFICS; 79 using syncable::SPECIFICS;
80 using sync_pb::GetUpdatesCallerInfo;
78 81
79 typedef GoogleServiceAuthError AuthError; 82 typedef GoogleServiceAuthError AuthError;
80 83
81 namespace { 84 namespace {
82 85
83 static const int kSyncSchedulerDelayMsec = 250; 86 static const int kSyncSchedulerDelayMsec = 250;
84 87
85 #if defined(OS_CHROMEOS) 88 #if defined(OS_CHROMEOS)
86 static const int kChromeOSNetworkChangeReactionDelayHackMsec = 5000; 89 static const int kChromeOSNetworkChangeReactionDelayHackMsec = 5000;
87 #endif // OS_CHROMEOS 90 #endif // OS_CHROMEOS
88 91
92 GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason(
93 sync_api::ConfigureReason reason) {
94 switch (reason) {
95 case sync_api::CONFIGURE_REASON_RECONFIGURATION:
96 return GetUpdatesCallerInfo::RECONFIGURATION;
97 case sync_api::CONFIGURE_REASON_MIGRATION:
98 return GetUpdatesCallerInfo::MIGRATION;
99 case sync_api::CONFIGURE_REASON_NEW_CLIENT:
100 return GetUpdatesCallerInfo::NEW_CLIENT;
101 case sync_api::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE:
102 return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE;
103 default:
104 NOTREACHED();
105 }
106
107 return GetUpdatesCallerInfo::UNKNOWN;
108 }
109
89 } // namespace 110 } // namespace
90 111
91 namespace sync_api { 112 namespace sync_api {
92 113
93 SyncManager::ChangeRecord::ChangeRecord() 114 SyncManager::ChangeRecord::ChangeRecord()
94 : id(kInvalidId), action(ACTION_ADD) {} 115 : id(kInvalidId), action(ACTION_ADD) {}
95 116
96 SyncManager::ChangeRecord::~ChangeRecord() {} 117 SyncManager::ChangeRecord::~ChangeRecord() {}
97 118
98 DictionaryValue* SyncManager::ChangeRecord::ToValue( 119 DictionaryValue* SyncManager::ChangeRecord::ToValue(
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 712
692 void SyncManager::RequestConfig(const syncable::ModelTypeBitSet& types, 713 void SyncManager::RequestConfig(const syncable::ModelTypeBitSet& types,
693 ConfigureReason reason) { 714 ConfigureReason reason) {
694 if (!data_->scheduler()) { 715 if (!data_->scheduler()) {
695 LOG(INFO) 716 LOG(INFO)
696 << "SyncManager::RequestConfig: bailing out because scheduler is " 717 << "SyncManager::RequestConfig: bailing out because scheduler is "
697 << "null"; 718 << "null";
698 return; 719 return;
699 } 720 }
700 StartConfigurationMode(NULL); 721 StartConfigurationMode(NULL);
701 data_->scheduler()->ScheduleConfig(types, reason); 722 data_->scheduler()->ScheduleConfig(types, GetSourceFromReason(reason));
702 } 723 }
703 724
704 void SyncManager::StartConfigurationMode(ModeChangeCallback* callback) { 725 void SyncManager::StartConfigurationMode(ModeChangeCallback* callback) {
705 if (!data_->scheduler()) { 726 if (!data_->scheduler()) {
706 LOG(INFO) 727 LOG(INFO)
707 << "SyncManager::StartConfigurationMode: could not start " 728 << "SyncManager::StartConfigurationMode: could not start "
708 << "configuration mode because because scheduler is null"; 729 << "configuration mode because because scheduler is null";
709 return; 730 return;
710 } 731 }
711 data_->scheduler()->Start( 732 data_->scheduler()->Start(
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 2075
2055 for (syncable::ModelTypeSet::const_iterator i = types.begin(); 2076 for (syncable::ModelTypeSet::const_iterator i = types.begin();
2056 i != types.end(); ++i) { 2077 i != types.end(); ++i) {
2057 if (!lookup->initial_sync_ended_for_type(*i)) 2078 if (!lookup->initial_sync_ended_for_type(*i))
2058 return false; 2079 return false;
2059 } 2080 }
2060 return true; 2081 return true;
2061 } 2082 }
2062 2083
2063 } // namespace sync_api 2084 } // namespace sync_api
OLDNEW
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.h ('k') | chrome/browser/sync/internal_api/syncapi_server_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698