summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 17:44:53 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 17:44:53 +0000
commit822badd170af1f42c4de5d4d3c08157ceb65335d (patch)
tree60a8bbb4de3ba1c5a7c0880191f523d9f687c329
parent9f271a3add5958d0b26105da0f7cbc30fb028fa3 (diff)
downloadchromium_src-822badd170af1f42c4de5d4d3c08157ceb65335d.zip
chromium_src-822badd170af1f42c4de5d4d3c08157ceb65335d.tar.gz
chromium_src-822badd170af1f42c4de5d4d3c08157ceb65335d.tar.bz2
Remove some static initializers caused by colors in gtk_hig_constants.h.
- Remove kGdkGreen (only used in one place) and kGdkGray (used in 3 places for a disabled text field). - Inline the definition of kGdkBlack and kGdkWhite to avoid copy being run as a static initializer. BUG=94925 Review URL: http://codereview.chromium.org/7838014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99973 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/speech/speech_input_bubble_gtk.cc2
-rw-r--r--chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc3
-rw-r--r--chrome/browser/ui/gtk/find_bar_gtk.cc11
-rw-r--r--chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc4
-rw-r--r--ui/base/gtk/gtk_hig_constants.cc16
-rw-r--r--ui/base/gtk/gtk_hig_constants.h17
-rw-r--r--ui/ui.gyp1
8 files changed, 20 insertions, 38 deletions
diff --git a/chrome/browser/speech/speech_input_bubble_gtk.cc b/chrome/browser/speech/speech_input_bubble_gtk.cc
index 69f1d13..55efc47 100644
--- a/chrome/browser/speech/speech_input_bubble_gtk.cc
+++ b/chrome/browser/speech/speech_input_bubble_gtk.cc
@@ -33,7 +33,7 @@ const int kIconHorizontalPadding = 10;
const int kButtonBarHorizontalSpacing = 10;
// Use black for text labels since the bubble has white background.
-const GdkColor kLabelTextColor = ui::kGdkBlack;
+const GdkColor& kLabelTextColor = ui::kGdkBlack;
// Implementation of SpeechInputBubble for GTK. This shows a speech input bubble
// on screen.
diff --git a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
index 2e05f8b..8d3f7c4 100644
--- a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
@@ -138,7 +138,8 @@ ExtensionInstallDialog::ExtensionInstallDialog(
GtkWidget* users_label = gtk_label_new(UTF16ToUTF8(
prompt.GetUserCount()).c_str());
gtk_util::SetLabelWidth(users_label, kLeftColumnMinWidth);
- gtk_util::SetLabelColor(users_label, &ui::kGdkGray);
+ GdkColor gray = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f);
+ gtk_util::SetLabelColor(users_label, &gray);
gtk_util::ForceFontSizePixels(rating_label, kRatingTextSize);
gtk_box_pack_start(GTK_BOX(heading_vbox), users_label,
FALSE, FALSE, 0);
diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc
index 527d825..64a0886 100644
--- a/chrome/browser/ui/gtk/find_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/find_bar_gtk.cc
@@ -49,11 +49,11 @@ namespace {
// Used as the color of the text in the entry box and the text for the results
// label for failure searches.
-const GdkColor kEntryTextColor = ui::kGdkBlack;
+const GdkColor& kEntryTextColor = ui::kGdkBlack;
// Used as the color of the background of the entry box and the background of
// the find label for successful searches.
-const GdkColor kEntryBackgroundColor = ui::kGdkWhite;
+const GdkColor& kEntryBackgroundColor = ui::kGdkWhite;
const GdkColor kFindFailureBackgroundColor = GDK_COLOR_RGB(255, 102, 102);
const GdkColor kFindSuccessTextColor = GDK_COLOR_RGB(178, 178, 178);
@@ -501,12 +501,11 @@ void FindBarGtk::Observe(int type,
gtk_misc_set_alignment(GTK_MISC(match_count_label_), 0.5, 0.5);
} else {
- gtk_widget_modify_cursor(
- text_entry_, &ui::kGdkBlack, &ui::kGdkGray);
+ GdkColor gray = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f);
+ gtk_widget_modify_cursor(text_entry_, &ui::kGdkBlack, &gray);
gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL,
&kEntryBackgroundColor);
- gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL,
- &kEntryTextColor);
+ gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, &kEntryTextColor);
// Until we switch to vector graphics, force the font size.
gtk_util::ForceFontSizePixels(text_entry_, 13.4); // 13.4px == 10pt @ 96dpi
diff --git a/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc
index a7dcd12..7437ffe 100644
--- a/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc
@@ -46,8 +46,8 @@ void FullscreenExitBubbleGtk::InitWidgets() {
link_container_.Own(gtk_util::CreateGtkBorderBin(
link, &ui::kGdkBlack,
kPaddingPx, kPaddingPx, kPaddingPx, kPaddingPx));
- gtk_util::ActAsRoundedWindow(link_container_.get(), ui::kGdkGreen,
- kPaddingPx,
+ GdkColor green = GDK_COLOR_RGB(0x00, 0xff, 0x00);
+ gtk_util::ActAsRoundedWindow(link_container_.get(), green, kPaddingPx,
gtk_util::ROUNDED_BOTTOM_LEFT | gtk_util::ROUNDED_BOTTOM_RIGHT,
gtk_util::BORDER_NONE);
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
index f16d3fa..4b50b12 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
@@ -968,8 +968,8 @@ void OmniboxViewGtk::SetBaseColor() {
#else
background_color_ptr = &LocationBarViewGtk::kBackgroundColor;
#endif
- gtk_widget_modify_cursor(
- text_view_, &ui::kGdkBlack, &ui::kGdkGray);
+ GdkColor gray = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f);
+ gtk_widget_modify_cursor(text_view_, &ui::kGdkBlack, &gray);
gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL, background_color_ptr);
#if !defined(TOOLKIT_VIEWS)
diff --git a/ui/base/gtk/gtk_hig_constants.cc b/ui/base/gtk/gtk_hig_constants.cc
deleted file mode 100644
index f9d0280c..0000000
--- a/ui/base/gtk/gtk_hig_constants.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-#include "ui/base/gtk/gtk_hig_constants.h"
-
-#include <gdk/gdk.h>
-
-namespace ui {
-
-const GdkColor kGdkWhite = GDK_COLOR_RGB(0xff, 0xff, 0xff);
-const GdkColor kGdkGray = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f);
-const GdkColor kGdkBlack = GDK_COLOR_RGB(0x00, 0x00, 0x00);
-const GdkColor kGdkGreen = GDK_COLOR_RGB(0x00, 0xff, 0x00);
-
-} // namespace ui
diff --git a/ui/base/gtk/gtk_hig_constants.h b/ui/base/gtk/gtk_hig_constants.h
index d868b2a..96694c4 100644
--- a/ui/base/gtk/gtk_hig_constants.h
+++ b/ui/base/gtk/gtk_hig_constants.h
@@ -15,16 +15,20 @@
typedef struct _GdkColor GdkColor;
+// Define a macro for creating GdkColors from RGB values. This is a macro to
+// allow static construction of literals, etc. Use this like:
+// GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
+#define GDK_COLOR_RGB(r, g, b) {0, r * ::ui::kSkiaToGDKMultiplier, \
+ g * ::ui::kSkiaToGDKMultiplier, b * ::ui::kSkiaToGDKMultiplier}
+
namespace ui {
// Multiply uint8 color components by this.
const int kSkiaToGDKMultiplier = 257;
// Named color constants.
-UI_EXPORT extern const GdkColor kGdkWhite;
-UI_EXPORT extern const GdkColor kGdkGray;
-UI_EXPORT extern const GdkColor kGdkBlack;
-UI_EXPORT extern const GdkColor kGdkGreen;
+const GdkColor kGdkWhite = GDK_COLOR_RGB(0xff, 0xff, 0xff);
+const GdkColor kGdkBlack = GDK_COLOR_RGB(0x00, 0x00, 0x00);
// Constants relating to the layout of dialog windows:
// (See http://library.gnome.org/devel/hig-book/stable/design-window.html.en)
@@ -49,10 +53,5 @@ const int kFormControlSpacing = 10;
} // namespace ui
-// Define a macro for creating GdkColors from RGB values. This is a macro to
-// allow static construction of literals, etc. Use this like:
-// GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
-#define GDK_COLOR_RGB(r, g, b) {0, r * ::ui::kSkiaToGDKMultiplier, \
- g * ::ui::kSkiaToGDKMultiplier, b * ::ui::kSkiaToGDKMultiplier}
#endif // UI_BASE_GTK_GTK_HIG_CONSTANTS_H_
diff --git a/ui/ui.gyp b/ui/ui.gyp
index e3a30ee..de83e00 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -112,7 +112,6 @@
'base/gtk/gtk_floating_container.h',
'base/gtk/gtk_im_context_util.cc',
'base/gtk/gtk_im_context_util.h',
- 'base/gtk/gtk_hig_constants.cc',
'base/gtk/gtk_hig_constants.h',
'base/gtk/gtk_signal.h',
'base/gtk/gtk_signal_registrar.cc',