| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ios/chrome/browser/ui/tools_menu/tools_menu_view_tools_cell.h" | 5 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_tools_cell.h" |
| 6 | 6 |
| 7 #include "base/mac/objc_property_releaser.h" | |
| 8 #include "components/strings/grit/components_strings.h" | 7 #include "components/strings/grit/components_strings.h" |
| 9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 8 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 10 #include "ios/chrome/browser/ui/rtl_geometry.h" | 9 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 11 #include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h" | 10 #include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h" |
| 12 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 11 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 13 #include "ios/chrome/grit/ios_strings.h" | 12 #include "ios/chrome/grit/ios_strings.h" |
| 14 | 13 |
| 15 // TODO(crbug.com/228521): Remove this once the new command/metric handling is | 14 // TODO(crbug.com/228521): Remove this once the new command/metric handling is |
| 16 // implemented. This is a temporary workaround to allow metrics recording to | 15 // implemented. This is a temporary workaround to allow metrics recording to |
| 17 // distinguish the action. The value used is in the dynamic range (< | 16 // distinguish the action. The value used is in the dynamic range (< |
| 18 // IDC_MinimumLabelValue) to avoid collisions. | 17 // IDC_MinimumLabelValue) to avoid collisions. |
| 19 #define IDC_TEMP_EDIT_BOOKMARK 3900 | 18 #define IDC_TEMP_EDIT_BOOKMARK 3900 |
| 20 | 19 |
| 21 @implementation ToolsMenuViewToolsCell { | 20 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 22 base::mac::ObjCPropertyReleaser _propertyReleaser_ToolsMenuViewToolsCell; | 21 #error "This file requires ARC support." |
| 23 } | 22 #endif |
| 23 |
| 24 @implementation ToolsMenuViewToolsCell |
| 24 | 25 |
| 25 @synthesize reloadButton = _reloadButton; | 26 @synthesize reloadButton = _reloadButton; |
| 26 @synthesize shareButton = _shareButton; | 27 @synthesize shareButton = _shareButton; |
| 27 @synthesize starButton = _starButton; | 28 @synthesize starButton = _starButton; |
| 28 @synthesize starredButton = _starredButton; | 29 @synthesize starredButton = _starredButton; |
| 29 @synthesize stopButton = _stopButton; | 30 @synthesize stopButton = _stopButton; |
| 30 @synthesize toolsButton = _toolsButton; | 31 @synthesize toolsButton = _toolsButton; |
| 31 | 32 |
| 32 - (instancetype)initWithCoder:(NSCoder*)aDecoder { | 33 - (instancetype)initWithCoder:(NSCoder*)aDecoder { |
| 33 self = [super initWithCoder:aDecoder]; | 34 self = [super initWithCoder:aDecoder]; |
| 34 if (self) | 35 if (self) |
| 35 [self commonInitialization]; | 36 [self commonInitialization]; |
| 36 | 37 |
| 37 return self; | 38 return self; |
| 38 } | 39 } |
| 39 | 40 |
| 40 - (instancetype)initWithFrame:(CGRect)frame { | 41 - (instancetype)initWithFrame:(CGRect)frame { |
| 41 self = [super initWithFrame:frame]; | 42 self = [super initWithFrame:frame]; |
| 42 if (self) | 43 if (self) |
| 43 [self commonInitialization]; | 44 [self commonInitialization]; |
| 44 | 45 |
| 45 return self; | 46 return self; |
| 46 } | 47 } |
| 47 | 48 |
| 48 - (void)commonInitialization { | 49 - (void)commonInitialization { |
| 49 _propertyReleaser_ToolsMenuViewToolsCell.Init(self, | |
| 50 [ToolsMenuViewToolsCell class]); | |
| 51 | |
| 52 [self setBackgroundColor:[UIColor whiteColor]]; | 50 [self setBackgroundColor:[UIColor whiteColor]]; |
| 53 [self setOpaque:YES]; | 51 [self setOpaque:YES]; |
| 54 | 52 |
| 55 int star[2][3] = TOOLBAR_IDR_TWO_STATE(STAR); | 53 int star[2][3] = TOOLBAR_IDR_TWO_STATE(STAR); |
| 56 _starButton = [self newButtonForImageIds:star | 54 _starButton = [self newButtonForImageIds:star |
| 57 commandID:IDC_BOOKMARK_PAGE | 55 commandID:IDC_BOOKMARK_PAGE |
| 58 accessibilityLabelID:IDS_BOOKMARK_ADD_EDITOR_TITLE | 56 accessibilityLabelID:IDS_BOOKMARK_ADD_EDITOR_TITLE |
| 59 automationName:@"Add Bookmark"]; | 57 automationName:@"Add Bookmark"]; |
| 60 | 58 |
| 61 int star_pressed[2][3] = TOOLBAR_IDR_ONE_STATE(STAR_PRESSED); | 59 int star_pressed[2][3] = TOOLBAR_IDR_ONE_STATE(STAR_PRESSED); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (_reloadButton) | 194 if (_reloadButton) |
| 197 [allButtons addObject:_reloadButton]; | 195 [allButtons addObject:_reloadButton]; |
| 198 | 196 |
| 199 if (_stopButton) | 197 if (_stopButton) |
| 200 [allButtons addObject:_stopButton]; | 198 [allButtons addObject:_stopButton]; |
| 201 | 199 |
| 202 return allButtons; | 200 return allButtons; |
| 203 } | 201 } |
| 204 | 202 |
| 205 @end | 203 @end |
| OLD | NEW |