Commit c099f68f authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Rename some kBackgroundColor constants to make them unique

In jumbo experiments in chrome/browser/ui, one of the problems
is that there are many kBackgroundColor variables in anonymous
namespaces that become the same anonymous namespaces in jumbo.

This patch gives those constants unique names, matching their
individual use.

Bug: 773275
Change-Id: I8746a88a32f64a0645fd88e850e39d22bc635e19
Reviewed-on: https://chromium-review.googlesource.com/1078814
Commit-Queue: Daniel Bratell <bratell@opera.com>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567021}
parent 8dbc0c82
...@@ -29,7 +29,7 @@ void RemoveUnderlining(NSTextView* textView, int offset, int length) { ...@@ -29,7 +29,7 @@ void RemoveUnderlining(NSTextView* textView, int offset, int length) {
} }
const SkColor kTextColor = SkColorSetRGB(0x66, 0x66, 0x66); const SkColor kTextColor = SkColorSetRGB(0x66, 0x66, 0x66);
const SkColor kBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); const SkColor kPromoViewBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5);
const SkColor kBorderColor = SkColorSetRGB(0xe5, 0xe5, 0xe5); const SkColor kBorderColor = SkColorSetRGB(0xe5, 0xe5, 0xe5);
// Vertical padding of the promo (dp). // Vertical padding of the promo (dp).
...@@ -74,7 +74,8 @@ const int kFontSize = 11; ...@@ -74,7 +74,8 @@ const int kFontSize = 11;
- (void)loadView { - (void)loadView {
NSBox* promoView = [[[NSBox alloc] init] autorelease]; NSBox* promoView = [[[NSBox alloc] init] autorelease];
[promoView setBoxType:NSBoxCustom]; [promoView setBoxType:NSBoxCustom];
[promoView setFillColor:skia::SkColorToDeviceNSColor(kBackgroundColor)]; [promoView
setFillColor:skia::SkColorToDeviceNSColor(kPromoViewBackgroundColor)];
[promoView setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding, [promoView setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding,
kVerticalPadding)]; kVerticalPadding)];
[promoView setBorderType:NSLineBorder]; [promoView setBorderType:NSLineBorder];
......
...@@ -47,7 +47,7 @@ const int kDropdownMinWidth = 64; ...@@ -47,7 +47,7 @@ const int kDropdownMinWidth = 64;
// TODO(crbug.com/831603): Determine how colors should be shared with menus // TODO(crbug.com/831603): Determine how colors should be shared with menus
// and/or omnibox, and how these should interact (if at all) with native // and/or omnibox, and how these should interact (if at all) with native
// theme colors. // theme colors.
const SkColor kBackgroundColor = SK_ColorWHITE; const SkColor kAutofillBackgroundColor = SK_ColorWHITE;
const SkColor kSelectedBackgroundColor = gfx::kGoogleGrey200; const SkColor kSelectedBackgroundColor = gfx::kGoogleGrey200;
const SkColor kFooterBackgroundColor = gfx::kGoogleGrey050; const SkColor kFooterBackgroundColor = gfx::kGoogleGrey050;
const SkColor kSeparatorColor = gfx::kGoogleGrey200; const SkColor kSeparatorColor = gfx::kGoogleGrey200;
...@@ -225,8 +225,8 @@ class AutofillPopupSuggestionView : public AutofillPopupItemView { ...@@ -225,8 +225,8 @@ class AutofillPopupSuggestionView : public AutofillPopupItemView {
protected: protected:
// AutofillPopupRowView: // AutofillPopupRowView:
std::unique_ptr<views::Background> CreateBackground() override { std::unique_ptr<views::Background> CreateBackground() override {
return views::CreateSolidBackground(is_selected_ ? kSelectedBackgroundColor return views::CreateSolidBackground(
: kBackgroundColor); is_selected_ ? kSelectedBackgroundColor : kAutofillBackgroundColor);
} }
private: private:
...@@ -384,7 +384,7 @@ AutofillPopupViewNativeViews::AutofillPopupViewNativeViews( ...@@ -384,7 +384,7 @@ AutofillPopupViewNativeViews::AutofillPopupViewNativeViews(
layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
CreateChildViews(); CreateChildViews();
SetBackground(views::CreateSolidBackground(kBackgroundColor)); SetBackground(views::CreateSolidBackground(kAutofillBackgroundColor));
} }
AutofillPopupViewNativeViews::~AutofillPopupViewNativeViews() {} AutofillPopupViewNativeViews::~AutofillPopupViewNativeViews() {}
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
namespace { namespace {
// Partially-transparent background color. // Partially-transparent background color.
const SkColor kBackgroundColor = SkColorSetARGB(0xcc, 0x28, 0x2c, 0x32); const SkColor kButtonBackgroundColor = SkColorSetARGB(0xcc, 0x28, 0x2c, 0x32);
constexpr int kCloseIconSize = 24; constexpr int kCloseIconSize = 24;
...@@ -48,7 +48,7 @@ class CloseFullscreenButton : public views::Button { ...@@ -48,7 +48,7 @@ class CloseFullscreenButton : public views::Button {
// TODO(robliao): If we decide to move forward with this, use themes. // TODO(robliao): If we decide to move forward with this, use themes.
cc::PaintFlags flags; cc::PaintFlags flags;
flags.setAntiAlias(true); flags.setAntiAlias(true);
flags.setColor(kBackgroundColor); flags.setColor(kButtonBackgroundColor);
flags.setStyle(cc::PaintFlags::kFill_Style); flags.setStyle(cc::PaintFlags::kFill_Style);
float radius = FullscreenControlView::kCircleButtonDiameter / 2.0f; float radius = FullscreenControlView::kCircleButtonDiameter / 2.0f;
canvas->DrawCircle(gfx::PointF(radius, radius), radius, flags); canvas->DrawCircle(gfx::PointF(radius, radius), radius, flags);
......
...@@ -31,7 +31,7 @@ const int kTitlebarLeftPadding = 8; ...@@ -31,7 +31,7 @@ const int kTitlebarLeftPadding = 8;
const int kTitlebarRightPadding = 6; const int kTitlebarRightPadding = 6;
// Colors used to draw border, titlebar background and title text. // Colors used to draw border, titlebar background and title text.
const SkColor kBackgroundColor = SkColorSetRGB(0xec, 0xef, 0xf1); const SkColor kImeBackgroundColor = SkColorSetRGB(0xec, 0xef, 0xf1);
const SkColor kBorderColor = SkColorSetRGB(0xda, 0xdf, 0xe1); const SkColor kBorderColor = SkColorSetRGB(0xda, 0xdf, 0xe1);
} // namespace } // namespace
...@@ -246,7 +246,7 @@ void ImeWindowFrameView::ButtonPressed(views::Button* sender, ...@@ -246,7 +246,7 @@ void ImeWindowFrameView::ButtonPressed(views::Button* sender,
} }
void ImeWindowFrameView::PaintFrameBackground(gfx::Canvas* canvas) { void ImeWindowFrameView::PaintFrameBackground(gfx::Canvas* canvas) {
canvas->DrawColor(kBackgroundColor); canvas->DrawColor(kImeBackgroundColor);
// left border. // left border.
canvas->FillRect(gfx::Rect(0, 0, kImeBorderThickness, height()), canvas->FillRect(gfx::Rect(0, 0, kImeBorderThickness, height()),
......
...@@ -57,9 +57,9 @@ namespace { ...@@ -57,9 +57,9 @@ namespace {
DEFINE_UI_CLASS_PROPERTY_KEY(LabelType, kLabelType, LabelType::kNone); DEFINE_UI_CLASS_PROPERTY_KEY(LabelType, kLabelType, LabelType::kNone);
// IDs of the colors to use for infobar elements. // IDs of the colors to use for infobar elements.
constexpr int kBackgroundColor = constexpr int kInfoBarLabelBackgroundColor =
ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND; ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND;
constexpr int kTextColor = ThemeProperties::COLOR_BOOKMARK_TEXT; constexpr int kInfoBarLabelTextColor = ThemeProperties::COLOR_BOOKMARK_TEXT;
bool SortLabelsByDecreasingWidth(views::Label* label_1, views::Label* label_2) { bool SortLabelsByDecreasingWidth(views::Label* label_1, views::Label* label_2) {
return label_1->GetPreferredSize().width() > return label_1->GetPreferredSize().width() >
...@@ -212,10 +212,10 @@ void InfoBarView::OnPaint(gfx::Canvas* canvas) { ...@@ -212,10 +212,10 @@ void InfoBarView::OnPaint(gfx::Canvas* canvas) {
} }
void InfoBarView::OnThemeChanged() { void InfoBarView::OnThemeChanged() {
const SkColor background_color = GetColor(kBackgroundColor); const SkColor background_color = GetColor(kInfoBarLabelBackgroundColor);
SetBackground(views::CreateSolidBackground(background_color)); SetBackground(views::CreateSolidBackground(background_color));
const SkColor text_color = GetColor(kTextColor); const SkColor text_color = GetColor(kInfoBarLabelTextColor);
views::SetImageFromVectorIcon(close_button_, vector_icons::kCloseRoundedIcon, views::SetImageFromVectorIcon(close_button_, vector_icons::kCloseRoundedIcon,
text_color); text_color);
...@@ -265,7 +265,7 @@ void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) { ...@@ -265,7 +265,7 @@ void InfoBarView::OnWillChangeFocus(View* focused_before, View* focused_now) {
views::Label* InfoBarView::CreateLabel(const base::string16& text) const { views::Label* InfoBarView::CreateLabel(const base::string16& text) const {
views::Label* label = new views::Label(text, CONTEXT_BODY_TEXT_LARGE); views::Label* label = new views::Label(text, CONTEXT_BODY_TEXT_LARGE);
SetLabelDetails(label); SetLabelDetails(label);
label->SetEnabledColor(GetColor(kTextColor)); label->SetEnabledColor(GetColor(kInfoBarLabelTextColor));
label->SetProperty(kLabelType, LabelType::kLabel); label->SetProperty(kLabelType, LabelType::kLabel);
return label; return label;
} }
...@@ -392,7 +392,7 @@ SkColor InfoBarView::GetColor(int id) const { ...@@ -392,7 +392,7 @@ SkColor InfoBarView::GetColor(int id) const {
void InfoBarView::SetLabelDetails(views::Label* label) const { void InfoBarView::SetLabelDetails(views::Label* label) const {
label->SizeToPreferredSize(); label->SizeToPreferredSize();
label->SetBackgroundColor(GetColor(kBackgroundColor)); label->SetBackgroundColor(GetColor(kInfoBarLabelBackgroundColor));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetProperty( label->SetProperty(
views::kMarginsKey, views::kMarginsKey,
......
...@@ -29,7 +29,8 @@ const int kOuterPaddingHorizPx = 40; ...@@ -29,7 +29,8 @@ const int kOuterPaddingHorizPx = 40;
const int kOuterPaddingVertPx = 8; const int kOuterPaddingVertPx = 8;
// Partially-transparent background color. // Partially-transparent background color.
const SkColor kBackgroundColor = SkColorSetARGB(0xcc, 0x28, 0x2c, 0x32); const SkColor kSubtleNotificationBackgroundColor =
SkColorSetARGB(0xcc, 0x28, 0x2c, 0x32);
// Spacing around the key name. // Spacing around the key name.
const int kKeyNameMarginHorizPx = 7; const int kKeyNameMarginHorizPx = 7;
...@@ -145,12 +146,12 @@ SubtleNotificationView::SubtleNotificationView() : instruction_view_(nullptr) { ...@@ -145,12 +146,12 @@ SubtleNotificationView::SubtleNotificationView() : instruction_view_(nullptr) {
std::unique_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( std::unique_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder(
views::BubbleBorder::NONE, views::BubbleBorder::NO_ASSETS, views::BubbleBorder::NONE, views::BubbleBorder::NO_ASSETS,
kBackgroundColor)); kSubtleNotificationBackgroundColor));
SetBackground(std::make_unique<views::BubbleBackground>(bubble_border.get())); SetBackground(std::make_unique<views::BubbleBackground>(bubble_border.get()));
SetBorder(std::move(bubble_border)); SetBorder(std::move(bubble_border));
instruction_view_ = instruction_view_ = new InstructionView(base::string16(), kForegroundColor,
new InstructionView(base::string16(), kForegroundColor, kBackgroundColor); kSubtleNotificationBackgroundColor);
int outer_padding_horiz = kOuterPaddingHorizPx; int outer_padding_horiz = kOuterPaddingHorizPx;
int outer_padding_vert = kOuterPaddingVertPx; int outer_padding_vert = kOuterPaddingVertPx;
......
...@@ -81,7 +81,7 @@ constexpr int kArrowHeight = 14; ...@@ -81,7 +81,7 @@ constexpr int kArrowHeight = 14;
// popup's border. // popup's border.
constexpr int kArrowInset = 3; constexpr int kArrowInset = 3;
const SkColor kBackgroundColor = SkColorSetRGB(0x1F, 0x1F, 0x1F); const SkColor kTryChromeBackgroundColor = SkColorSetRGB(0x1F, 0x1F, 0x1F);
const SkColor kHeaderColor = SkColorSetRGB(0xFF, 0xFF, 0xFF); const SkColor kHeaderColor = SkColorSetRGB(0xFF, 0xFF, 0xFF);
const SkColor kBodyColor = SkColorSetARGB(0xAD, 0xFF, 0xFF, 0xFF); const SkColor kBodyColor = SkColorSetARGB(0xAD, 0xFF, 0xFF, 0xFF);
const SkColor kBorderColor = SkColorSetARGB(0x80, 0x80, 0x80, 0x80); const SkColor kBorderColor = SkColorSetARGB(0x80, 0x80, 0x80, 0x80);
...@@ -612,7 +612,7 @@ void TryChromeDialog::Context::TaskbarCalculator::AddBorderToContents( ...@@ -612,7 +612,7 @@ void TryChromeDialog::Context::TaskbarCalculator::AddBorderToContents(
// and observe the popup so that these pointers can be appropriately cleared. // and observe the popup so that these pointers can be appropriately cleared.
contents_view_ = contents_view; contents_view_ = contents_view;
auto border = std::make_unique<ArrowBorder>( auto border = std::make_unique<ArrowBorder>(
kTryChromeBorderThickness, kBorderColor, kBackgroundColor, kTryChromeBorderThickness, kBorderColor, kTryChromeBackgroundColor,
kInactiveToastArrowIcon, &properties_->border_properties); kInactiveToastArrowIcon, &properties_->border_properties);
border_ = border.get(); border_ = border.get();
contents_view->SetBorder(std::move(border)); contents_view->SetBorder(std::move(border));
...@@ -1038,7 +1038,8 @@ void TryChromeDialog::OnContextInitialized() { ...@@ -1038,7 +1038,8 @@ void TryChromeDialog::OnContextInitialized() {
popup_->Init(params); popup_->Init(params);
auto contents_view = std::make_unique<ClickableView>(); auto contents_view = std::make_unique<ClickableView>();
contents_view->SetBackground(views::CreateSolidBackground(kBackgroundColor)); contents_view->SetBackground(
views::CreateSolidBackground(kTryChromeBackgroundColor));
views::GridLayout* layout = contents_view->SetLayoutManager( views::GridLayout* layout = contents_view->SetLayoutManager(
std::make_unique<views::GridLayout>(contents_view.get())); std::make_unique<views::GridLayout>(contents_view.get()));
layout->set_minimum_size(gfx::Size(kToastWidth, 0)); layout->set_minimum_size(gfx::Size(kToastWidth, 0));
...@@ -1123,7 +1124,7 @@ void TryChromeDialog::OnContextInitialized() { ...@@ -1123,7 +1124,7 @@ void TryChromeDialog::OnContextInitialized() {
auto header = std::make_unique<views::Label>( auto header = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(kExperiments[group_].heading_id), l10n_util::GetStringUTF16(kExperiments[group_].heading_id),
CONTEXT_WINDOWS10_NATIVE); CONTEXT_WINDOWS10_NATIVE);
header->SetBackgroundColor(kBackgroundColor); header->SetBackgroundColor(kTryChromeBackgroundColor);
header->SetEnabledColor(kHeaderColor); header->SetEnabledColor(kHeaderColor);
header->SetMultiLine(true); header->SetMultiLine(true);
header->SetHorizontalAlignment(gfx::ALIGN_LEFT); header->SetHorizontalAlignment(gfx::ALIGN_LEFT);
...@@ -1136,7 +1137,7 @@ void TryChromeDialog::OnContextInitialized() { ...@@ -1136,7 +1137,7 @@ void TryChromeDialog::OnContextInitialized() {
if (body_string_id) { if (body_string_id) {
auto body_text = std::make_unique<views::Label>( auto body_text = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(body_string_id), CONTEXT_WINDOWS10_NATIVE); l10n_util::GetStringUTF16(body_string_id), CONTEXT_WINDOWS10_NATIVE);
body_text->SetBackgroundColor(kBackgroundColor); body_text->SetBackgroundColor(kTryChromeBackgroundColor);
body_text->SetEnabledColor(kBodyColor); body_text->SetEnabledColor(kBodyColor);
body_text->SetMultiLine(true); body_text->SetMultiLine(true);
body_text->SetHorizontalAlignment(gfx::ALIGN_LEFT); body_text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment