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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
===================================================================
--- chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc (revision 104769)
+++ chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc (working copy)
@@ -24,7 +24,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
-#include "ui/gfx/color_utils.h"
#include "views/controls/button/text_button.h"
#include "views/controls/label.h"
#include "views/controls/link.h"
@@ -51,9 +50,6 @@
// of the field's left edge.
static const int kMinimumFieldSize = 180;
-// Bubble close image.
-static SkBitmap* kCloseImage = NULL;
-
// Declared in browser_dialogs.h so callers don't have to depend on our header.
namespace browser {
@@ -179,20 +175,10 @@
}
void BookmarkBubbleView::Init() {
- static SkColor kTitleColor;
- static bool initialized = false;
- if (!initialized) {
- kTitleColor = color_utils::GetReadableColor(SkColorSetRGB(6, 45, 117),
- Bubble::kBackgroundColor);
- kCloseImage = ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_INFO_BUBBLE_CLOSE);
-
- initialized = true;
- }
-
remove_link_ = new views::Link(l10n_util::GetStringUTF16(
IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK));
remove_link_->set_listener(this);
+ remove_link_->SetBackgroundColor(Bubble::kBackgroundColor);
edit_button_ = new views::NativeTextButton(
this,
@@ -204,6 +190,7 @@
views::Label* combobox_label = new views::Label(
l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT));
+ combobox_label->SetBackgroundColor(Bubble::kBackgroundColor);
parent_combobox_ = new views::Combobox(&parent_model_);
parent_combobox_->SetSelectedItem(parent_model_.node_parent_index());
@@ -216,7 +203,8 @@
IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK));
title_label->SetFont(
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
- title_label->SetColor(kTitleColor);
+ title_label->SetBackgroundColor(Bubble::kBackgroundColor);
+ title_label->SetEnabledColor(SkColorSetRGB(6, 45, 117));
GridLayout* layout = new GridLayout(this);
SetLayoutManager(layout);
@@ -256,8 +244,10 @@
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
layout->StartRow(0, 2);
- layout->AddView(new views::Label(
- l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)));
+ views::Label* label = new views::Label(
+ l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT));
+ label->SetBackgroundColor(Bubble::kBackgroundColor);
+ layout->AddView(label);
title_tf_ = new views::Textfield();
title_tf_->SetText(GetTitle());
layout->AddView(title_tf_);
@@ -342,9 +332,8 @@
return false;
}
-std::wstring BookmarkBubbleView::accessible_name() {
- return UTF16ToWide(
- l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_ADD_BOOKMARK));
+string16 BookmarkBubbleView::GetAccessibleName() {
+ return l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_ADD_BOOKMARK);
}
void BookmarkBubbleView::Close() {

Powered by Google App Engine
This is Rietveld 408576698