diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 20:13:24 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 20:13:24 +0000 |
commit | 7668bfe1f7605715c9d72568fde4de5e66534915 (patch) | |
tree | e90e0aff89ad26a21a13656ddfa97f572c0c8395 /chrome/browser/gtk/location_bar_view_gtk.cc | |
parent | 95dd38fd658dd0eef530b3171b641f4a8bf5a224 (diff) | |
download | chromium_src-7668bfe1f7605715c9d72568fde4de5e66534915.zip chromium_src-7668bfe1f7605715c9d72568fde4de5e66534915.tar.gz chromium_src-7668bfe1f7605715c9d72568fde4de5e66534915.tar.bz2 |
Revert "Revert 29457, because this is making ExtensionBrowserTest.PageAction crash on Vista"
Original description:
Implement badges for page actions. Also add badge text color API.
Also change color APIs from wanting ARGB to RGBA.
BUG=24635
BUG=24644
BUG=25215
Review URL: http://codereview.chromium.org/293031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/location_bar_view_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/location_bar_view_gtk.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index e36c8d3..3183ede 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -6,6 +6,7 @@ #include <string> +#include "app/gfx/canvas_paint.h" #include "app/gfx/gtk_util.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" @@ -684,6 +685,8 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk( gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE); g_signal_connect(event_box_.get(), "button-press-event", G_CALLBACK(&OnButtonPressed), this); + g_signal_connect_after(event_box_.get(), "expose-event", + G_CALLBACK(OnExposeEvent), this); image_.Own(gtk_image_new()); gtk_container_add(GTK_CONTAINER(event_box_.get()), image_.get()); @@ -793,3 +796,20 @@ gboolean LocationBarViewGtk::PageActionViewGtk::OnButtonPressed( event->button); return true; } + +// static +gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( + GtkWidget* widget, GdkEventExpose* event, PageActionViewGtk* view) { + TabContents* contents = view->owner_->browser_->GetSelectedTabContents(); + if (!contents) + return FALSE; + const ExtensionActionState* state = + contents->GetPageActionState(view->page_action_); + if (!state || state->badge_text().empty()) + return FALSE; + + gfx::CanvasPaint canvas(event, false); + gfx::Rect bounding_rect(widget->allocation); + state->PaintBadge(&canvas, bounding_rect); + return FALSE; +} |