summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 13:40:40 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 13:40:40 +0000
commit56f1a6ba817c77388d9df86c0f23db4dde7e0934 (patch)
treebd8c938c53f69f2ae1e104cf90cad49511e639b3 /views
parent763e638fc941c4295feb961ea1c9b127de28de6a (diff)
downloadchromium_src-56f1a6ba817c77388d9df86c0f23db4dde7e0934.zip
chromium_src-56f1a6ba817c77388d9df86c0f23db4dde7e0934.tar.gz
chromium_src-56f1a6ba817c77388d9df86c0f23db4dde7e0934.tar.bz2
[Win] Add per-plugin exceptions to content settings.
Screenshot: http://imgur.com/yxEzO.png BUG=39252 TEST=PluginExceptionsTableModel.* Review URL: http://codereview.chromium.org/3307014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/table/table_view.cc38
-rw-r--r--views/controls/table/table_view.h3
2 files changed, 26 insertions, 15 deletions
diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc
index e397ce9..42c137d 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -278,6 +278,8 @@ void TableView::OnModelChanged() {
if (!list_view_)
return;
+ UpdateGroups();
+
int current_row_count = ListView_GetItemCount(list_view_);
if (current_row_count > 0)
OnItemsRemoved(0, current_row_count);
@@ -805,21 +807,7 @@ HWND TableView::CreateNativeControl(HWND parent_container) {
if (model_)
model_->SetObserver(this);
- // Add the groups.
- if (model_ && model_->HasGroups()) {
- ListView_EnableGroupView(list_view_, true);
-
- TableModel::Groups groups = model_->GetGroups();
- LVGROUP group = { 0 };
- group.cbSize = sizeof(LVGROUP);
- group.mask = LVGF_HEADER | LVGF_ALIGN | LVGF_GROUPID;
- group.uAlign = LVGA_HEADER_LEFT;
- for (size_t i = 0; i < groups.size(); ++i) {
- group.pszHeader = const_cast<wchar_t*>(groups[i].title.c_str());
- group.iGroupId = groups[i].id;
- ListView_InsertGroup(list_view_, static_cast<int>(i), &group);
- }
- }
+ UpdateGroups();
// Set the # of rows.
if (model_)
@@ -1535,6 +1523,26 @@ void TableView::UpdateContentOffset() {
content_offset_ = origin.y + header_bounds.bottom - header_bounds.top;
}
+void TableView::UpdateGroups() {
+ // Add the groups.
+ if (model_ && model_->HasGroups()) {
+ ListView_EnableGroupView(list_view_, true);
+
+ ListView_RemoveAllGroups(list_view_);
+
+ TableModel::Groups groups = model_->GetGroups();
+ LVGROUP group = { 0 };
+ group.cbSize = sizeof(LVGROUP);
+ group.mask = LVGF_HEADER | LVGF_ALIGN | LVGF_GROUPID;
+ group.uAlign = LVGA_HEADER_LEFT;
+ for (size_t i = 0; i < groups.size(); ++i) {
+ group.pszHeader = const_cast<wchar_t*>(groups[i].title.c_str());
+ group.iGroupId = groups[i].id;
+ ListView_InsertGroup(list_view_, static_cast<int>(i), &group);
+ }
+ }
+}
+
gfx::Rect TableView::GetAltTextBounds() {
static const int kXOffset = 16;
DCHECK(GetNativeControlHWND());
diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h
index 9444d96b..eb557da 100644
--- a/views/controls/table/table_view.h
+++ b/views/controls/table/table_view.h
@@ -402,6 +402,9 @@ class TableView : public NativeControl,
// Updates content_offset_ from the position of the header.
void UpdateContentOffset();
+ // Reloads the groups from the model if there is one and it has groups.
+ void UpdateGroups();
+
// Returns the bounds of the alt text.
gfx::Rect GetAltTextBounds();