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

Side by Side Diff: chrome/browser/importer/importer_host.cc

Issue 14316007: Remove unused |first_run| parameter in ImporterHost::CheckForFirefoxLock() which results in a casca… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r196136 Created 7 years, 8 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/importer/importer_host.h" 5 #include "chrome/browser/importer/importer_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 firefox_lock_.reset(); // Release the Firefox profile lock. 100 firefox_lock_.reset(); // Release the Firefox profile lock.
101 if (observer_) 101 if (observer_)
102 observer_->ImportEnded(); 102 observer_->ImportEnded();
103 Release(); 103 Release();
104 } 104 }
105 105
106 void ImporterHost::StartImportSettings( 106 void ImporterHost::StartImportSettings(
107 const importer::SourceProfile& source_profile, 107 const importer::SourceProfile& source_profile,
108 Profile* target_profile, 108 Profile* target_profile,
109 uint16 items, 109 uint16 items,
110 ProfileWriter* writer, 110 ProfileWriter* writer) {
111 bool first_run) {
112 // We really only support importing from one host at a time. 111 // We really only support importing from one host at a time.
113 DCHECK(!profile_); 112 DCHECK(!profile_);
114 DCHECK(target_profile); 113 DCHECK(target_profile);
115 114
116 profile_ = target_profile; 115 profile_ = target_profile;
117 PrefService* user_prefs = profile_->GetPrefs(); 116 PrefService* user_prefs = profile_->GetPrefs();
118 117
119 // Make sure only items that were not disabled by policy are imported. 118 // Make sure only items that were not disabled by policy are imported.
120 if (!user_prefs->GetBoolean(prefs::kImportHistory)) 119 if (!user_prefs->GetBoolean(prefs::kImportHistory))
121 items &= ~importer::HISTORY; 120 items &= ~importer::HISTORY;
(...skipping 15 matching lines...) Expand all
137 return; 136 return;
138 } 137 }
139 138
140 importer_->AddRef(); 139 importer_->AddRef();
141 140
142 scoped_refptr<InProcessImporterBridge> bridge( 141 scoped_refptr<InProcessImporterBridge> bridge(
143 new InProcessImporterBridge(writer_.get(), this)); 142 new InProcessImporterBridge(writer_.get(), this));
144 task_ = base::Bind( 143 task_ = base::Bind(
145 &Importer::StartImport, importer_, source_profile, items, bridge); 144 &Importer::StartImport, importer_, source_profile, items, bridge);
146 145
147 CheckForFirefoxLock(source_profile, items, first_run); 146 CheckForFirefoxLock(source_profile, items);
148 147
149 #if defined(OS_WIN) 148 #if defined(OS_WIN)
150 // For google toolbar import, we need the user to log in and store their GAIA 149 // For google toolbar import, we need the user to log in and store their GAIA
151 // credentials. 150 // credentials.
152 if (source_profile.importer_type == importer::TYPE_GOOGLE_TOOLBAR5) { 151 if (source_profile.importer_type == importer::TYPE_GOOGLE_TOOLBAR5) {
153 toolbar_importer_utils::IsGoogleGAIACookieInstalled( 152 toolbar_importer_utils::IsGoogleGAIACookieInstalled(
154 base::Bind(&ImporterHost::OnGoogleGAIACookieChecked, this), profile_); 153 base::Bind(&ImporterHost::OnGoogleGAIACookieChecked, this), profile_);
155 is_source_readable_ = false; 154 is_source_readable_ = false;
156 } 155 }
157 #endif 156 #endif
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 importer_->Release(); 194 importer_->Release();
196 195
197 if (installed_bookmark_observer_) { 196 if (installed_bookmark_observer_) {
198 DCHECK(profile_); 197 DCHECK(profile_);
199 BookmarkModelFactory::GetForProfile(profile_)->RemoveObserver(this); 198 BookmarkModelFactory::GetForProfile(profile_)->RemoveObserver(this);
200 } 199 }
201 } 200 }
202 201
203 void ImporterHost::CheckForFirefoxLock( 202 void ImporterHost::CheckForFirefoxLock(
204 const importer::SourceProfile& source_profile, 203 const importer::SourceProfile& source_profile,
205 uint16 items, 204 uint16 items) {
206 bool first_run) {
207 if (source_profile.importer_type == importer::TYPE_FIREFOX2 || 205 if (source_profile.importer_type == importer::TYPE_FIREFOX2 ||
208 source_profile.importer_type == importer::TYPE_FIREFOX3) { 206 source_profile.importer_type == importer::TYPE_FIREFOX3) {
209 DCHECK(!firefox_lock_.get()); 207 DCHECK(!firefox_lock_.get());
210 firefox_lock_.reset(new FirefoxProfileLock(source_profile.source_path)); 208 firefox_lock_.reset(new FirefoxProfileLock(source_profile.source_path));
211 if (!firefox_lock_->HasAcquired()) { 209 if (!firefox_lock_->HasAcquired()) {
212 // If fail to acquire the lock, we set the source unreadable and 210 // If fail to acquire the lock, we set the source unreadable and
213 // show a warning dialog, unless running without UI. 211 // show a warning dialog, unless running without UI.
214 is_source_readable_ = false; 212 is_source_readable_ = false;
215 ShowWarningDialog(); 213 ShowWarningDialog();
216 } 214 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 const content::NotificationDetails& details) { 269 const content::NotificationDetails& details) {
272 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); 270 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED);
273 registrar_.RemoveAll(); 271 registrar_.RemoveAll();
274 InvokeTaskIfDone(); 272 InvokeTaskIfDone();
275 } 273 }
276 274
277 void ImporterHost::OnBrowserRemoved(Browser* browser) { 275 void ImporterHost::OnBrowserRemoved(Browser* browser) {
278 if (browser_ == browser) 276 if (browser_ == browser)
279 browser_ = NULL; 277 browser_ = NULL;
280 } 278 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer_host.h ('k') | chrome/browser/ui/webui/options/import_data_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698