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

Side by Side Diff: chrome/browser/sync/glue/autofill_profile_data_type_controller.cc

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 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/autofill_profile_data_type_controller.h" 5 #include "chrome/browser/sync/glue/autofill_profile_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/autofill/personal_data_manager_factory.h" 9 #include "chrome/browser/autofill/personal_data_manager_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 23 matching lines...) Expand all
34 return syncer::AUTOFILL_PROFILE; 34 return syncer::AUTOFILL_PROFILE;
35 } 35 }
36 36
37 syncer::ModelSafeGroup 37 syncer::ModelSafeGroup
38 AutofillProfileDataTypeController::model_safe_group() const { 38 AutofillProfileDataTypeController::model_safe_group() const {
39 return syncer::GROUP_DB; 39 return syncer::GROUP_DB;
40 } 40 }
41 41
42 void AutofillProfileDataTypeController::WebDatabaseLoaded() { 42 void AutofillProfileDataTypeController::WebDatabaseLoaded() {
43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
44 if (web_data_service_) 44 if (web_data_service_.get())
45 web_data_service_->RemoveDBObserver(this); 45 web_data_service_->RemoveDBObserver(this);
46 OnModelLoaded(); 46 OnModelLoaded();
47 } 47 }
48 48
49 void AutofillProfileDataTypeController::OnPersonalDataChanged() { 49 void AutofillProfileDataTypeController::OnPersonalDataChanged() {
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
51 DCHECK_EQ(state(), MODEL_STARTING); 51 DCHECK_EQ(state(), MODEL_STARTING);
52 52
53 personal_data_->RemoveObserver(this); 53 personal_data_->RemoveObserver(this);
54 web_data_service_ = AutofillWebDataService::FromBrowserContext(profile()); 54 web_data_service_ = AutofillWebDataService::FromBrowserContext(profile());
55 55
56 if (!web_data_service_) 56 if (!web_data_service_.get())
57 return; 57 return;
58 58
59 if (web_data_service_->IsDatabaseLoaded()) 59 if (web_data_service_->IsDatabaseLoaded())
60 OnModelLoaded(); 60 OnModelLoaded();
61 else 61 else
62 web_data_service_->AddDBObserver(this); 62 web_data_service_->AddDBObserver(this);
63 } 63 }
64 64
65 AutofillProfileDataTypeController::~AutofillProfileDataTypeController() {} 65 AutofillProfileDataTypeController::~AutofillProfileDataTypeController() {}
66 66
(...skipping 12 matching lines...) Expand all
79 // association, the local ids in the mappings would wind up colliding. 79 // association, the local ids in the mappings would wind up colliding.
80 personal_data_ = 80 personal_data_ =
81 autofill::PersonalDataManagerFactory::GetForProfile(profile()); 81 autofill::PersonalDataManagerFactory::GetForProfile(profile());
82 if (!personal_data_->IsDataLoaded()) { 82 if (!personal_data_->IsDataLoaded()) {
83 personal_data_->AddObserver(this); 83 personal_data_->AddObserver(this);
84 return false; 84 return false;
85 } 85 }
86 86
87 web_data_service_ = AutofillWebDataService::FromBrowserContext(profile()); 87 web_data_service_ = AutofillWebDataService::FromBrowserContext(profile());
88 88
89 if (!web_data_service_) 89 if (!web_data_service_.get())
90 return false; 90 return false;
91 91
92 if (web_data_service_->IsDatabaseLoaded()) 92 if (web_data_service_->IsDatabaseLoaded())
93 return true; 93 return true;
94 94
95 web_data_service_->AddDBObserver(this); 95 web_data_service_->AddDBObserver(this);
96 return false; 96 return false;
97 } 97 }
98 98
99 void AutofillProfileDataTypeController::StopModels() { 99 void AutofillProfileDataTypeController::StopModels() {
100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
101 DCHECK(state() == STOPPING || state() == NOT_RUNNING); 101 DCHECK(state() == STOPPING || state() == NOT_RUNNING);
102 102
103 if (web_data_service_) 103 if (web_data_service_.get())
104 web_data_service_->RemoveDBObserver(this); 104 web_data_service_->RemoveDBObserver(this);
105 105
106 personal_data_->RemoveObserver(this); 106 personal_data_->RemoveObserver(this);
107 } 107 }
108 108
109 } // namepsace browser_sync 109 } // namepsace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc ('k') | chrome/browser/sync/glue/favicon_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698