| 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/password_data_type_controller.h" | 5 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/password_manager/password_store.h" | 9 #include "chrome/browser/password_manager/password_store.h" |
| 10 #include "chrome/browser/password_manager/password_store_factory.h" | 10 #include "chrome/browser/password_manager/password_store_factory.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 DCHECK(password_store_.get()); | 46 DCHECK(password_store_.get()); |
| 47 return password_store_->ScheduleTask(task); | 47 return password_store_->ScheduleTask(task); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool PasswordDataTypeController::StartModels() { | 50 bool PasswordDataTypeController::StartModels() { |
| 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 52 DCHECK_EQ(state(), MODEL_STARTING); | 52 DCHECK_EQ(state(), MODEL_STARTING); |
| 53 password_store_ = PasswordStoreFactory::GetForProfile( | 53 password_store_ = PasswordStoreFactory::GetForProfile( |
| 54 profile(), Profile::EXPLICIT_ACCESS); | 54 profile(), Profile::EXPLICIT_ACCESS); |
| 55 if (!password_store_.get()) { | 55 if (!password_store_.get()) { |
| 56 SyncError error( | 56 csync::SyncError error( |
| 57 FROM_HERE, | 57 FROM_HERE, |
| 58 "PasswordStore not initialized, password datatype controller aborting.", | 58 "PasswordStore not initialized, password datatype controller aborting.", |
| 59 type()); | 59 type()); |
| 60 StartDoneImpl(ASSOCIATION_FAILED, DISABLED, error); | 60 StartDoneImpl(ASSOCIATION_FAILED, DISABLED, error); |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void PasswordDataTypeController::CreateSyncComponents() { | 66 void PasswordDataTypeController::CreateSyncComponents() { |
| 67 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | 67 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 68 DCHECK_EQ(state(), ASSOCIATING); | 68 DCHECK_EQ(state(), ASSOCIATING); |
| 69 ProfileSyncComponentsFactory::SyncComponents sync_components = | 69 ProfileSyncComponentsFactory::SyncComponents sync_components = |
| 70 profile_sync_factory()->CreatePasswordSyncComponents( | 70 profile_sync_factory()->CreatePasswordSyncComponents( |
| 71 profile_sync_service(), | 71 profile_sync_service(), |
| 72 password_store_.get(), | 72 password_store_.get(), |
| 73 this); | 73 this); |
| 74 set_model_associator(sync_components.model_associator); | 74 set_model_associator(sync_components.model_associator); |
| 75 set_change_processor(sync_components.change_processor); | 75 set_change_processor(sync_components.change_processor); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace browser_sync | 78 } // namespace browser_sync |
| OLD | NEW |