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

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: add tests 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..368b7603175df0ed34ec1f529a8d152ea7cb4946
--- /dev/null
+++ b/chrome/browser/ui/cocoa/location_bar/separator_decoration.mm
@@ -0,0 +1,40 @@
+// 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"
+
+#include "chrome/browser/themes/theme_service.h"
+#import "chrome/browser/ui/cocoa/nsview_additions.h"
+#import "chrome/browser/ui/cocoa/themed_window.h"
+#include "grit/theme_resources.h"
+
+SeparatorDecoration::SeparatorDecoration() {
+}
+
+SeparatorDecoration::~SeparatorDecoration() {
+}
+
+void SeparatorDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
+ NSRect rect = NSInsetRect(frame, 0, 1);
kuan 2013/01/23 17:01:32 why 1?
sail 2013/01/27 21:11:07 This is needed to avoid overlapping the omnibox be
+ rect.size.width = [control_view cr_lineWidth];
+ rect.origin.x = NSMaxX(frame) - NSWidth(rect);
+ [SeparatorColor(control_view) set];
+ NSRectFill(rect);
kuan 2013/01/23 17:01:32 does this draw a 1-px thick vertical line in retin
sail 2013/01/27 21:11:07 Yep, cr_lineWidth explicitly returns a 1pixel line
+}
+
+CGFloat SeparatorDecoration::GetWidthForSpace(CGFloat width) {
+ return 6;
kuan 2013/01/23 17:01:32 is this for the padding between search token and s
kuan 2013/01/23 17:02:42 also, where do u handle the scenario where separat
sail 2013/01/27 21:11:07 Done. My original patch didn't have this functiona
sail 2013/01/27 21:11:07 I couldn't account for the width because that depe
+}
+
+NSColor* SeparatorDecoration::SeparatorColor(NSView* view) const {
+ ThemeService* themeProvider =
+ static_cast<ThemeService*>([[view window] themeProvider]);
+ if (!themeProvider)
+ return [NSColor lightGrayColor];
+
+ CGFloat line_width = [view cr_lineWidth];
+ NSColor* color =
+ themeProvider->GetNSColor(ThemeService::COLOR_TOOLBAR_BEZEL, true);
+ return [color colorWithAlphaComponent:0.5 / line_width];
kuan 2013/01/23 17:01:32 the colors u use for search token text and separat
sail 2013/01/27 21:11:07 Done. The text color matches the deemphasized tex
+}

Powered by Google App Engine
This is Rietveld 408576698