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

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

Issue 2375033002: cocoa browser: remove non-MD location bar support (Closed)
Patch Set: fix nits Created 4 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/bubble_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
index dbc6c5b50c3c3088b47edb3d1abc3fc91202f017..ed332a3816be226cb827b193702ce22dca5ebd5a 100644
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
@@ -20,15 +20,13 @@
const CGFloat kRightSideMargin = 1.0;
// Padding between the icon/label and bubble edges.
-CGFloat BubblePadding() {
- return ui::MaterialDesignController::IsModeMaterial() ? 8.0 : 3.0;
-}
+const CGFloat kBubblePadding = 8.0;
// Additional padding between the divider and the label.
const CGFloat kDividerPadding = 2.0;
// Padding between the icon and label.
-CGFloat kIconLabelPadding = 4.0;
+const CGFloat kIconLabelPadding = 4.0;
// Inset for the background.
const CGFloat kBackgroundYInset = 4.0;
@@ -45,7 +43,7 @@ CGFloat BubblePadding() {
}
CGFloat BubbleDecoration::DividerPadding() const {
- return ui::MaterialDesignController::IsModeMaterial() ? kDividerPadding : 0.0;
+ return kDividerPadding;
}
CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image,
@@ -55,14 +53,14 @@ CGFloat BubblePadding() {
const CGFloat image_width = image ? [image size].width : 0.0;
if (!label)
- return BubblePadding() + image_width;
+ return kBubblePadding + image_width;
// The bubble needs to take up an integral number of pixels.
// Generally -sizeWithAttributes: seems to overestimate rather than
// underestimate, so floor() seems to work better.
const CGFloat label_width =
std::floor([label sizeWithAttributes:attributes_].width);
- return BubblePadding() + image_width + kIconLabelPadding + label_width +
+ return kBubblePadding + image_width + kIconLabelPadding + label_width +
DividerPadding();
}
@@ -115,22 +113,20 @@ CGFloat BubblePadding() {
}
// Draw the divider and set the text color.
- if (ui::MaterialDesignController::IsModeMaterial()) {
- NSBezierPath* line = [NSBezierPath bezierPath];
- [line setLineWidth:1];
- [line moveToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(),
- NSMinY(decoration_frame))];
- [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(),
- NSMaxY(decoration_frame))];
-
- bool in_dark_mode = [[control_view window] inIncognitoModeWithSystemTheme];
- [GetDividerColor(in_dark_mode) set];
- [line stroke];
-
- NSColor* text_color =
- in_dark_mode ? GetDarkModeTextColor() : GetBackgroundBorderColor();
- SetTextColor(text_color);
- }
+ NSBezierPath* line = [NSBezierPath bezierPath];
+ [line setLineWidth:1];
+ [line moveToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(),
+ NSMinY(decoration_frame))];
+ [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(),
+ NSMaxY(decoration_frame))];
+
+ bool in_dark_mode = [[control_view window] inIncognitoModeWithSystemTheme];
+ [GetDividerColor(in_dark_mode) set];
+ [line stroke];
+
+ NSColor* text_color =
+ in_dark_mode ? GetDarkModeTextColor() : GetBackgroundBorderColor();
+ SetTextColor(text_color);
if (label_) {
NSRect text_rect = frame;
@@ -154,11 +150,6 @@ CGFloat BubblePadding() {
NSView* control_view) {
NSRect rect = NSInsetRect(background_frame, 0, 1);
rect.size.width -= kRightSideMargin;
- if (!ui::MaterialDesignController::IsModeMaterial()) {
- ui::DrawNinePartImage(
- rect, GetBubbleImageIds(), NSCompositeSourceOver, 1.0, true);
- }
-
DrawInFrame(frame, control_view);
}

Powered by Google App Engine
This is Rietveld 408576698