summaryrefslogtreecommitdiffstats
path: root/chrome/browser/first_run
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 17:38:46 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 17:38:46 +0000
commit04194f5820fc1ebcf824e4f2be01743099d23da9 (patch)
tree216c1f61edc4f60c0ffd85b5a10d0de7a5b9da1b /chrome/browser/first_run
parent264a4883bdd91b50b1e83499a48321c096bdaa5e (diff)
downloadchromium_src-04194f5820fc1ebcf824e4f2be01743099d23da9.zip
chromium_src-04194f5820fc1ebcf824e4f2be01743099d23da9.tar.gz
chromium_src-04194f5820fc1ebcf824e4f2be01743099d23da9.tar.bz2
Fix Firefox import lock dialog on Windows.
BUG=50577 TEST= run chrome first_run with import while Firefox is default browser and open. Dialog should pop up telling user to close FF. Review URL: http://codereview.chromium.org/2868077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r--chrome/browser/first_run/first_run.h4
-rw-r--r--chrome/browser/first_run/first_run_win.cc35
2 files changed, 24 insertions, 15 deletions
diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h
index f7996c0..2127b9a 100644
--- a/chrome/browser/first_run/first_run.h
+++ b/chrome/browser/first_run/first_run.h
@@ -132,10 +132,12 @@ class FirstRun {
#if defined(OS_WIN)
// Imports settings in a separate process. It is the implementation of the
- // public version.
+ // public version. |skip_first_run_ui| is true if no first run UI should
+ // appear (search engine dialog, Firefox import warning dialog).
static bool ImportSettings(Profile* profile, int browser_type,
int items_to_import,
const FilePath& import_path,
+ bool skip_first_run_ui,
gfx::NativeView parent_window);
// Import browser items in this process. The browser and the items to
// import are encoded int the command line.
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 4a94da6..d38636f 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -400,7 +400,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
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 @@ class HungImporterMonitor : public WorkerThreadTicker::Callback {
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 @@ bool DecodeImportParams(const std::string& encoded,
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 @@ void FirstRun::AutoImport(Profile* profile,
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 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
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 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
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 FirstRun::ImportFromBrowser(Profile* profile,
}
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(