Index: ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm |
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm b/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm |
index 090c25904906648964081ff97dbafcefb38f0ba4..0e8abaa0810d274bf52756656914cc737d1674c2 100644 |
--- a/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm |
+++ b/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm |
@@ -8,7 +8,6 @@ |
#include "base/ios/ios_util.h" |
#include "base/mac/scoped_cftyperef.h" |
-#include "base/mac/scoped_nsobject.h" |
#include "base/strings/sys_string_conversions.h" |
#include "base/strings/utf_string_conversions.h" |
#import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h" |
@@ -29,6 +28,10 @@ |
#import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoFontLoader.h" |
#include "net/base/escape.h" |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
namespace { |
const int kRowCount = 6; |
const CGFloat kRowHeight = 48.0; |
@@ -94,7 +97,7 @@ UIColor* BackgroundColorIncognito() { |
AutocompleteResult _currentResult; |
// Array containing the OmniboxPopupMaterialRow objects displayed in the view. |
- base::scoped_nsobject<NSArray> _rows; |
+ NSArray* _rows; |
// The height of the keyboard. Used to determine the content inset for the |
// scroll view. |
@@ -136,7 +139,6 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
- (void)dealloc { |
self.tableView.delegate = nil; |
[[NSNotificationCenter defaultCenter] removeObserver:self]; |
- [super dealloc]; |
} |
- (UIScrollView*)scrollView { |
@@ -172,10 +174,10 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
smallBoldFont.pointSize, NULL)); |
_bigBoldFont.reset(CTFontCreateWithName((CFStringRef)bigBoldFont.fontName, |
bigBoldFont.pointSize, NULL)); |
- NSMutableArray* rowsBuilder = [[[NSMutableArray alloc] init] autorelease]; |
+ NSMutableArray* rowsBuilder = [[NSMutableArray alloc] init]; |
for (int i = 0; i < kRowCount; i++) { |
- OmniboxPopupMaterialRow* row = [[[OmniboxPopupMaterialRow alloc] |
- initWithIncognito:_incognito] autorelease]; |
+ OmniboxPopupMaterialRow* row = |
+ [[OmniboxPopupMaterialRow alloc] initWithIncognito:_incognito]; |
row.accessibilityIdentifier = |
[NSString stringWithFormat:@"omnibox suggestion %i", i]; |
row.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
@@ -186,7 +188,7 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
[row.appendButton setTag:i]; |
row.rowHeight = kRowHeight; |
} |
- _rows.reset([rowsBuilder copy]); |
+ _rows = [rowsBuilder copy]; |
// Table configuration. |
self.tableView.allowsMultipleSelectionDuringEditing = NO; |
@@ -207,7 +209,7 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
_bigFont.reset(); |
_smallBoldFont.reset(); |
_bigBoldFont.reset(); |
- _rows.reset(); |
+ _rows = nil; |
} |
} |
@@ -417,7 +419,7 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
- (NSMutableAttributedString*)attributedStringWithAnswerLine: |
(const SuggestionAnswer::ImageLine&)line { |
NSMutableAttributedString* result = |
- [[[NSMutableAttributedString alloc] initWithString:@""] autorelease]; |
+ [[NSMutableAttributedString alloc] initWithString:@""]; |
for (size_t i = 0; i < line.text_fields().size(); i++) { |
const SuggestionAnswer::TextField& field = line.text_fields()[i]; |
@@ -426,8 +428,8 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
type:field.type()]]; |
} |
- base::scoped_nsobject<NSAttributedString> spacer( |
- [[NSAttributedString alloc] initWithString:@" "]); |
+ NSAttributedString* spacer = |
+ [[NSAttributedString alloc] initWithString:@" "]; |
if (line.additional_text() != nil) { |
const SuggestionAnswer::TextField* field = line.additional_text(); |
[result appendAttributedString:spacer]; |
@@ -529,8 +531,8 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
[unescapedString stringByReplacingOccurrencesOfString:@"</b>" |
withString:@""]; |
- return [[[NSAttributedString alloc] initWithString:unescapedString |
- attributes:attributes] autorelease]; |
+ return [[NSAttributedString alloc] initWithString:unescapedString |
+ attributes:attributes]; |
} |
- (void)updateMatches:(const AutocompleteResult&)result |
@@ -651,7 +653,7 @@ initWithPopupView:(OmniboxPopupViewIOS*)view |
return; |
_popupView->DidScroll(); |
- for (OmniboxPopupMaterialRow* row in _rows.get()) { |
+ for (OmniboxPopupMaterialRow* row in _rows) { |
row.highlighted = NO; |
} |
} |
@@ -681,11 +683,12 @@ attributedStringWithString:(NSString*)text |
CTFontRef fontRef = smallFont ? _smallFont : _bigFont; |
NSMutableAttributedString* as = |
- [[[NSMutableAttributedString alloc] initWithString:text] autorelease]; |
+ [[NSMutableAttributedString alloc] initWithString:text]; |
// Set the base attributes to the default font and color. |
NSDictionary* dict = [NSDictionary |
- dictionaryWithObjectsAndKeys:(id)fontRef, (NSString*)kCTFontAttributeName, |
+ dictionaryWithObjectsAndKeys:(__bridge id)fontRef, |
rohitrao (ping after 24h)
2017/02/24 13:40:31
There's a CL out to remove all of the CTFont code
Justin Donnelly
2017/02/24 15:40:39
This landed yesterday: http://crrev.com/2695413003
stkhapugin
2017/03/01 17:43:58
Merged this in
|
+ (NSString*)kCTFontAttributeName, |
defaultColor.CGColor, |
(NSString*)kCTForegroundColorAttributeName, |
nil]; |
@@ -707,7 +710,7 @@ attributedStringWithString:(NSString*)text |
const NSRange range = NSMakeRange(location, length); |
if (0 != (i->style & ACMatchClassification::MATCH)) { |
[as addAttribute:(id)kCTFontAttributeName |
- value:(id)boldFontRef |
+ value:(__bridge id)boldFontRef |
rohitrao (ping after 24h)
2017/02/24 13:40:31
What does __bridge do?
stkhapugin
2017/03/01 17:43:58
__bridge is a type of cast that tells ARC to not d
|
range:range]; |
} |