diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 17:38:46 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 17:38:46 +0000 |
commit | 04194f5820fc1ebcf824e4f2be01743099d23da9 (patch) | |
tree | 216c1f61edc4f60c0ffd85b5a10d0de7a5b9da1b /chrome | |
parent | 264a4883bdd91b50b1e83499a48321c096bdaa5e (diff) | |
download | chromium_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')
-rw-r--r-- | chrome/browser/first_run/first_run.h | 4 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 35 | ||||
-rw-r--r-- | chrome/browser/importer/importer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/importer_lock_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/importing_progress_view.cc | 4 |
5 files changed, 27 insertions, 20 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( diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index 99b574a..c599988 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -123,7 +123,7 @@ void ImporterHost::ShowWarningDialog() { OnLockViewEnd(false); } else { #if defined(OS_WIN) - views::Window::CreateChromeWindow(GetActiveWindow(), gfx::Rect(), + views::Window::CreateChromeWindow(NULL, gfx::Rect(), new ImporterLockView(this))->Show(); #elif defined(TOOLKIT_USES_GTK) ImportLockDialogGtk::Show(parent_window_, this); diff --git a/chrome/browser/views/importer_lock_view.cc b/chrome/browser/views/importer_lock_view.cc index 11d08b3..8fc1c9a 100644 --- a/chrome/browser/views/importer_lock_view.cc +++ b/chrome/browser/views/importer_lock_view.cc @@ -54,7 +54,7 @@ std::wstring ImporterLockView::GetDialogButtonLabel( } bool ImporterLockView::IsModal() const { - return true; + return false; } std::wstring ImporterLockView::GetWindowTitle() const { diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/views/importing_progress_view.cc index 70e71f0..f3c2627 100644 --- a/chrome/browser/views/importing_progress_view.cc +++ b/chrome/browser/views/importing_progress_view.cc @@ -303,9 +303,7 @@ void StartImportingWithUI(HWND parent_window, views::Window* window = views::Window::CreateChromeWindow(parent_window, gfx::Rect(), v); - // In headless mode it means that we don't show the progress window, but it - // still need it to exist. No user interaction will be required. - if (!coordinator->is_headless()) + if (!coordinator->is_headless() && !first_run) window->Show(); coordinator->StartImportSettings(source_profile, target_profile, items, |