Commit 0cf9160a authored by pkasting@chromium.org's avatar pkasting@chromium.org

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
parent 2fabd24b
......@@ -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);
}
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment