| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "gfx/font.h" | 9 #include "gfx/font.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 availableWidth:(CGFloat)width { | 173 availableWidth:(CGFloat)width { |
| 174 DCHECK(fullString != nil); | 174 DCHECK(fullString != nil); |
| 175 | 175 |
| 176 hintString_.reset(); | 176 hintString_.reset(); |
| 177 | 177 |
| 178 // Adjust for space between editor and decorations. | 178 // Adjust for space between editor and decorations. |
| 179 width -= 2 * kEditorHorizontalInset; | 179 width -= 2 * kEditorHorizontalInset; |
| 180 | 180 |
| 181 // Get the magnifying glass to put at the front of the string. | 181 // Get the magnifying glass to put at the front of the string. |
| 182 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 182 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 183 NSImage* image = rb.GetNSImageNamed(IDR_O2_SEARCH); | 183 NSImage* image = rb.GetNSImageNamed(IDR_OMNIBOX_SEARCH); |
| 184 const NSSize imageSize = [image size]; | 184 const NSSize imageSize = [image size]; |
| 185 | 185 |
| 186 // Based on what fits, choose |fullString| with the image, | 186 // Based on what fits, choose |fullString| with the image, |
| 187 // |fullString| without the image, or |partialString|. | 187 // |fullString| without the image, or |partialString|. |
| 188 NSDictionary* attributes = | 188 NSDictionary* attributes = |
| 189 [NSDictionary dictionaryWithObject:[self font] | 189 [NSDictionary dictionaryWithObject:[self font] |
| 190 forKey:NSFontAttributeName]; | 190 forKey:NSFontAttributeName]; |
| 191 NSString* s = fullString; | 191 NSString* s = fullString; |
| 192 const CGFloat sWidth = [s sizeWithAttributes:attributes].width; | 192 const CGFloat sWidth = [s sizeWithAttributes:attributes].width; |
| 193 if (sWidth + imageSize.width > width) { | 193 if (sWidth + imageSize.width > width) { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 icon = [self iconForEvent:theEvent inRect:cellFrame ofView:controlView]; | 592 icon = [self iconForEvent:theEvent inRect:cellFrame ofView:controlView]; |
| 593 if (icon) { | 593 if (icon) { |
| 594 [icon view]->OnMousePressed([icon rect]); | 594 [icon view]->OnMousePressed([icon rect]); |
| 595 return YES; | 595 return YES; |
| 596 } | 596 } |
| 597 | 597 |
| 598 return NO; | 598 return NO; |
| 599 } | 599 } |
| 600 | 600 |
| 601 @end | 601 @end |
| OLD | NEW |