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

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: Avoid changing Mac edit field width when script badges disabled 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 8dc20def08c845940dd76581edb46487aa2f2a85..d82549564576948bb63fd789cac24f3f4c569406 100644
--- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
@@ -18,7 +18,9 @@
#import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h"
#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/autocomplete_text_field_cell.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 +29,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;
@@ -94,6 +97,25 @@ CGFloat PageActionDecoration::GetWidthForSpace(CGFloat width) {
return Extension::kPageActionIconMaxSize;
}
+void PageActionDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
Scott Hess - ex-Googler 2012/09/12 22:54:08 I'm not entirely comfortable with this. Having to
Jeffrey Yasskin 2012/09/14 22:13:45 Done.
+ {
+ CGFloat horiz_padding = [AutocompleteTextFieldCell decorationHorizontalPad];
+ frame = NSInsetRect(frame, -(horiz_padding + 1) / 2, 2);
+ gfx::Rect bounds(NSRectToCGRect(frame));
+ gfx::CanvasSkiaPaint canvas(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::DrawInFrame(frame, control_view);
+}
+
bool PageActionDecoration::AcceptsMousePress() {
return true;
}

Powered by Google App Engine
This is Rietveld 408576698