diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 21:58:22 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 21:58:22 +0000 |
commit | 0cf9160a53a0dbd523656858a36e3bbeeac76b25 (patch) | |
tree | a8f79cae4266df981fe9836177fb5d55d57a68b3 | |
parent | 2fabd24b9eabb8a66c5553b7b45af134a5b929e5 (diff) | |
download | chromium_src-0cf9160a53a0dbd523656858a36e3bbeeac76b25.zip chromium_src-0cf9160a53a0dbd523656858a36e3bbeeac76b25.tar.gz chromium_src-0cf9160a53a0dbd523656858a36e3bbeeac76b25.tar.bz2 |
Prevent the user from triggering multiple copies of a particular exceptions window.
BUG=34692
TEST=Open the content settings dialog to any page, hit "Exceptions", move the exceptions window and hit "Exceptions" again; we shouldn't spawn another window.
Review URL: http://codereview.chromium.org/596020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38516 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/options/exceptions_view.cc | 14 | ||||
-rw-r--r-- | chrome/browser/views/options/exceptions_view.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/views/options/exceptions_view.cc b/chrome/browser/views/options/exceptions_view.cc index a49df3e..5e01b95 100644 --- a/chrome/browser/views/options/exceptions_view.cc +++ b/chrome/browser/views/options/exceptions_view.cc @@ -18,16 +18,24 @@ #include "views/window/window.h" static const int kExceptionsViewInsetSize = 5; +static ExceptionsView* instances[CONTENT_SETTINGS_NUM_TYPES] = { NULL }; // static void ExceptionsView::ShowExceptionsWindow(gfx::NativeWindow parent, HostContentSettingsMap* map, - ContentSettingsType type) { - views::Window::CreateChromeWindow( - parent, gfx::Rect(), new ExceptionsView(map, type))->Show(); + ContentSettingsType content_type) { + if (!instances[content_type]) { + instances[content_type] = new ExceptionsView(map, content_type); + views::Window::CreateChromeWindow(parent, gfx::Rect(), + instances[content_type]); + } + + // This will show invisible windows and bring visible windows to the front. + instances[content_type]->window()->Show(); } ExceptionsView::~ExceptionsView() { + instances[model_.content_type()] = NULL; table_->SetModel(NULL); } diff --git a/chrome/browser/views/options/exceptions_view.h b/chrome/browser/views/options/exceptions_view.h index cedda01..ca3b110 100644 --- a/chrome/browser/views/options/exceptions_view.h +++ b/chrome/browser/views/options/exceptions_view.h @@ -38,7 +38,7 @@ class ExceptionsView : public ExceptionEditorView::Delegate, // Shows the Exceptions window. static void ShowExceptionsWindow(gfx::NativeWindow parent, HostContentSettingsMap* map, - ContentSettingsType type); + ContentSettingsType content_type); virtual ~ExceptionsView(); |