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

Unified Diff: chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm

Issue 10834279: Give request-to-act badges a grey background, and increase spacing to make it fit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call the right superclass method Created 8 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/ui/cocoa/location_bar/page_action_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
index 2866f959623099226b486cc303c9c3b08ca7ecaa..e54e15b66d213f437234cc32075bd6a6317738ca 100644
--- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
@@ -19,6 +19,7 @@
#import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
#include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
+#include "chrome/browser/ui/omnibox/location_bar_util.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/webui/extensions/extension_info_ui.h"
#include "chrome/common/chrome_notification_types.h"
@@ -27,6 +28,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/gfx/canvas_skia_paint.h"
using content::WebContents;
using extensions::Extension;
@@ -82,6 +84,26 @@ CGFloat PageActionDecoration::GetWidthForSpace(CGFloat width) {
return Extension::kPageActionIconMaxSize;
}
+void PageActionDecoration::DrawWithBackgroundInFrame(NSRect background_frame,
+ NSRect frame,
+ NSView* control_view) {
+ {
+ gfx::Rect bounds(NSRectToCGRect(background_frame));
+ gfx::CanvasSkiaPaint canvas(background_frame, /*opaque=*/false);
+ // set_composite_alpha(true) makes the extension action paint on top of the
+ // location bar instead of whatever's behind the Chrome window.
+ canvas.set_composite_alpha(true);
+ location_bar_util::PaintExtensionActionBackground(
+ *page_action_, current_tab_id_,
+ &canvas, bounds,
+ SK_ColorBLACK, SK_ColorWHITE);
+ // Destroying |canvas| draws the background.
+ }
+
+ ImageDecoration::DrawWithBackgroundInFrame(
+ background_frame, frame, control_view);
+}
+
bool PageActionDecoration::AcceptsMousePress() {
return true;
}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/page_action_decoration.h ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698