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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc

Issue 193026: Merge 25494 - Use system themes where possible in Omnibox edit and dropdown; ... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 3 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/autocomplete/autocomplete_edit_view_gtk.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc (revision 25504)
+++ chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc (working copy)
@@ -17,13 +17,17 @@
#include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/defaults.h"
-#include "chrome/browser/gtk/location_bar_view_gtk.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/toolbar_model.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
+#if !defined(TOOLKIT_VIEWS)
+#include "chrome/browser/views/location_bar_view.h"
+#include "skia/ext/skia_utils_gtk.h"
+#else
+#include "chrome/browser/gtk/location_bar_view_gtk.h"
namespace {
@@ -426,6 +430,59 @@
return something_changed;
}
+gfx::NativeView AutocompleteEditViewGtk::GetNativeView() const {
+ return alignment_.get();
+}
+
+void AutocompleteEditViewGtk::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type == NotificationType::BROWSER_THEME_CHANGED);
+
+ SetBaseColor();
+}
+
+void AutocompleteEditViewGtk::SetBaseColor() {
+#if defined(TOOLKIT_VIEWS)
+ bool use_gtk = false;
+#else
+ bool use_gtk = theme_provider_->UseGtkTheme();
+#endif
+
+ // If we're on a secure connection, ignore what the theme wants us to do
+ // and use a yellow background.
+ bool is_secure = (scheme_security_level_ == ToolbarModel::SECURE);
+ if (use_gtk && !is_secure) {
+ gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL, NULL);
+
+ // Grab the text colors out of the style and set our tags to use them.
+ GtkStyle* style = gtk_rc_get_style(text_view_);
+
+ // style may be unrealized at this point, so calculate the halfway point
+ // between text[] and base[] manually instead of just using text_aa[].
+ GdkColor average_color = gtk_util::AverageColors(
+ style->text[GTK_STATE_NORMAL], style->base[GTK_STATE_NORMAL]);
+
+ g_object_set(G_OBJECT(faded_text_tag_), "foreground-gdk",
+ &average_color, NULL);
+ g_object_set(G_OBJECT(normal_text_tag_), "foreground-gdk",
+ &style->text[GTK_STATE_NORMAL], NULL);
+ } else {
+#if defined(TOOLKIT_VIEWS)
+ const GdkColor background_color = skia::SkColorToGdkColor(
+ LocationBarView::GetColor(is_secure, LocationBarView::BACKGROUND));
+ gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL,
+ &background_color);
+#else
+ gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL,
+ &LocationBarViewGtk::kBackgroundColorByLevel[scheme_security_level_]);
+#endif
+
+ g_object_set(G_OBJECT(faded_text_tag_), "foreground", kTextBaseColor, NULL);
+ g_object_set(G_OBJECT(normal_text_tag_), "foreground", "#000000", NULL);
+ }
+}
+
void AutocompleteEditViewGtk::HandleBeginUserAction() {
OnBeforePossibleChange();
}
Property changes on: chrome\browser\autocomplete\autocomplete_edit_view_gtk.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /trunk/src/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc:r25494
Merged /branches/chrome_webkit_merge_branch/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc:r69-2775

Powered by Google App Engine
This is Rietveld 408576698