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

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

Issue 2478673002: [Mac] Hover/Pressed background for the Omnibox decorations (Closed)
Patch Set: nit Created 4 years, 1 month 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/location_icon_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
index d8a2469675e1e5c6fd41b7c174227573f2d1fe11..1c9d350088dd69de6e8c58a465ff626fc48810dd 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
@@ -18,6 +18,7 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
+#include "skia/ext/skia_utils_mac.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/gfx/image/image.h"
@@ -30,6 +31,10 @@ using content::WebContents;
// icon. Determined with Pixie.app.
const CGFloat kBubblePointYOffset = 2.0;
+// Insets for the background frame.
+const CGFloat kBackgroundFrameXInset = 1.0;
+const CGFloat kBackgroundFrameYInset = 2.0;
+
LocationIconDecoration::LocationIconDecoration(LocationBarViewMac* owner)
: drag_frame_(NSZeroRect), owner_(owner) {
}
@@ -97,10 +102,19 @@ NSPoint LocationIconDecoration::GetBubblePointInFrame(NSRect frame) {
NSMaxY(draw_frame) - kBubblePointYOffset);
}
+NSRect LocationIconDecoration::GetBackgroundFrame(NSRect frame) {
+ return NSInsetRect(frame, kBackgroundFrameXInset, kBackgroundFrameYInset);
+}
+
bool LocationIconDecoration::AcceptsMousePress() {
return true;
}
+bool LocationIconDecoration::HasHoverAndPressEffect() {
+ // The search icon should not show a hover/pressed background.
+ return !owner_->GetOmniboxView()->IsEditingOrEmpty();
+}
+
bool LocationIconDecoration::OnMousePressed(NSRect frame, NSPoint location) {
// TODO(macourteau): this code (for displaying the page info bubble) should be
// pulled out into LocationBarViewMac (or maybe even further), as other

Powered by Google App Engine
This is Rietveld 408576698