From 883bdd89eea4cfbbd87342ba9212de8cccb6bdab Mon Sep 17 00:00:00 2001 From: "xiyuan@chromium.org" Date: Wed, 21 Apr 2010 20:29:27 +0000 Subject: Make all options dialogs have a parent Use last active browser window as options dialogs parent because window manager only repsect top-level window as parent for now. That is, we could not use options dialog as its sub dialoags' parent. BUG=none TEST=Verify all sub dialogs from options are not treated as toplevel window (ie they do not occupy the fulll screen). Review URL: http://codereview.chromium.org/1751003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45232 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chromeos/frame/browser_view.cc | 3 ++- chrome/browser/chromeos/options/internet_page_view.cc | 5 ++--- chrome/browser/chromeos/options/language_config_view.cc | 9 +++++---- chrome/browser/chromeos/options/language_config_view.h | 2 +- chrome/browser/chromeos/options/system_page_view.cc | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc index 63804a0..eb2029c 100644 --- a/chrome/browser/chromeos/frame/browser_view.cc +++ b/chrome/browser/chromeos/frame/browser_view.cc @@ -486,7 +486,8 @@ void BrowserView::OpenButtonOptions(const views::View* button_view) const { if (button_view == status_area_->network_view()) { browser()->OpenInternetOptionsDialog(); } else if (button_view == status_area_->language_view()) { - LanguageConfigView::Show(GetProfile()); + LanguageConfigView::Show(GetProfile(), + frame()->GetWindow()->GetNativeWindow()); } else { browser()->OpenSystemOptionsDialog(); } diff --git a/chrome/browser/chromeos/options/internet_page_view.cc b/chrome/browser/chromeos/options/internet_page_view.cc index 25b957d..a34bb19 100644 --- a/chrome/browser/chromeos/options/internet_page_view.cc +++ b/chrome/browser/chromeos/options/internet_page_view.cc @@ -9,6 +9,7 @@ #include "app/combobox_model.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/options/network_config_view.h" +#include "chrome/browser/chromeos/options/options_window_view.h" #include "chrome/browser/chromeos/status/network_menu_button.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -202,10 +203,8 @@ void NetworkSection::AddNetwork(int id, const SkBitmap& icon, } void NetworkSection::CreateModalPopup(views::WindowDelegate* view) { - GtkWidget* widget = gtk_widget_get_ancestor( - parent_->GetWidget()->GetNativeView(), GTK_TYPE_WINDOW); views::Window* window = views::Window::CreateChromeWindow( - widget ? GTK_WINDOW(widget) : NULL, gfx::Rect(), view); + GetOptionsViewParent(), gfx::Rect(), view); window->SetIsAlwaysOnTop(true); window->Show(); } diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc index 83fcd09..4944312 100644 --- a/chrome/browser/chromeos/options/language_config_view.cc +++ b/chrome/browser/chromeos/options/language_config_view.cc @@ -14,6 +14,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/language_library.h" #include "chrome/browser/chromeos/options/language_hangul_config_view.h" +#include "chrome/browser/chromeos/options/options_window_view.h" #include "chrome/browser/chromeos/preferences.h" #include "chrome/browser/language_combobox_model.h" #include "chrome/browser/pref_service.h" @@ -247,7 +248,7 @@ void LanguageConfigView::ButtonPressed( views::Button* sender, const views::Event& event) { if (sender->tag() == kAddLanguageButton) { views::Window* window = views::Window::CreateChromeWindow( - NULL, gfx::Rect(), new AddLanguageView(this)); + GetOptionsViewParent(), gfx::Rect(), new AddLanguageView(this)); window->SetIsAlwaysOnTop(true); window->Show(); } else if (sender->tag() == kRemoveLanguageButton) { @@ -278,7 +279,7 @@ void LanguageConfigView::ButtonPressed( return; } views::Window* window = views::Window::CreateChromeWindow( - NULL, gfx::Rect(), config_view); + GetOptionsViewParent(), gfx::Rect(), config_view); window->SetIsAlwaysOnTop(true); window->Show(); } else if (sender->tag() == kChangeUiLanguageButton) { @@ -487,9 +488,9 @@ std::wstring LanguageConfigView::GetText(int row, int column_id) { return L""; } -void LanguageConfigView::Show(Profile* profile) { +void LanguageConfigView::Show(Profile* profile, gfx::NativeWindow parent) { views::Window* window = views::Window::CreateChromeWindow( - NULL, gfx::Rect(), new LanguageConfigView(profile)); + parent, gfx::Rect(), new LanguageConfigView(profile)); window->SetIsAlwaysOnTop(true); window->Show(); } diff --git a/chrome/browser/chromeos/options/language_config_view.h b/chrome/browser/chromeos/options/language_config_view.h index d558dfa..3f79ffb 100644 --- a/chrome/browser/chromeos/options/language_config_view.h +++ b/chrome/browser/chromeos/options/language_config_view.h @@ -90,7 +90,7 @@ class LanguageConfigView : public TableModel, const std::wstring& language_name); // Shows the language config dialog in a new window. - static void Show(Profile* profile); + static void Show(Profile* profile, gfx::NativeWindow parent); private: // Initializes the input method config view. diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc index ba285b3..52f6872 100644 --- a/chrome/browser/chromeos/options/system_page_view.cc +++ b/chrome/browser/chromeos/options/system_page_view.cc @@ -11,6 +11,7 @@ #include "base/stl_util-inl.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/options/language_config_view.h" +#include "chrome/browser/chromeos/options/options_window_view.h" #include "chrome/browser/pref_member.h" #include "chrome/browser/profile.h" #include "chrome/common/pref_names.h" @@ -392,7 +393,7 @@ void LanguageSection::InitContents(GridLayout* layout) { void LanguageSection::ButtonPressed( views::Button* sender, const views::Event& event) { if (sender->tag() == kCustomizeLanguagesButton) { - LanguageConfigView::Show(profile()); + LanguageConfigView::Show(profile(), GetOptionsViewParent()); } } -- cgit v1.1