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

Unified Diff: chrome/browser/first_run_win.cc

Issue 1077007: Add the option of importing bookmarks from file to first run.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/first_run.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run_win.cc
===================================================================
--- chrome/browser/first_run_win.cc (revision 41958)
+++ chrome/browser/first_run_win.cc (working copy)
@@ -671,7 +671,37 @@
return (import_runner.exit_code() == ResultCodes::NORMAL_EXIT);
}
-int FirstRun::ImportNow(Profile* profile, const CommandLine& cmdline) {
+int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) {
+ std::wstring file_path = cmdline.GetSwitchValue(switches::kImportFromFile);
+ if (file_path.empty()) {
+ NOTREACHED();
+ return false;
+ }
+
cpu_(ooo_6.6-7.5) 2010/03/22 17:21:27 remove empty line so it looks same as lines 717-71
huanr 2010/03/22 17:56:11 Done.
+ scoped_refptr<ImporterHost> importer_host = new ImporterHost();
+ FirstRunImportObserver observer;
+
+ importer_host->set_headless();
+
+ ProfileInfo profile_info;
+ profile_info.browser_type = BOOKMARKS_HTML;
+ profile_info.source_path = file_path;
+
+ StartImportingWithUI(
+ NULL,
+ FAVORITES,
+ importer_host,
+ profile_info,
+ profile,
+ &observer,
+ true);
+
+ observer.RunLoop();
+ return observer.import_result();
+}
+
+int FirstRun::ImportFromBrowser(Profile* profile,
+ const CommandLine& cmdline) {
std::wstring import_info = cmdline.GetSwitchValue(switches::kImport);
if (import_info.empty()) {
NOTREACHED();
@@ -706,6 +736,19 @@
return observer.import_result();
}
+int FirstRun::ImportNow(Profile* profile, const CommandLine& cmdline) {
+ int return_code = true;
cpu_(ooo_6.6-7.5) 2010/03/22 17:21:27 return_code = false ?
huanr 2010/03/22 17:56:11 I meant returning true if no import is needed.
+ if (cmdline.HasSwitch(switches::kImportFromFile)) {
+ // Silently import preset bookmarks from file.
+ // This is an OEM scenario.
+ return_code = ImportFromFile(profile, cmdline);
+ }
+ if (cmdline.HasSwitch(switches::kImport)) {
+ return_code = ImportFromBrowser(profile, cmdline);
+ }
+ return return_code;
+}
+
//////////////////////////////////////////////////////////////////////////
namespace {
« no previous file with comments | « chrome/browser/first_run.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698