Chromium Code Reviews| 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
 
 | 
| +} |