OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/glue/non_frontend_data_type_controller.h" | 5 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // For creating components. | 38 // For creating components. |
39 NonFrontendDataTypeController* controller_; | 39 NonFrontendDataTypeController* controller_; |
40 base::Lock controller_lock_; | 40 base::Lock controller_lock_; |
41 | 41 |
42 syncer::ModelType type_; | 42 syncer::ModelType type_; |
43 | 43 |
44 // For returning association results to controller on UI. | 44 // For returning association results to controller on UI. |
45 syncer::WeakHandle<NonFrontendDataTypeController> controller_handle_; | 45 syncer::WeakHandle<NonFrontendDataTypeController> controller_handle_; |
46 | 46 |
47 scoped_ptr<AssociatorInterface> model_associator_; | 47 scoped_ptr<sync_driver::AssociatorInterface> model_associator_; |
48 scoped_ptr<ChangeProcessor> change_processor_; | 48 scoped_ptr<sync_driver::ChangeProcessor> change_processor_; |
49 }; | 49 }; |
50 | 50 |
51 NonFrontendDataTypeController:: | 51 NonFrontendDataTypeController:: |
52 BackendComponentsContainer::BackendComponentsContainer( | 52 BackendComponentsContainer::BackendComponentsContainer( |
53 NonFrontendDataTypeController* controller) | 53 NonFrontendDataTypeController* controller) |
54 : controller_(controller), | 54 : controller_(controller), |
55 type_(controller->type()) { | 55 type_(controller->type()) { |
56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
57 controller_handle_ = | 57 controller_handle_ = |
58 syncer::MakeWeakHandle(controller_->weak_ptr_factory_.GetWeakPtr()); | 58 syncer::MakeWeakHandle(controller_->weak_ptr_factory_.GetWeakPtr()); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 285 } |
286 | 286 |
287 state_ = NOT_RUNNING; | 287 state_ = NOT_RUNNING; |
288 } | 288 } |
289 | 289 |
290 std::string NonFrontendDataTypeController::name() const { | 290 std::string NonFrontendDataTypeController::name() const { |
291 // For logging only. | 291 // For logging only. |
292 return syncer::ModelTypeToString(type()); | 292 return syncer::ModelTypeToString(type()); |
293 } | 293 } |
294 | 294 |
295 DataTypeController::State NonFrontendDataTypeController::state() const { | 295 sync_driver::DataTypeController::State NonFrontendDataTypeController::state() |
| 296 const { |
296 return state_; | 297 return state_; |
297 } | 298 } |
298 | 299 |
299 void NonFrontendDataTypeController::OnSingleDatatypeUnrecoverableError( | 300 void NonFrontendDataTypeController::OnSingleDatatypeUnrecoverableError( |
300 const tracked_objects::Location& from_here, | 301 const tracked_objects::Location& from_here, |
301 const std::string& message) { | 302 const std::string& message) { |
302 DCHECK(IsOnBackendThread()); | 303 DCHECK(IsOnBackendThread()); |
303 RecordUnrecoverableError(from_here, message); | 304 RecordUnrecoverableError(from_here, message); |
304 BrowserThread::PostTask(BrowserThread::UI, from_here, | 305 BrowserThread::PostTask(BrowserThread::UI, from_here, |
305 base::Bind(&NonFrontendDataTypeController::DisableImpl, | 306 base::Bind(&NonFrontendDataTypeController::DisableImpl, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 442 |
442 void NonFrontendDataTypeController::set_start_callback( | 443 void NonFrontendDataTypeController::set_start_callback( |
443 const StartCallback& callback) { | 444 const StartCallback& callback) { |
444 start_callback_ = callback; | 445 start_callback_ = callback; |
445 } | 446 } |
446 | 447 |
447 void NonFrontendDataTypeController::set_state(State state) { | 448 void NonFrontendDataTypeController::set_state(State state) { |
448 state_ = state; | 449 state_ = state; |
449 } | 450 } |
450 | 451 |
451 AssociatorInterface* NonFrontendDataTypeController::associator() const { | 452 sync_driver::AssociatorInterface* NonFrontendDataTypeController::associator() |
| 453 const { |
452 return model_associator_; | 454 return model_associator_; |
453 } | 455 } |
454 | 456 |
455 ChangeProcessor* NonFrontendDataTypeController::GetChangeProcessor() const { | 457 sync_driver::ChangeProcessor* |
| 458 NonFrontendDataTypeController::GetChangeProcessor() const { |
456 return change_processor_; | 459 return change_processor_; |
457 } | 460 } |
458 | 461 |
459 void NonFrontendDataTypeController::AssociationCallback( | 462 void NonFrontendDataTypeController::AssociationCallback( |
460 AssociationResult result) { | 463 AssociationResult result) { |
461 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 464 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
462 | 465 |
463 if (result.needs_crypto) { | 466 if (result.needs_crypto) { |
464 StartDone(NEEDS_CRYPTO, | 467 StartDone(NEEDS_CRYPTO, |
465 result.local_merge_result, | 468 result.local_merge_result, |
(...skipping 20 matching lines...) Expand all Loading... |
486 CHECK(result.model_associator); | 489 CHECK(result.model_associator); |
487 change_processor_ = result.change_processor; | 490 change_processor_ = result.change_processor; |
488 model_associator_ = result.model_associator; | 491 model_associator_ = result.model_associator; |
489 | 492 |
490 StartDone(!result.sync_has_nodes ? OK_FIRST_RUN : OK, | 493 StartDone(!result.sync_has_nodes ? OK_FIRST_RUN : OK, |
491 result.local_merge_result, | 494 result.local_merge_result, |
492 result.syncer_merge_result); | 495 result.syncer_merge_result); |
493 } | 496 } |
494 | 497 |
495 } // namespace browser_sync | 498 } // namespace browser_sync |
OLD | NEW |