Chromium Code Reviews| Index: chrome/browser/views/options/exceptions_view.cc |
| =================================================================== |
| --- chrome/browser/views/options/exceptions_view.cc (revision 38402) |
| +++ chrome/browser/views/options/exceptions_view.cc (working copy) |
| @@ -18,16 +18,25 @@ |
| #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]); |
| + // The window is alive by itself now... |
|
sky
2010/02/09 21:32:24
I don't get what this comment means.
|
| + } |
| + |
| + // 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); |
| } |