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

Side by Side Diff: chrome/browser/first_run/first_run.cc

Issue 14322002: Remove unused ImportProgressDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/extensions/updater/extension_updater.h" 23 #include "chrome/browser/extensions/updater/extension_updater.h"
24 #include "chrome/browser/first_run/first_run_dialog.h" 24 #include "chrome/browser/first_run/first_run_dialog.h"
25 #include "chrome/browser/first_run/first_run_import_observer.h"
26 #include "chrome/browser/first_run/first_run_internal.h" 25 #include "chrome/browser/first_run/first_run_internal.h"
27 #include "chrome/browser/google/google_util.h" 26 #include "chrome/browser/google/google_util.h"
28 #include "chrome/browser/importer/external_process_importer_host.h" 27 #include "chrome/browser/importer/external_process_importer_host.h"
29 #include "chrome/browser/importer/importer_host.h" 28 #include "chrome/browser/importer/importer_host.h"
30 #include "chrome/browser/importer/importer_list.h" 29 #include "chrome/browser/importer/importer_list.h"
31 #include "chrome/browser/importer/importer_progress_dialog.h"
32 #include "chrome/browser/importer/importer_progress_observer.h" 30 #include "chrome/browser/importer/importer_progress_observer.h"
33 #include "chrome/browser/process_singleton.h" 31 #include "chrome/browser/process_singleton.h"
34 #include "chrome/browser/profiles/profile_manager.h" 32 #include "chrome/browser/profiles/profile_manager.h"
35 #include "chrome/browser/search_engines/template_url_service.h" 33 #include "chrome/browser/search_engines/template_url_service.h"
36 #include "chrome/browser/search_engines/template_url_service_factory.h" 34 #include "chrome/browser/search_engines/template_url_service_factory.h"
37 #include "chrome/browser/shell_integration.h" 35 #include "chrome/browser/shell_integration.h"
38 #include "chrome/browser/signin/signin_manager.h" 36 #include "chrome/browser/signin/signin_manager.h"
39 #include "chrome/browser/signin/signin_manager_factory.h" 37 #include "chrome/browser/signin/signin_manager_factory.h"
40 #include "chrome/browser/signin/signin_tracker.h" 38 #include "chrome/browser/signin/signin_tracker.h"
41 #include "chrome/browser/ui/browser.h" 39 #include "chrome/browser/ui/browser.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } else { // no policy (recommended or managed) is set 194 } else { // no policy (recommended or managed) is set
197 if (should_import) 195 if (should_import)
198 items |= import_type; 196 items |= import_type;
199 } 197 }
200 198
201 user_prefs->ClearPref(pref_path); 199 user_prefs->ClearPref(pref_path);
202 } 200 }
203 201
204 // Imports bookmarks from an html file. The path to the file is provided in 202 // Imports bookmarks from an html file. The path to the file is provided in
205 // the command line. 203 // the command line.
206 int ImportFromFile(Profile* profile, const CommandLine& cmdline) { 204 void ImportFromFile(Profile* profile, const CommandLine& cmdline) {
207 base::FilePath file_path = 205 base::FilePath file_path =
208 cmdline.GetSwitchValuePath(switches::kImportFromFile); 206 cmdline.GetSwitchValuePath(switches::kImportFromFile);
209 if (file_path.empty()) { 207 if (file_path.empty()) {
210 NOTREACHED(); 208 NOTREACHED();
211 return false; 209 return;
212 } 210 }
213 scoped_refptr<ImporterHost> importer_host(new ImporterHost); 211 scoped_refptr<ImporterHost> importer_host(new ImporterHost);
214 importer_host->set_headless(); 212 importer_host->set_headless();
215 213
216 importer::SourceProfile source_profile; 214 importer::SourceProfile source_profile;
217 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; 215 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE;
218 source_profile.source_path = file_path; 216 source_profile.source_path = file_path;
219 217
220 FirstRunImportObserver importer_observer; 218 scoped_ptr<first_run::internal::ImportEndedObserver> observer(
gab 2013/04/17 02:41:01 Note: This code has the exact same logic as Import
221 importer::ShowImportProgressDialog(importer::FAVORITES, 219 new first_run::internal::ImportEndedObserver);
222 importer_host, 220 importer_host->SetObserver(observer.get());
223 &importer_observer, 221 importer_host->StartImportSettings(
224 source_profile, 222 source_profile, profile, importer::FAVORITES, new ProfileWriter(profile),
225 profile, 223 true);
226 true); 224 // If the import process has not errored out, block on it.
227 225 if (!observer->ended()) {
228 importer_observer.RunLoop(); 226 observer->set_should_quit_message_loop();
229 return importer_observer.import_result(); 227 MessageLoop::current()->Run();
228 }
230 } 229 }
231 230
232 GURL UrlFromString(const std::string& in) { 231 GURL UrlFromString(const std::string& in) {
233 return GURL(in); 232 return GURL(in);
234 } 233 }
235 234
236 void ConvertStringVectorToGURLVector( 235 void ConvertStringVectorToGURLVector(
237 const std::vector<std::string>& src, 236 const std::vector<std::string>& src,
238 std::vector<GURL>* ret) { 237 std::vector<GURL>* ret) {
239 ret->resize(src.size()); 238 ret->resize(src.size());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 #if !defined(OS_LINUX) && !defined(OS_BSD) 387 #if !defined(OS_LINUX) && !defined(OS_BSD)
389 bool IsOrganicFirstRun() { 388 bool IsOrganicFirstRun() {
390 std::string brand; 389 std::string brand;
391 google_util::GetBrand(&brand); 390 google_util::GetBrand(&brand);
392 return google_util::IsOrganicFirstRun(brand); 391 return google_util::IsOrganicFirstRun(brand);
393 } 392 }
394 #endif 393 #endif
395 394
396 int ImportBookmarkFromFileIfNeeded(Profile* profile, 395 int ImportBookmarkFromFileIfNeeded(Profile* profile,
397 const CommandLine& cmdline) { 396 const CommandLine& cmdline) {
398 int return_code = true;
399 if (cmdline.HasSwitch(switches::kImportFromFile)) { 397 if (cmdline.HasSwitch(switches::kImportFromFile)) {
400 // Silently import preset bookmarks from file. 398 // Silently import preset bookmarks from file.
401 // This is an OEM scenario. 399 // This is an OEM scenario.
402 return_code = ImportFromFile(profile, cmdline); 400 ImportFromFile(profile, cmdline);
403 } 401 }
404 return return_code; 402 // ImportBookmarkFromFileIfNeeded() will go away as part of
403 // http://crbug.com/219419, so it is fine to hardcode |true| for now.
404 return true;
405 } 405 }
406 406
407 } // namespace internal 407 } // namespace internal
408 } // namespace first_run 408 } // namespace first_run
409 409
410 namespace first_run { 410 namespace first_run {
411 411
412 MasterPrefs::MasterPrefs() 412 MasterPrefs::MasterPrefs()
413 : ping_delay(0), 413 : ping_delay(0),
414 homepage_defined(false), 414 homepage_defined(false),
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 internal::DoPostImportPlatformSpecificTasks(); 798 internal::DoPostImportPlatformSpecificTasks();
799 } 799 }
800 800
801 bool DidPerformProfileImport(bool* exited_successfully) { 801 bool DidPerformProfileImport(bool* exited_successfully) {
802 if (exited_successfully) 802 if (exited_successfully)
803 *exited_successfully = profile_import_exited_successfully; 803 *exited_successfully = profile_import_exited_successfully;
804 return did_perform_profile_import; 804 return did_perform_profile_import;
805 } 805 }
806 806
807 } // namespace first_run 807 } // namespace first_run
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/first_run/first_run_import_observer.h » ('j') | chrome/browser/first_run/first_run_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698