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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Yank unrelated changes. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/mac/objc_property_releaser.h" 14 #include "base/mac/objc_release_properties.h"
15 #include "base/mac/scoped_nsobject.h" 15 #include "base/mac/scoped_nsobject.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" 20 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h"
21 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 21 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
22 #import "chrome/browser/ui/cocoa/themed_window.h" 22 #import "chrome/browser/ui/cocoa/themed_window.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "components/omnibox/browser/omnibox_popup_model.h" 24 #include "components/omnibox/browser/omnibox_popup_model.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 value:DimTextColor(is_dark_theme) 336 value:DimTextColor(is_dark_theme)
337 range:range]; 337 range:range];
338 } 338 }
339 } 339 }
340 340
341 return attributedString; 341 return attributedString;
342 } 342 }
343 343
344 } // namespace 344 } // namespace
345 345
346 @interface OmniboxPopupCellData () {
347 base::mac::ObjCPropertyReleaser propertyReleaser_OmniboxPopupCellData_;
348 }
349 @end
350
351 @interface OmniboxPopupCell () 346 @interface OmniboxPopupCell ()
352 - (CGFloat)drawMatchPart:(NSAttributedString*)attributedString 347 - (CGFloat)drawMatchPart:(NSAttributedString*)attributedString
353 withFrame:(NSRect)cellFrame 348 withFrame:(NSRect)cellFrame
354 origin:(NSPoint)origin 349 origin:(NSPoint)origin
355 withMaxWidth:(int)maxWidth 350 withMaxWidth:(int)maxWidth
356 forDarkTheme:(BOOL)isDarkTheme; 351 forDarkTheme:(BOOL)isDarkTheme;
357 - (CGFloat)drawMatchPrefixWithFrame:(NSRect)cellFrame 352 - (CGFloat)drawMatchPrefixWithFrame:(NSRect)cellFrame
358 tableView:(OmniboxPopupMatrix*)tableView 353 tableView:(OmniboxPopupMatrix*)tableView
359 withContentsMaxWidth:(int*)contentsMaxWidth 354 withContentsMaxWidth:(int*)contentsMaxWidth
360 forDarkTheme:(BOOL)isDarkTheme; 355 forDarkTheme:(BOOL)isDarkTheme;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 contents_ = [CreateClassifiedAttributedString( 406 contents_ = [CreateClassifiedAttributedString(
412 match.contents, ContentTextColor(isDarkTheme), match.contents_class, 407 match.contents, ContentTextColor(isDarkTheme), match.contents_class,
413 isDarkTheme) retain]; 408 isDarkTheme) retain];
414 if (!match.description.empty()) { 409 if (!match.description.empty()) {
415 description_ = [CreateClassifiedAttributedString( 410 description_ = [CreateClassifiedAttributedString(
416 match.description, DimTextColor(isDarkTheme), 411 match.description, DimTextColor(isDarkTheme),
417 match.description_class, isDarkTheme) retain]; 412 match.description_class, isDarkTheme) retain];
418 } 413 }
419 maxLines_ = 1; 414 maxLines_ = 1;
420 } 415 }
421 propertyReleaser_OmniboxPopupCellData_.Init(self,
422 [OmniboxPopupCellData class]);
423 } 416 }
424 return self; 417 return self;
425 } 418 }
426 419
420 - (void)dealloc {
421 base::mac::ReleaseProperties(self);
422 [super dealloc];
423 }
424
427 - (instancetype)copyWithZone:(NSZone*)zone { 425 - (instancetype)copyWithZone:(NSZone*)zone {
428 return [self retain]; 426 return [self retain];
429 } 427 }
430 428
431 - (CGFloat)getMatchContentsWidth { 429 - (CGFloat)getMatchContentsWidth {
432 return [contents_ size].width; 430 return [contents_ size].width;
433 } 431 }
434 432
435 @end 433 @end
436 434
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 base::string16 raw_separator = 677 base::string16 raw_separator =
680 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); 678 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR);
681 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); 679 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme));
682 } 680 }
683 681
684 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame { 682 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame {
685 return NSWidth(cellFrame) - kMaterialTextStartOffset; 683 return NSWidth(cellFrame) - kMaterialTextStartOffset;
686 } 684 }
687 685
688 @end 686 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698