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/glue/sync_backend_host.h

Issue 6621062: Refactor sync notifier out of sync api. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Minox fixes. Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/sync/engine/model_safe_worker.h" 21 #include "chrome/browser/sync/engine/model_safe_worker.h"
22 #include "chrome/browser/sync/js_backend.h" 22 #include "chrome/browser/sync/js_backend.h"
23 #include "chrome/browser/sync/js_sync_manager_observer.h" 23 #include "chrome/browser/sync/js_sync_manager_observer.h"
24 #include "chrome/browser/sync/glue/data_type_controller.h" 24 #include "chrome/browser/sync/glue/data_type_controller.h"
25 #include "chrome/browser/sync/glue/ui_model_worker.h" 25 #include "chrome/browser/sync/glue/ui_model_worker.h"
26 #include "chrome/browser/sync/js_event_router.h" 26 #include "chrome/browser/sync/js_event_router.h"
27 #include "chrome/browser/sync/syncable/model_type.h" 27 #include "chrome/browser/sync/syncable/model_type.h"
28 #include "chrome/common/net/gaia/google_service_auth_error.h" 28 #include "chrome/common/net/gaia/google_service_auth_error.h"
29 #include "chrome/common/net/url_request_context_getter.h" 29 #include "chrome/common/net/url_request_context_getter.h"
30 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
31 #include "jingle/notifier/base/notifier_options.h"
32 31
33 class CancelableTask; 32 class CancelableTask;
34 class Profile; 33 class Profile;
35 34
36 namespace notifier {
37 struct NotifierOptions;
38 }
39
40 namespace browser_sync { 35 namespace browser_sync {
41 36
42 namespace sessions { 37 namespace sessions {
43 struct SyncSessionSnapshot; 38 struct SyncSessionSnapshot;
44 } 39 }
45 40
46 class ChangeProcessor; 41 class ChangeProcessor;
47 class DataTypeController; 42 class DataTypeController;
48 class JsArgList; 43 class JsArgList;
49 44
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 116
122 // Called on |frontend_loop_| to kick off asynchronous initialization. 117 // Called on |frontend_loop_| to kick off asynchronous initialization.
123 // As a fallback when no cached auth information is available, try to 118 // As a fallback when no cached auth information is available, try to
124 // bootstrap authentication using |lsid|, if it isn't empty. 119 // bootstrap authentication using |lsid|, if it isn't empty.
125 // Optionally delete the Sync Data folder (if it's corrupt). 120 // Optionally delete the Sync Data folder (if it's corrupt).
126 void Initialize(SyncFrontend* frontend, 121 void Initialize(SyncFrontend* frontend,
127 const GURL& service_url, 122 const GURL& service_url,
128 const syncable::ModelTypeSet& types, 123 const syncable::ModelTypeSet& types,
129 URLRequestContextGetter* baseline_context_getter, 124 URLRequestContextGetter* baseline_context_getter,
130 const sync_api::SyncCredentials& credentials, 125 const sync_api::SyncCredentials& credentials,
131 bool delete_sync_data_folder, 126 bool delete_sync_data_folder);
132 const notifier::NotifierOptions& notifier_options);
133 127
134 // Called from |frontend_loop| to update SyncCredentials. 128 // Called from |frontend_loop| to update SyncCredentials.
135 void UpdateCredentials(const sync_api::SyncCredentials& credentials); 129 void UpdateCredentials(const sync_api::SyncCredentials& credentials);
136 130
137 virtual void UpdateEnabledTypes(const syncable::ModelTypeSet& types); 131 virtual void UpdateEnabledTypes(const syncable::ModelTypeSet& types);
138 132
139 // This starts the SyncerThread running a Syncer object to communicate with 133 // This starts the SyncerThread running a Syncer object to communicate with
140 // sync servers. Until this is called, no changes will leave or enter this 134 // sync servers. Until this is called, no changes will leave or enter this
141 // browser from the cloud / sync servers. 135 // browser from the cloud / sync servers.
142 // Called on |frontend_loop_|. 136 // Called on |frontend_loop_|.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 virtual void RouteJsEvent(const std::string& event_name, 295 virtual void RouteJsEvent(const std::string& event_name,
302 const JsArgList& args, 296 const JsArgList& args,
303 const JsEventHandler* dst); 297 const JsEventHandler* dst);
304 298
305 struct DoInitializeOptions { 299 struct DoInitializeOptions {
306 DoInitializeOptions( 300 DoInitializeOptions(
307 const GURL& service_url, 301 const GURL& service_url,
308 sync_api::HttpPostProviderFactory* http_bridge_factory, 302 sync_api::HttpPostProviderFactory* http_bridge_factory,
309 const sync_api::SyncCredentials& credentials, 303 const sync_api::SyncCredentials& credentials,
310 bool delete_sync_data_folder, 304 bool delete_sync_data_folder,
311 const notifier::NotifierOptions& notifier_options,
312 std::string restored_key_for_bootstrapping, 305 std::string restored_key_for_bootstrapping,
313 bool setup_for_test_mode); 306 bool setup_for_test_mode);
314 ~DoInitializeOptions(); 307 ~DoInitializeOptions();
315 308
316 GURL service_url; 309 GURL service_url;
317 sync_api::HttpPostProviderFactory* http_bridge_factory; 310 sync_api::HttpPostProviderFactory* http_bridge_factory;
318 sync_api::SyncCredentials credentials; 311 sync_api::SyncCredentials credentials;
319 std::string lsid; 312 std::string lsid;
320 bool delete_sync_data_folder; 313 bool delete_sync_data_folder;
321 notifier::NotifierOptions notifier_options;
322 std::string restored_key_for_bootstrapping; 314 std::string restored_key_for_bootstrapping;
323 bool setup_for_test_mode; 315 bool setup_for_test_mode;
324 }; 316 };
325 317
326 // Note: 318 // Note:
327 // 319 //
328 // The Do* methods are the various entry points from our SyncBackendHost. 320 // The Do* methods are the various entry points from our SyncBackendHost.
329 // It calls us on a dedicated thread to actually perform synchronous 321 // It calls us on a dedicated thread to actually perform synchronous
330 // (and potentially blocking) syncapi operations. 322 // (and potentially blocking) syncapi operations.
331 // 323 //
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // setup to nudge the syncapi into a usable state. 394 // setup to nudge the syncapi into a usable state.
403 void DoInitializeForTest(const std::wstring& test_user, 395 void DoInitializeForTest(const std::wstring& test_user,
404 sync_api::HttpPostProviderFactory* factory, 396 sync_api::HttpPostProviderFactory* factory,
405 bool delete_sync_data_folder) { 397 bool delete_sync_data_folder) {
406 // Construct dummy credentials for test. 398 // Construct dummy credentials for test.
407 sync_api::SyncCredentials credentials; 399 sync_api::SyncCredentials credentials;
408 credentials.email = WideToUTF8(test_user); 400 credentials.email = WideToUTF8(test_user);
409 credentials.sync_token = "token"; 401 credentials.sync_token = "token";
410 DoInitialize(DoInitializeOptions(GURL(), factory, credentials, 402 DoInitialize(DoInitializeOptions(GURL(), factory, credentials,
411 delete_sync_data_folder, 403 delete_sync_data_folder,
412 notifier::NotifierOptions(), "", true)); 404 "", true));
413 } 405 }
414 #endif 406 #endif
415 407
416 private: 408 private:
417 friend class base::RefCountedThreadSafe<SyncBackendHost::Core>; 409 friend class base::RefCountedThreadSafe<SyncBackendHost::Core>;
418 friend class SyncBackendHostForProfileSyncTest; 410 friend class SyncBackendHostForProfileSyncTest;
419 411
420 virtual ~Core(); 412 virtual ~Core();
421 413
422 // Return change processor for a particular model (return NULL on failure). 414 // Return change processor for a particular model (return NULL on failure).
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 615
624 // Whether we've processed the initialization complete callback. 616 // Whether we've processed the initialization complete callback.
625 bool syncapi_initialized_; 617 bool syncapi_initialized_;
626 618
627 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 619 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
628 }; 620 };
629 621
630 } // namespace browser_sync 622 } // namespace browser_sync
631 623
632 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 624 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread.cc ('k') | chrome/browser/sync/glue/sync_backend_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698