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

Side by Side Diff: components/password_manager/sync/browser/password_data_type_controller.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Chromeos fix Created 3 years, 10 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
OLDNEW
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 "components/password_manager/sync/browser/password_data_type_controller .h" 5 #include "components/password_manager/sync/browser/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 "components/password_manager/core/browser/password_store.h" 9 #include "components/password_manager/core/browser/password_store.h"
10 #include "components/sync/driver/sync_client.h" 10 #include "components/sync/driver/sync_client.h"
(...skipping 25 matching lines...) Expand all
36 return false; 36 return false;
37 return password_store_->ScheduleTask(task); 37 return password_store_->ScheduleTask(task);
38 } 38 }
39 39
40 bool PasswordDataTypeController::StartModels() { 40 bool PasswordDataTypeController::StartModels() {
41 DCHECK(CalledOnValidThread()); 41 DCHECK(CalledOnValidThread());
42 DCHECK_EQ(MODEL_STARTING, state()); 42 DCHECK_EQ(MODEL_STARTING, state());
43 43
44 sync_client_->GetSyncService()->AddObserver(this); 44 sync_client_->GetSyncService()->AddObserver(this);
45 45
46 OnStateChanged(); 46 OnStateChanged(sync_client_->GetSyncService());
47 47
48 return !!password_store_.get(); 48 return !!password_store_.get();
49 } 49 }
50 50
51 void PasswordDataTypeController::StopModels() { 51 void PasswordDataTypeController::StopModels() {
52 DCHECK(CalledOnValidThread()); 52 DCHECK(CalledOnValidThread());
53 sync_client_->GetSyncService()->RemoveObserver(this); 53 sync_client_->GetSyncService()->RemoveObserver(this);
54 } 54 }
55 55
56 void PasswordDataTypeController::OnStateChanged() { 56 void PasswordDataTypeController::OnStateChanged(syncer::SyncService* sync) {
57 DCHECK(CalledOnValidThread()); 57 DCHECK(CalledOnValidThread());
58 state_changed_callback_.Run(); 58 state_changed_callback_.Run();
59 } 59 }
60 60
61 } // namespace browser_sync 61 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698