| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/cocoa/omnibox/omnibox_popup_cell.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 @synthesize contents = contents_; | 413 @synthesize contents = contents_; |
| 414 @synthesize description = description_; | 414 @synthesize description = description_; |
| 415 @synthesize prefix = prefix_; | 415 @synthesize prefix = prefix_; |
| 416 @synthesize image = image_; | 416 @synthesize image = image_; |
| 417 @synthesize incognitoImage = incognitoImage_; | 417 @synthesize incognitoImage = incognitoImage_; |
| 418 @synthesize answerImage = answerImage_; | 418 @synthesize answerImage = answerImage_; |
| 419 @synthesize contentsOffset = contentsOffset_; | 419 @synthesize contentsOffset = contentsOffset_; |
| 420 @synthesize isContentsRTL = isContentsRTL_; | 420 @synthesize isContentsRTL = isContentsRTL_; |
| 421 @synthesize isAnswer = isAnswer_; | 421 @synthesize isAnswer = isAnswer_; |
| 422 @synthesize matchType = matchType_; | 422 @synthesize matchType = matchType_; |
| 423 @synthesize max_lines = max_lines_; | 423 @synthesize maxLines = maxLines_; |
| 424 | 424 |
| 425 - (instancetype)initWithMatch:(const AutocompleteMatch&)match | 425 - (instancetype)initWithMatch:(const AutocompleteMatch&)match |
| 426 contentsOffset:(CGFloat)contentsOffset | 426 contentsOffset:(CGFloat)contentsOffset |
| 427 image:(NSImage*)image | 427 image:(NSImage*)image |
| 428 answerImage:(NSImage*)answerImage | 428 answerImage:(NSImage*)answerImage |
| 429 forDarkTheme:(BOOL)isDarkTheme { | 429 forDarkTheme:(BOOL)isDarkTheme { |
| 430 if ((self = [super init])) { | 430 if ((self = [super init])) { |
| 431 image_ = [image retain]; | 431 image_ = [image retain]; |
| 432 answerImage_ = [answerImage retain]; | 432 answerImage_ = [answerImage retain]; |
| 433 contentsOffset_ = contentsOffset; | 433 contentsOffset_ = contentsOffset; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 446 base::UTF8ToUTF16( | 446 base::UTF8ToUTF16( |
| 447 match.GetAdditionalInfo(kACMatchPropertyContentsPrefix)), | 447 match.GetAdditionalInfo(kACMatchPropertyContentsPrefix)), |
| 448 ContentTextColor(isDarkTheme), textAlignment) retain]; | 448 ContentTextColor(isDarkTheme), textAlignment) retain]; |
| 449 | 449 |
| 450 isAnswer_ = !!match.answer; | 450 isAnswer_ = !!match.answer; |
| 451 if (isAnswer_) { | 451 if (isAnswer_) { |
| 452 contents_ = | 452 contents_ = |
| 453 [CreateAnswerLine(match.answer->first_line(), isDarkTheme) retain]; | 453 [CreateAnswerLine(match.answer->first_line(), isDarkTheme) retain]; |
| 454 description_ = | 454 description_ = |
| 455 [CreateAnswerLine(match.answer->second_line(), isDarkTheme) retain]; | 455 [CreateAnswerLine(match.answer->second_line(), isDarkTheme) retain]; |
| 456 max_lines_ = match.answer->second_line().num_text_lines(); | 456 maxLines_ = match.answer->second_line().num_text_lines(); |
| 457 } else { | 457 } else { |
| 458 contents_ = [CreateClassifiedAttributedString( | 458 contents_ = [CreateClassifiedAttributedString( |
| 459 match.contents, ContentTextColor(isDarkTheme), match.contents_class, | 459 match.contents, ContentTextColor(isDarkTheme), match.contents_class, |
| 460 isDarkTheme) retain]; | 460 isDarkTheme) retain]; |
| 461 if (!match.description.empty()) { | 461 if (!match.description.empty()) { |
| 462 description_ = [CreateClassifiedAttributedString( | 462 description_ = [CreateClassifiedAttributedString( |
| 463 match.description, DimTextColor(isDarkTheme), | 463 match.description, DimTextColor(isDarkTheme), |
| 464 match.description_class, isDarkTheme) retain]; | 464 match.description_class, isDarkTheme) retain]; |
| 465 } | 465 } |
| 466 max_lines_ = 1; | 466 maxLines_ = 1; |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 return self; | 469 return self; |
| 470 } | 470 } |
| 471 | 471 |
| 472 - (void)dealloc { | 472 - (void)dealloc { |
| 473 [incognitoImage_ release]; | 473 [incognitoImage_ release]; |
| 474 [super dealloc]; | 474 [super dealloc]; |
| 475 } | 475 } |
| 476 | 476 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 base::string16 raw_separator = | 736 base::string16 raw_separator = |
| 737 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); | 737 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); |
| 738 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); | 738 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); |
| 739 } | 739 } |
| 740 | 740 |
| 741 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { | 741 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { |
| 742 return NSWidth(cellFrame) - TextStartOffset(); | 742 return NSWidth(cellFrame) - TextStartOffset(); |
| 743 } | 743 } |
| 744 | 744 |
| 745 @end | 745 @end |
| OLD | NEW |