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

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

Issue 12042002: Alternate NTP: Add search token to omnibox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 7 years, 11 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/separator_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/separator_decoration.mm b/chrome/browser/ui/cocoa/location_bar/separator_decoration.mm
new file mode 100644
index 0000000000000000000000000000000000000000..31111c6e8a797c2181d96fba4428cec7fa84a9fe
--- /dev/null
+++ b/chrome/browser/ui/cocoa/location_bar/separator_decoration.mm
@@ -0,0 +1,37 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/ui/cocoa/location_bar/separator_decoration.h"
+
+#import "chrome/browser/ui/cocoa/nsview_additions.h"
+
+SeparatorDecoration::SeparatorDecoration() {
+}
+
+SeparatorDecoration::~SeparatorDecoration() {
+}
+
+void SeparatorDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
+ // Inset by 1 from top and bottom to avoid drawing on top of the the omnibox
+ // bezel.
+ NSRect rect = NSInsetRect(frame, 0, 1);
+ rect.size.width = [control_view cr_lineWidth];
+ rect.origin.x = NSMaxX(frame) - NSWidth(rect);
+ [SeparatorColor(control_view) set];
+ NSRectFillUsingOperation(rect, NSCompositeSourceOver);
+}
+
+CGFloat SeparatorDecoration::GetWidthForSpace(CGFloat width,
+ CGFloat text_width) {
+ return 2;
+}
+
+SeparatorDecoration* SeparatorDecoration::AsSeparatorDecoration() {
+ return this;
+}
+
+NSColor* SeparatorDecoration::SeparatorColor(NSView* view) const {
+ const CGFloat lineWidth = [view cr_lineWidth];
+ return [[NSColor lightGrayColor] colorWithAlphaComponent:0.25 / lineWidth];
Scott Hess - ex-Googler 2013/01/29 23:28:36 This seems like an odd and dangerous formulation t
sail 2013/01/30 01:40:55 I agree that this is weird but this is how we do i
Scott Hess - ex-Googler 2013/01/30 23:48:42 Not so great if |view| ends up nil in any of those
sail 2013/01/31 03:08:00 Done. Used an if statement instead.
+}

Powered by Google App Engine
This is Rietveld 408576698