summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 18:26:24 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 18:26:24 +0000
commitda2e871ccc23c51e9e1301168cd47944c3c3cca1 (patch)
treec73242080bd73a3c2673860ac62f8c5fec8cdae5 /chrome/browser
parent290c612a5328dee9156b976e8c1581ba89382f80 (diff)
downloadchromium_src-da2e871ccc23c51e9e1301168cd47944c3c3cca1.zip
chromium_src-da2e871ccc23c51e9e1301168cd47944c3c3cca1.tar.gz
chromium_src-da2e871ccc23c51e9e1301168cd47944c3c3cca1.tar.bz2
I give up. Reverting all attempts at fixing the gtk-view bustage.
Reverts r22161,r22159,r22155 Review URL: http://codereview.chromium.org/159719 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc76
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h22
2 files changed, 21 insertions, 77 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index fcf5e4d..8c5dbf9 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/defaults.h"
-#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/location_bar_view_gtk.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/toolbar_model.h"
@@ -76,7 +75,7 @@ AutocompleteEditViewGtk::AutocompleteEditViewGtk(
: text_view_(NULL),
tag_table_(NULL),
text_buffer_(NULL),
- faded_text_tag_(NULL),
+ base_tag_(NULL),
secure_scheme_tag_(NULL),
insecure_scheme_tag_(NULL),
model_(new AutocompleteEditModel(this, controller, profile)),
@@ -91,8 +90,7 @@ AutocompleteEditViewGtk::AutocompleteEditViewGtk(
mark_set_handler_id_(0),
button_1_pressed_(false),
text_selected_during_click_(false),
- text_view_focused_before_button_press_(false),
- theme_provider_(GtkThemeProvider::GetFrom(profile)) {
+ text_view_focused_before_button_press_(false) {
model_->set_popup_model(popup_view_->GetModel());
}
@@ -139,6 +137,10 @@ void AutocompleteEditViewGtk::Init() {
popup_window_mode_ ? kPopupWindowFontSize : kFontSize);
}
+ // Override the background color for now. http://crbug.com/12195
+ gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL,
+ &LocationBarViewGtk::kBackgroundColorByLevel[scheme_security_level_]);
+
// The text view was floating. It will now be owned by the alignment.
gtk_container_add(GTK_CONTAINER(alignment_.get()), text_view_);
@@ -147,13 +149,13 @@ void AutocompleteEditViewGtk::Init() {
// We want the tab key to move focus, not insert a tab.
gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(text_view_), false);
- faded_text_tag_ = gtk_text_buffer_create_tag(text_buffer_,
+ base_tag_ = gtk_text_buffer_create_tag(text_buffer_,
NULL, "foreground", kTextBaseColor, NULL);
secure_scheme_tag_ = gtk_text_buffer_create_tag(text_buffer_,
NULL, "foreground", kSecureSchemeColor, NULL);
insecure_scheme_tag_ = gtk_text_buffer_create_tag(text_buffer_,
NULL, "foreground", kInsecureSchemeColor, NULL);
- normal_text_tag_ = gtk_text_buffer_create_tag(text_buffer_,
+ black_text_tag_ = gtk_text_buffer_create_tag(text_buffer_,
NULL, "foreground", "#000000", NULL);
// NOTE: This code used to connect to "changed", however this was fired too
@@ -192,11 +194,6 @@ void AutocompleteEditViewGtk::Init() {
text_buffer_, "mark-set", G_CALLBACK(&HandleMarkSetThunk), this);
g_signal_connect(text_view_, "drag-data-received",
G_CALLBACK(&HandleDragDataReceivedThunk), this);
-
- registrar_.Add(this,
- NotificationType::BROWSER_THEME_CHANGED,
- NotificationService::AllSources());
- theme_provider_->InitThemesFor(this);
}
void AutocompleteEditViewGtk::SetFocus() {
@@ -231,7 +228,8 @@ void AutocompleteEditViewGtk::Update(const TabContents* contents) {
// TODO(deanm): This doesn't exactly match Windows. There there is a member
// background_color_. I think we can get away with just the level though.
if (changed_security_level) {
- SetBaseColor();
+ gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL,
+ &LocationBarViewGtk::kBackgroundColorByLevel[security_level]);
}
if (contents) {
@@ -430,48 +428,6 @@ bool AutocompleteEditViewGtk::OnAfterPossibleChange() {
return something_changed;
}
-void AutocompleteEditViewGtk::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- DCHECK(type == NotificationType::BROWSER_THEME_CHANGED);
-
- SetBaseColor();
-}
-
-void AutocompleteEditViewGtk::SetBaseColor() {
- // If we're on a secure connection, ignore what the theme wants us to do
- // and use a yellow background.
- if (theme_provider_->UseGtkTheme() &&
- scheme_security_level_ != ToolbarModel::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 halfway_point;
- halfway_point.pixel = 0;
- halfway_point.red = (style->text[GTK_STATE_NORMAL].red +
- style->base[GTK_STATE_NORMAL].red) / 2;
- halfway_point.green = (style->text[GTK_STATE_NORMAL].green +
- style->base[GTK_STATE_NORMAL].green) / 2;
- halfway_point.blue = (style->text[GTK_STATE_NORMAL].blue +
- style->base[GTK_STATE_NORMAL].blue) / 2;
-
- g_object_set(G_OBJECT(faded_text_tag_), "foreground-gdk",
- &halfway_point, NULL);
- g_object_set(G_OBJECT(normal_text_tag_), "foreground-gdk",
- &style->text[GTK_STATE_NORMAL], NULL);
- } else {
- gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL,
- &LocationBarViewGtk::kBackgroundColorByLevel[scheme_security_level_]);
-
- 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();
}
@@ -825,7 +781,7 @@ void AutocompleteEditViewGtk::EmphasizeURLComponents() {
gtk_text_buffer_get_bounds(text_buffer_, &start, &end);
gtk_text_buffer_remove_all_tags(text_buffer_, &start, &end);
if (emphasize) {
- gtk_text_buffer_apply_tag(text_buffer_, faded_text_tag_, &start, &end);
+ gtk_text_buffer_apply_tag(text_buffer_, base_tag_, &start, &end);
// We've found a host name, give it more emphasis.
gtk_text_buffer_get_iter_at_line_index(text_buffer_, &start, 0,
@@ -834,10 +790,14 @@ void AutocompleteEditViewGtk::EmphasizeURLComponents() {
gtk_text_buffer_get_iter_at_line_index(text_buffer_, &end, 0,
GetUTF8Offset(text,
parts.host.end()));
-
- gtk_text_buffer_apply_tag(text_buffer_, normal_text_tag_, &start, &end);
+ // The following forces the text color to black. When we start obeying the
+ // user theme, we want to remove_all_tags (to get the user's default
+ // text color) rather than applying a color tag. http://crbug.com/12195
+ gtk_text_buffer_apply_tag(text_buffer_, black_text_tag_, &start, &end);
} else {
- gtk_text_buffer_apply_tag(text_buffer_, normal_text_tag_, &start, &end);
+ // For now, force the text color to be black. Eventually, we should allow
+ // the user to override via gtk theming. http://crbug.com/12195
+ gtk_text_buffer_apply_tag(text_buffer_, black_text_tag_, &start, &end);
}
// Emphasize the scheme for security UI display purposes (if necessary).
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index 63a7d60..3c1c491 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -12,8 +12,6 @@
#include "base/string_util.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/toolbar_model.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
#include "chrome/common/owned_widget_gtk.h"
#include "chrome/common/page_transition_types.h"
#include "webkit/glue/window_open_disposition.h"
@@ -23,12 +21,10 @@ class AutocompleteEditModel;
class AutocompletePopupPositioner;
class AutocompletePopupViewGtk;
class CommandUpdater;
-class GtkThemeProvider;
class Profile;
class TabContents;
-class AutocompleteEditViewGtk : public AutocompleteEditView,
- public NotificationObserver {
+class AutocompleteEditViewGtk : public AutocompleteEditView {
public:
// Modeled like the Windows CHARRANGE. Represent a pair of cursor position
// offsets. Since GtkTextIters are invalid after the buffer is changed, we
@@ -102,13 +98,6 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
virtual void OnBeforePossibleChange();
virtual bool OnAfterPossibleChange();
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- void SetBaseColor();
-
private:
// TODO(deanm): Would be nice to insulate the thunkers better, etc.
static void HandleBeginUserActionThunk(GtkTextBuffer* unused, gpointer self) {
@@ -292,10 +281,10 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkTextTagTable* tag_table_;
GtkTextBuffer* text_buffer_;
- GtkTextTag* faded_text_tag_;
+ GtkTextTag* base_tag_;
GtkTextTag* secure_scheme_tag_;
GtkTextTag* insecure_scheme_tag_;
- GtkTextTag* normal_text_tag_;
+ GtkTextTag* black_text_tag_;
scoped_ptr<AutocompleteEditModel> model_;
scoped_ptr<AutocompletePopupViewGtk> popup_view_;
@@ -343,11 +332,6 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// is released (we only do so if the view was initially unfocused).
bool text_view_focused_before_button_press_;
- // Supplies colors, et cetera.
- GtkThemeProvider* theme_provider_;
-
- NotificationRegistrar registrar_;
-
DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk);
};