Index: chrome/browser/first_run/first_run_win.cc |
=================================================================== |
--- chrome/browser/first_run/first_run_win.cc (revision 54904) |
+++ chrome/browser/first_run/first_run_win.cc (working copy) |
@@ -400,7 +400,7 @@ |
scoped_refptr<ImporterHost> importer_host = new ImporterHost(); |
if (!FirstRun::ImportSettings(NULL, |
importer_host->GetSourceProfileInfoAt(0).browser_type, |
- import_items, FilePath(import_bookmarks_path), NULL)) { |
+ import_items, FilePath(import_bookmarks_path), true, NULL)) { |
LOG(WARNING) << "silent import failed"; |
} |
} |
@@ -582,15 +582,17 @@ |
DISALLOW_COPY_AND_ASSIGN(HungImporterMonitor); |
}; |
-std::string EncodeImportParams(int browser_type, int options, HWND window) { |
- return StringPrintf("%d@%d@%d", browser_type, options, window); |
+std::string EncodeImportParams(int browser_type, int options, |
+ int skip_first_run_ui, HWND window) { |
+ return StringPrintf("%d@%d@%d@%d", browser_type, options, skip_first_run_ui, |
+ window); |
} |
-bool DecodeImportParams(const std::string& encoded, |
- int* browser_type, int* options, HWND* window) { |
+bool DecodeImportParams(const std::string& encoded, int* browser_type, |
+ int* options, int* skip_first_run_ui, HWND* window) { |
std::vector<std::string> parts; |
SplitString(encoded, '@', &parts); |
- if (parts.size() != 3) |
+ if (parts.size() != 4) |
return false; |
if (!base::StringToInt(parts[0], browser_type)) |
@@ -599,8 +601,11 @@ |
if (!base::StringToInt(parts[1], options)) |
return false; |
+ if (!base::StringToInt(parts[2], skip_first_run_ui)) |
+ return false; |
+ |
int64 window_int; |
- base::StringToInt64(parts[2], &window_int); |
+ base::StringToInt64(parts[3], &window_int); |
*window = reinterpret_cast<HWND>(window_int); |
return true; |
} |
@@ -683,6 +688,7 @@ |
bool FirstRun::ImportSettings(Profile* profile, int browser_type, |
int items_to_import, |
const FilePath& import_bookmarks_path, |
+ bool skip_first_run_ui, |
HWND parent_window) { |
const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); |
CommandLine import_cmd(cmdline.GetProgram()); |
@@ -702,7 +708,8 @@ |
if (items_to_import) { |
import_cmd.CommandLine::AppendSwitchASCII(switches::kImport, |
- EncodeImportParams(browser_type, items_to_import, parent_window)); |
+ EncodeImportParams(browser_type, items_to_import, |
+ skip_first_run_ui ? 1 : 0, parent_window)); |
} |
if (!import_bookmarks_path.empty()) { |
@@ -737,7 +744,7 @@ |
int items_to_import, |
HWND parent_window) { |
return ImportSettings(profile, browser_type, items_to_import, |
- FilePath(), parent_window); |
+ FilePath(), false, parent_window); |
} |
int FirstRun::ImportFromBrowser(Profile* profile, |
@@ -749,19 +756,19 @@ |
} |
int browser_type = 0; |
int items_to_import = 0; |
+ int skip_first_run_ui = 0; |
HWND parent_window = NULL; |
if (!DecodeImportParams(import_info, &browser_type, &items_to_import, |
- &parent_window)) { |
+ &skip_first_run_ui, &parent_window)) { |
NOTREACHED(); |
return false; |
} |
scoped_refptr<ImporterHost> importer_host = new ImporterHost(); |
FirstRunImportObserver observer; |
- // If there is no parent window, we run in headless mode which amounts |
- // to having the windows hidden and if there is user action required the |
- // import is automatically canceled. |
- if (!parent_window) |
+ // If |skip_first_run_ui|, we run in headless mode. This means that if |
+ // there is user action required the import is automatically canceled. |
+ if (skip_first_run_ui > 0) |
importer_host->set_headless(); |
StartImportingWithUI( |