diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 18:24:07 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 18:24:07 +0000 |
commit | 25a20177fff41648b629679522415d8966be521f (patch) | |
tree | 41ce40dbef40dc1b7808a7dec1a256f3f1f317ee /chrome/browser/gtk | |
parent | 4e676aa41d39aada2731e64f2807611cfad2c785 (diff) | |
download | chromium_src-25a20177fff41648b629679522415d8966be521f.zip chromium_src-25a20177fff41648b629679522415d8966be521f.tar.gz chromium_src-25a20177fff41648b629679522415d8966be521f.tar.bz2 |
GTK: Make the cookies view modal to its parent since its parent will always be modal.
BUG=35461
TEST=none
Review URL: http://codereview.chromium.org/600089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/options/content_settings_window_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookie_filter_page_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookies_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookies_view.h | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookies_view_unittest.cc | 33 |
5 files changed, 38 insertions, 19 deletions
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.cc b/chrome/browser/gtk/options/content_settings_window_gtk.cc index 853de5b..4b2b0c7 100644 --- a/chrome/browser/gtk/options/content_settings_window_gtk.cc +++ b/chrome/browser/gtk/options/content_settings_window_gtk.cc @@ -71,7 +71,6 @@ ContentSettingsWindowGtk::ContentSettingsWindowGtk(GtkWindow* parent, dialog_ = gtk_dialog_new_with_buttons( l10n_util::GetStringUTF8(IDS_CONTENT_SETTINGS_TITLE).c_str(), parent, - // Non-modal. static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, @@ -81,6 +80,7 @@ ContentSettingsWindowGtk::ContentSettingsWindowGtk(GtkWindow* parent, gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL); gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), gtk_util::kContentAreaSpacing); + gtk_util::SetWindowIcon(GTK_WINDOW(dialog_)); accessibility_widget_helper_.reset(new AccessibleWidgetHelper( dialog_, profile)); diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc index 77df398..34b625a 100644 --- a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc +++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc @@ -201,7 +201,8 @@ void CookieFilterPageGtk::OnShowCookiesClicked( GtkWidget* button, CookieFilterPageGtk* cookie_page) { cookie_page->UserMetricsRecordAction("Options_ShowCookies", NULL); - CookiesView::Show(cookie_page->profile(), + CookiesView::Show(GTK_WINDOW(gtk_widget_get_toplevel(button)), + cookie_page->profile(), new BrowsingDataDatabaseHelper( cookie_page->profile()), new BrowsingDataLocalStorageHelper( diff --git a/chrome/browser/gtk/options/cookies_view.cc b/chrome/browser/gtk/options/cookies_view.cc index 86a1d7e..8b7f105 100644 --- a/chrome/browser/gtk/options/cookies_view.cc +++ b/chrome/browser/gtk/options/cookies_view.cc @@ -58,6 +58,7 @@ CookiesView::~CookiesView() { // static void CookiesView::Show( + GtkWindow* parent, Profile* profile, BrowsingDataDatabaseHelper* browsing_data_database_helper, BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper) { @@ -69,7 +70,8 @@ void CookiesView::Show( if (instance_) { gtk_window_present(GTK_WINDOW(instance_->dialog_)); } else { - instance_ = new CookiesView(profile, + instance_ = new CookiesView(parent, + profile, browsing_data_database_helper, browsing_data_local_storage_helper); instance_->InitStylesAndShow(); @@ -77,6 +79,7 @@ void CookiesView::Show( } CookiesView::CookiesView( + GtkWindow* parent, Profile* profile, BrowsingDataDatabaseHelper* browsing_data_database_helper, BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper) @@ -84,18 +87,20 @@ CookiesView::CookiesView( browsing_data_database_helper_(browsing_data_database_helper), browsing_data_local_storage_helper_(browsing_data_local_storage_helper), filter_update_factory_(this) { - Init(); + Init(parent); } -void CookiesView::Init() { +void CookiesView::Init(GtkWindow* parent) { dialog_ = gtk_dialog_new_with_buttons( l10n_util::GetStringUTF8( IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE).c_str(), - NULL, - GTK_DIALOG_NO_SEPARATOR, + parent, + static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); + // Allow browser windows to go in front of the options dialog in metacity. + gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL); gtk_util::SetWindowIcon(GTK_WINDOW(dialog_)); remove_button_ = gtk_util::AddButtonToDialog( diff --git a/chrome/browser/gtk/options/cookies_view.h b/chrome/browser/gtk/options/cookies_view.h index 80cad06..80e768f 100644 --- a/chrome/browser/gtk/options/cookies_view.h +++ b/chrome/browser/gtk/options/cookies_view.h @@ -34,6 +34,7 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate { // Create (if necessary) and show the cookie manager window. static void Show( + GtkWindow* parent, Profile* profile, BrowsingDataDatabaseHelper* browsing_data_database_helper, BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper); @@ -44,12 +45,13 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate { private: CookiesView( + GtkWindow* parent, Profile* profile, BrowsingDataDatabaseHelper* browsing_data_database_helper, BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper); // Initialize the dialog contents and layout. - void Init(); + void Init(GtkWindow* parent); // Initialize the widget styles and display the dialog. void InitStylesAndShow(); diff --git a/chrome/browser/gtk/options/cookies_view_unittest.cc b/chrome/browser/gtk/options/cookies_view_unittest.cc index 501bb0a..00175c3 100644 --- a/chrome/browser/gtk/options/cookies_view_unittest.cc +++ b/chrome/browser/gtk/options/cookies_view_unittest.cc @@ -181,7 +181,8 @@ class CookiesViewTest : public testing::Test { }; TEST_F(CookiesViewTest, Empty) { - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); @@ -199,7 +200,8 @@ TEST_F(CookiesViewTest, Noop) { monster->SetCookie(GURL("http://foo1"), "E=1"); monster->SetCookie(GURL("http://foo2"), "G=1"); monster->SetCookie(GURL("http://foo2"), "X=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -223,7 +225,8 @@ TEST_F(CookiesViewTest, RemoveAll) { net::CookieMonster* monster = profile_->GetCookieMonster(); monster->SetCookie(GURL("http://foo"), "A=1"); monster->SetCookie(GURL("http://foo2"), "B=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -267,7 +270,8 @@ TEST_F(CookiesViewTest, RemoveAllWithDefaultSelected) { net::CookieMonster* monster = profile_->GetCookieMonster(); monster->SetCookie(GURL("http://foo"), "A=1"); monster->SetCookie(GURL("http://foo2"), "B=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -313,7 +317,8 @@ TEST_F(CookiesViewTest, Remove) { monster->SetCookie(GURL("http://foo1"), "A=1"); monster->SetCookie(GURL("http://foo2"), "B=1"); monster->SetCookie(GURL("http://foo2"), "C=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -466,7 +471,8 @@ TEST_F(CookiesViewTest, RemoveCookiesByType) { monster->SetCookie(GURL("http://foo1"), "E=1"); monster->SetCookie(GURL("http://foo2"), "G=1"); monster->SetCookie(GURL("http://foo2"), "X=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -628,7 +634,8 @@ TEST_F(CookiesViewTest, RemoveByDomain) { monster->SetCookie(GURL("http://foo1"), "E=1"); monster->SetCookie(GURL("http://foo2"), "G=1"); monster->SetCookie(GURL("http://foo2"), "X=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -751,7 +758,8 @@ TEST_F(CookiesViewTest, RemoveDefaultSelection) { monster->SetCookie(GURL("http://foo1"), "E=1"); monster->SetCookie(GURL("http://foo2"), "G=1"); monster->SetCookie(GURL("http://foo2"), "X=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -856,7 +864,8 @@ TEST_F(CookiesViewTest, Filter) { monster->SetCookie(GURL("http://bar0"), "D=1"); monster->SetCookie(GURL("http://foo1"), "B=1"); monster->SetCookie(GURL("http://bar1"), "A=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -923,7 +932,8 @@ TEST_F(CookiesViewTest, FilterRemoveAll) { monster->SetCookie(GURL("http://bar0"), "D=1"); monster->SetCookie(GURL("http://foo1"), "B=1"); monster->SetCookie(GURL("http://bar1"), "A=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); @@ -989,7 +999,8 @@ TEST_F(CookiesViewTest, FilterRemove) { monster->SetCookie(GURL("http://foo1"), "B=1"); monster->SetCookie(GURL("http://bar1"), "A=1"); monster->SetCookie(GURL("http://bar1"), "E=1"); - CookiesView cookies_view(profile_.get(), + CookiesView cookies_view(NULL, + profile_.get(), mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_); mock_browsing_data_database_helper_->AddDatabaseSamples(); |