summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 17:51:41 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 17:51:41 +0000
commit9d03b69ccb9a6f38796b2e01bbea82a7e43e96fe (patch)
tree3362d211644f58f6fc17eb07238976f8658f087a
parent623460afb064c0476c94baaecf3e15e702c22964 (diff)
downloadchromium_src-9d03b69ccb9a6f38796b2e01bbea82a7e43e96fe.zip
chromium_src-9d03b69ccb9a6f38796b2e01bbea82a7e43e96fe.tar.gz
chromium_src-9d03b69ccb9a6f38796b2e01bbea82a7e43e96fe.tar.bz2
Fix Firefox import lock dialog on Windows.
Merging change 54920 to 492 branch (patch is slightly different because of conflicts between ToT and 472). TBR: kerz Review URL: http://codereview.chromium.org/3081015 git-svn-id: svn://svn.chromium.org/chrome/branches/472/src@54926 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/first_run.h4
-rw-r--r--chrome/browser/first_run_win.cc35
-rw-r--r--chrome/browser/importer/importer.cc2
-rw-r--r--chrome/browser/views/importer_lock_view.cc2
-rw-r--r--chrome/browser/views/importing_progress_view.cc4
5 files changed, 27 insertions, 20 deletions
diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h
index 6615d93..0d4723d 100644
--- a/chrome/browser/first_run.h
+++ b/chrome/browser/first_run.h
@@ -131,10 +131,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 std::wstring& 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_win.cc b/chrome/browser/first_run_win.cc
index 32866ff..2bd19b2 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -398,7 +398,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, import_bookmarks_path, NULL)) {
+ import_items, import_bookmarks_path, true, NULL)) {
LOG(WARNING) << "silent import failed";
}
}
@@ -580,15 +580,17 @@ class HungImporterMonitor : public WorkerThreadTicker::Callback {
DISALLOW_COPY_AND_ASSIGN(HungImporterMonitor);
};
-std::wstring EncodeImportParams(int browser_type, int options, HWND window) {
- return StringPrintf(L"%d@%d@%d", browser_type, options, window);
+std::wstring EncodeImportParams(int browser_type, int options,
+ int skip_first_run_ui, HWND window) {
+ return StringPrintf(L"%d@%d@%d@%d", browser_type, options, skip_first_run_ui,
+ window);
}
-bool DecodeImportParams(const std::wstring& encoded,
- int* browser_type, int* options, HWND* window) {
+bool DecodeImportParams(const std::wstring& encoded, int* browser_type,
+ int* options, int* skip_first_run_ui, HWND* window) {
std::vector<std::wstring> v;
SplitString(encoded, L'@', &v);
- if (v.size() != 3)
+ if (v.size() != 4)
return false;
if (!StringToInt(v[0], browser_type))
@@ -597,7 +599,10 @@ bool DecodeImportParams(const std::wstring& encoded,
if (!StringToInt(v[1], options))
return false;
- *window = reinterpret_cast<HWND>(StringToInt64(v[2]));
+ if (!StringToInt(v[2], skip_first_run_ui))
+ return false;
+
+ *window = reinterpret_cast<HWND>(StringToInt64(v[3]));
return true;
}
@@ -679,6 +684,7 @@ void FirstRun::AutoImport(Profile* profile,
bool FirstRun::ImportSettings(Profile* profile, int browser_type,
int items_to_import,
const std::wstring& import_bookmarks_path,
+ bool skip_first_run_ui,
HWND parent_window) {
const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
CommandLine import_cmd(cmdline.GetProgram());
@@ -698,7 +704,8 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
if (items_to_import) {
import_cmd.CommandLine::AppendSwitchWithValue(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()) {
@@ -742,7 +749,7 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
int items_to_import,
HWND parent_window) {
return ImportSettings(profile, browser_type, items_to_import,
- std::wstring(), parent_window);
+ std::wstring(), false, parent_window);
}
int FirstRun::ImportFromBrowser(Profile* profile,
@@ -754,19 +761,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 62376c3..eee741d 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,