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

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: Finish mac support; fix pkasting's comments 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 7f86cde2e86ba19236733f9b3df88f32726c5fff..59b69da4e342e9b168c7c9e59bd5764536532d22 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/extension_action_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) {
+ {
+ 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);
+ extensions::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