summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 19:36:25 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 19:36:25 +0000
commit53af24fa6d03dd0d5d505fd7994b2b5ea2feff9c (patch)
tree6c6f2d9de853fdf4ed4ba5ffe2f3cb9d49b060ae /chrome
parent41635b2d4ed33ecc094856ee5dab6e307eaae231 (diff)
downloadchromium_src-53af24fa6d03dd0d5d505fd7994b2b5ea2feff9c.zip
chromium_src-53af24fa6d03dd0d5d505fd7994b2b5ea2feff9c.tar.gz
chromium_src-53af24fa6d03dd0d5d505fd7994b2b5ea2feff9c.tar.bz2
Lands http://codereview.chromium.org/652010 for Thiago:
views: refactor out the "Alt" TableView feature. BUG=34181 TEST=open bookmarks manager, type something in the search text-field, see if a message is showed when there is no match and see if everything still works as before. Review URL: http://codereview.chromium.org/660380 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/bookmark_table_view.cc47
-rw-r--r--chrome/browser/views/bookmark_table_view.h20
2 files changed, 2 insertions, 65 deletions
diff --git a/chrome/browser/views/bookmark_table_view.cc b/chrome/browser/views/bookmark_table_view.cc
index 0dcf162..e673772 100644
--- a/chrome/browser/views/bookmark_table_view.cc
+++ b/chrome/browser/views/bookmark_table_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -8,7 +8,6 @@
#include "app/drag_drop_types.h"
#include "app/gfx/canvas.h"
-#include "app/gfx/font.h"
#include "app/l10n_util.h"
#include "app/os_exchange_data.h"
#include "app/os_exchange_data_provider_win.h"
@@ -126,18 +125,6 @@ void BookmarkTableView::SaveColumnConfiguration() {
}
}
-void BookmarkTableView::SetAltText(const std::wstring& alt_text) {
- if (alt_text == alt_text_)
- return;
-
- alt_text_ = alt_text;
- if (!GetNativeControlHWND())
- return;
-
- RECT alt_text_bounds = GetAltTextBounds().ToRECT();
- InvalidateRect(GetNativeControlHWND(), &alt_text_bounds, FALSE);
-}
-
void BookmarkTableView::SetShowPathColumn(bool show_path_column) {
if (show_path_column == show_path_column_)
return;
@@ -415,35 +402,3 @@ void BookmarkTableView::UpdateColumns() {
SetColumnVisibility(columns[i].id, true);
OnModelChanged();
}
-
-void BookmarkTableView::PaintAltText() {
- if (alt_text_.empty())
- return;
-
- HDC dc = GetDC(GetNativeControlHWND());
- gfx::Font font = GetAltTextFont();
- gfx::Rect bounds = GetAltTextBounds();
- gfx::Canvas canvas(bounds.width(), bounds.height(), false);
- // Pad by 1 for halo.
- canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1,
- 1, bounds.width() - 2, bounds.height() - 2,
- l10n_util::DefaultCanvasTextAlignment());
- canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL);
- ReleaseDC(GetNativeControlHWND(), dc);
-}
-
-gfx::Rect BookmarkTableView::GetAltTextBounds() {
- static const int kXOffset = 16;
- DCHECK(GetNativeControlHWND());
- RECT client_rect_rect;
- GetClientRect(GetNativeControlHWND(), &client_rect_rect);
- gfx::Rect client_rect(client_rect_rect);
- gfx::Font font = GetAltTextFont();
- // Pad height by 2 for halo.
- return gfx::Rect(kXOffset, content_offset(), client_rect.width() - kXOffset,
- std::max(kImageSize, font.height() + 2));
-}
-
-gfx::Font BookmarkTableView::GetAltTextFont() {
- return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
-}
diff --git a/chrome/browser/views/bookmark_table_view.h b/chrome/browser/views/bookmark_table_view.h
index 2cd6891..90ec996 100644
--- a/chrome/browser/views/bookmark_table_view.h
+++ b/chrome/browser/views/bookmark_table_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -12,9 +12,6 @@
class BookmarkModel;
class BookmarkNode;
class BookmarkTableModel;
-namespace gfx {
-class Font;
-}
class OSExchangeData;
class PrefService;
class Profile;
@@ -47,10 +44,6 @@ class BookmarkTableView : public views::TableView {
// Saves the widths of the table columns.
void SaveColumnConfiguration();
- // Sets the text to display on top of the table. This is useful if the table
- // is empty and you want to inform the user why.
- void SetAltText(const std::wstring& alt_text);
-
protected:
// Overriden to draw a drop indicator when dropping between rows.
virtual void PostPaint();
@@ -138,15 +131,6 @@ class BookmarkTableView : public views::TableView {
// See ShowPathColumn for details.
void UpdateColumns();
- // Draws the alt_text_. Does nothing if there is no alt_text_.
- void PaintAltText();
-
- // Returns the bounds of the alt text.
- gfx::Rect GetAltTextBounds();
-
- // Returns the font used for alt text.
- gfx::Font GetAltTextFont();
-
Profile* profile_;
const BookmarkNode* parent_node_;
@@ -155,8 +139,6 @@ class BookmarkTableView : public views::TableView {
bool show_path_column_;
- std::wstring alt_text_;
-
DISALLOW_COPY_AND_ASSIGN(BookmarkTableView);
};