Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/views/options/exceptions_view.cc

Issue 593024: Merge 38516 - Prevent the user from triggering multiple copies of a particula... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/options/exceptions_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/options/exceptions_view.h" 5 #include "chrome/browser/views/options/exceptions_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "base/gfx/rect.h" 11 #include "base/gfx/rect.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "grit/locale_settings.h" 13 #include "grit/locale_settings.h"
14 #include "views/controls/button/native_button.h" 14 #include "views/controls/button/native_button.h"
15 #include "views/controls/table/table_view.h" 15 #include "views/controls/table/table_view.h"
16 #include "views/grid_layout.h" 16 #include "views/grid_layout.h"
17 #include "views/standard_layout.h" 17 #include "views/standard_layout.h"
18 #include "views/window/window.h" 18 #include "views/window/window.h"
19 19
20 static const int kExceptionsViewInsetSize = 5; 20 static const int kExceptionsViewInsetSize = 5;
21 static ExceptionsView* instances[CONTENT_SETTINGS_NUM_TYPES] = { NULL };
21 22
22 // static 23 // static
23 void ExceptionsView::ShowExceptionsWindow(gfx::NativeWindow parent, 24 void ExceptionsView::ShowExceptionsWindow(gfx::NativeWindow parent,
24 HostContentSettingsMap* map, 25 HostContentSettingsMap* map,
25 ContentSettingsType type) { 26 ContentSettingsType content_type) {
26 views::Window::CreateChromeWindow( 27 if (!instances[content_type]) {
27 parent, gfx::Rect(), new ExceptionsView(map, type))->Show(); 28 instances[content_type] = new ExceptionsView(map, content_type);
29 views::Window::CreateChromeWindow(parent, gfx::Rect(),
30 instances[content_type]);
31 }
32
33 // This will show invisible windows and bring visible windows to the front.
34 instances[content_type]->window()->Show();
28 } 35 }
29 36
30 ExceptionsView::~ExceptionsView() { 37 ExceptionsView::~ExceptionsView() {
38 instances[model_.content_type()] = NULL;
31 table_->SetModel(NULL); 39 table_->SetModel(NULL);
32 } 40 }
33 41
34 void ExceptionsView::OnSelectionChanged() { 42 void ExceptionsView::OnSelectionChanged() {
35 UpdateButtonState(); 43 UpdateButtonState();
36 } 44 }
37 45
38 void ExceptionsView::OnDoubleClick() { 46 void ExceptionsView::OnDoubleClick() {
39 if (table_->SelectedRowCount() == 1) 47 if (table_->SelectedRowCount() == 1)
40 Edit(); 48 Edit();
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 244 }
237 245
238 UpdateButtonState(); 246 UpdateButtonState();
239 } 247 }
240 248
241 void ExceptionsView::RemoveAll() { 249 void ExceptionsView::RemoveAll() {
242 model_.RemoveAll(); 250 model_.RemoveAll();
243 251
244 UpdateButtonState(); 252 UpdateButtonState();
245 } 253 }
OLDNEW
« no previous file with comments | « chrome/browser/views/options/exceptions_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698