Skip to content

Commit

Permalink
views: Fix a couple of other trivial TODOs.
Browse files Browse the repository at this point in the history
BUG=None
TEST=None

R=sky@chromium.org

Review URL: http://codereview.chromium.org/7790009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98961 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tfarina@chromium.org committed Aug 31, 2011
1 parent e190daf commit 160bcc4
Show file tree
Hide file tree
Showing 16 changed files with 135 additions and 154 deletions.
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/hung_renderer_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ void HungRendererDialogView::Init() {
info_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);

hung_pages_table_model_.reset(new HungPagesTableModel);
std::vector<TableColumn> columns;
columns.push_back(TableColumn());
std::vector<ui::TableColumn> columns;
columns.push_back(ui::TableColumn());
hung_pages_table_ = new views::GroupTableView(
hung_pages_table_model_.get(), columns, views::ICON_AND_TEXT, true,
false, true, false);
Expand Down
23 changes: 11 additions & 12 deletions chrome/browser/ui/views/ssl_client_certificate_selector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ string16 CertificateSelectorTableModel::GetText(int index, int column_id) {
return items_[index];
}

void CertificateSelectorTableModel::SetObserver(TableModelObserver* observer) {
void CertificateSelectorTableModel::SetObserver(
ui::TableModelObserver* observer) {
}

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -243,17 +244,15 @@ void SSLClientCertificateSelector::OnDoubleClick() {
// SSLClientCertificateSelector private methods:

void SSLClientCertificateSelector::CreateCertTable() {
std::vector<TableColumn> columns;
columns.push_back(TableColumn());
table_ = new views::TableView(
model_.get(),
columns,
views::TEXT_ONLY,
true, // single_selection
true, // resizable_columns
true); // autosize_columns
table_->SetPreferredSize(
gfx::Size(kTableViewWidth, kTableViewHeight));
std::vector<ui::TableColumn> columns;
columns.push_back(ui::TableColumn());
table_ = new views::TableView(model_.get(),
columns,
views::TEXT_ONLY,
true, // single_selection
true, // resizable_columns
true); // autosize_columns
table_->SetPreferredSize(gfx::Size(kTableViewWidth, kTableViewHeight));
table_->SetObserver(this);
}

Expand Down
4 changes: 2 additions & 2 deletions views/controls/table/group_table_view.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -17,7 +17,7 @@ static const int kSeparatorLineThickness = 1;
const char GroupTableView::kViewClassName[] = "views/GroupTableView";

GroupTableView::GroupTableView(GroupTableModel* model,
const std::vector<TableColumn>& columns,
const std::vector<ui::TableColumn>& columns,
TableTypes table_type,
bool single_selection,
bool resizable_columns,
Expand Down
4 changes: 2 additions & 2 deletions views/controls/table/group_table_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct GroupRange {
};

// The model driving the GroupTableView.
class GroupTableModel : public TableModel {
class GroupTableModel : public ui::TableModel {
public:
// Populates the passed range with the first row/last row (included)
// that this item belongs to.
Expand All @@ -35,7 +35,7 @@ class VIEWS_EXPORT GroupTableView : public TableView {
static const char kViewClassName[];

GroupTableView(GroupTableModel* model,
const std::vector<TableColumn>& columns,
const std::vector<ui::TableColumn>& columns,
TableTypes table_type, bool single_selection,
bool resizable_columns, bool autosize_columns,
bool draw_group_separators);
Expand Down
9 changes: 5 additions & 4 deletions views/controls/table/native_table_gtk.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -65,7 +65,7 @@ gfx::NativeView NativeTableGtk::GetTestingHandle() const {
return GTK_WIDGET(tree_view_);
}

void NativeTableGtk::InsertColumn(const TableColumn& column, int index) {
void NativeTableGtk::InsertColumn(const ui::TableColumn& column, int index) {
NOTIMPLEMENTED();
}

Expand Down Expand Up @@ -292,14 +292,15 @@ void NativeTableGtk::CreateNativeControl() {
gtk_widget_show_all(native_view());
}

void NativeTableGtk::InsertTextColumn(const TableColumn& column, int index) {
void NativeTableGtk::InsertTextColumn(const ui::TableColumn& column,
int index) {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(tree_view_, -1,
UTF16ToUTF8(column.title).c_str(),
renderer, "text", index, NULL);
}

void NativeTableGtk::InsertIconAndTextColumn(const TableColumn& column,
void NativeTableGtk::InsertIconAndTextColumn(const ui::TableColumn& column,
int index) {
// If necessary we could support more than 1 icon and text column and we could
// make it so it does not have to be the 1st column.
Expand Down
10 changes: 5 additions & 5 deletions views/controls/table/native_table_gtk.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef VIEWS_CONTROLS_TABLE_NATIVE_TABLE_GTK_H_
#define VIEWS_CONTROLS_TABLE_NATIVE_TABLE_GTK_H_
#pragma once

#include "ui/base/models/table_model.h"
#include "ui/base/gtk/gtk_signal.h"
#include "ui/base/models/table_model.h"
#include "views/controls/native_control_gtk.h"
#include "views/controls/table/native_table_wrapper.h"

Expand All @@ -31,7 +31,7 @@ class NativeTableGtk : public NativeControlGtk, public NativeTableWrapper {
virtual View* GetView();
virtual void SetFocus();
virtual gfx::NativeView GetTestingHandle() const;
virtual void InsertColumn(const TableColumn& column, int index);
virtual void InsertColumn(const ui::TableColumn& column, int index);
virtual void RemoveColumn(int index);
virtual int GetColumnWidth(int column_index) const;
virtual void SetColumnWidth(int column_index, int width);
Expand All @@ -54,8 +54,8 @@ class NativeTableGtk : public NativeControlGtk, public NativeTableWrapper {
virtual void CreateNativeControl();

private:
void InsertTextColumn(const TableColumn& column, int index);
void InsertIconAndTextColumn(const TableColumn& column, int index);
void InsertTextColumn(const ui::TableColumn& column, int index);
void InsertIconAndTextColumn(const ui::TableColumn& column, int index);

// Sets the content of the row pointed to by |iter| in the tree_view_, using
// the data in the model at row |index|.
Expand Down
14 changes: 6 additions & 8 deletions views/controls/table/native_table_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "views/controls/table/table_view_observer.h"
#include "views/widget/widget.h"

using ui::TableColumn;

namespace views {

// Added to column width to prevent truncation.
Expand Down Expand Up @@ -59,21 +57,21 @@ int NativeTableWin::GetRowCount() const {
return ListView_GetItemCount(native_view());
}

void NativeTableWin::InsertColumn(const TableColumn& tc, int index) {
void NativeTableWin::InsertColumn(const ui::TableColumn& tc, int index) {
if (!native_view())
return;

LVCOLUMN column = { 0 };
column.mask = LVCF_TEXT|LVCF_FMT;
column.pszText = const_cast<LPWSTR>(tc.title.c_str());
switch (tc.alignment) {
case TableColumn::LEFT:
case ui::TableColumn::LEFT:
column.fmt = LVCFMT_LEFT;
break;
case TableColumn::RIGHT:
case ui::TableColumn::RIGHT:
column.fmt = LVCFMT_RIGHT;
break;
case TableColumn::CENTER:
case ui::TableColumn::CENTER:
column.fmt = LVCFMT_CENTER;
break;
default:
Expand Down Expand Up @@ -292,7 +290,7 @@ bool NativeTableWin::ProcessMessage(UINT message, WPARAM w_param,
break;

case LVN_COLUMNCLICK: {
const TableColumn& column = table_->GetVisibleColumnAt(
const ui::TableColumn& column = table_->GetVisibleColumnAt(
reinterpret_cast<NMLISTVIEW*>(hdr)->iSubItem);
break;
}
Expand Down Expand Up @@ -585,7 +583,7 @@ void NativeTableWin::UpdateListViewCache(int start, int length, bool add) {
item.mask |= LVIF_IMAGE;

for (size_t j = start_column; j < table_->GetVisibleColumnCount(); ++j) {
TableColumn col = table_->GetVisibleColumnAt(j);
ui::TableColumn col = table_->GetVisibleColumnAt(j);
int max_text_width = ListView_GetStringWidth(native_view(),
col.title.c_str());
for (int i = start; i < max_row; ++i) {
Expand Down
6 changes: 2 additions & 4 deletions views/controls/table/native_table_win.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -14,8 +14,6 @@

typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW;

using ui::TableColumn;

namespace views {

class TableView2;
Expand All @@ -31,7 +29,7 @@ class NativeTableWin : public NativeControlWin, public NativeTableWrapper {
virtual View* GetView();
virtual void SetFocus();
virtual gfx::NativeView GetTestingHandle() const;
virtual void InsertColumn(const TableColumn& column, int index);
virtual void InsertColumn(const ui::TableColumn& column, int index);
virtual void RemoveColumn(int index);
virtual int GetColumnWidth(int column_index) const;
virtual void SetColumnWidth(int column_index, int width);
Expand Down
8 changes: 5 additions & 3 deletions views/controls/table/native_table_wrapper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -8,7 +8,9 @@

#include "ui/gfx/native_widget_types.h"

using ui::TableColumn;
namespace ui {
struct TableColumn;
}

namespace views {

Expand All @@ -23,7 +25,7 @@ class NativeTableWrapper {
virtual int GetRowCount() const = 0;

// Inserts/removes a column at the specified index.
virtual void InsertColumn(const TableColumn& column, int index) = 0;
virtual void InsertColumn(const ui::TableColumn& column, int index) = 0;
virtual void RemoveColumn(int index) = 0;

// Returns the number of rows that are selected.
Expand Down
Loading

0 comments on commit 160bcc4

Please sign in to comment.