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

Side by Side Diff: ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.mm

Issue 2968973002: [ios] Removes IDC_BOOKMARK_PAGE and IDC_SHARE_PAGE
Patch Set: Rebased Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_controller.h" 5 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/ios/ios_util.h" 9 #include "base/ios/ios_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 [self setItemEnabled:enabled withTag:IDC_READER_MODE]; 187 [self setItemEnabled:enabled withTag:IDC_READER_MODE];
188 } 188 }
189 189
190 - (void)setCanShowFindBar:(BOOL)enabled { 190 - (void)setCanShowFindBar:(BOOL)enabled {
191 [self setItemEnabled:enabled withTag:IDC_FIND]; 191 [self setItemEnabled:enabled withTag:IDC_FIND];
192 } 192 }
193 193
194 - (void)setCanShowShareMenu:(BOOL)enabled { 194 - (void)setCanShowShareMenu:(BOOL)enabled {
195 ToolsMenuViewToolsCell* toolsCell = [self toolsCell]; 195 ToolsMenuViewToolsCell* toolsCell = [self toolsCell];
196 [[toolsCell shareButton] setEnabled:enabled]; 196 [[toolsCell shareButton] setEnabled:enabled];
197 [self setItemEnabled:enabled withTag:IDC_SHARE_PAGE];
198 } 197 }
199 198
200 - (UIButton*)toolsButton { 199 - (UIButton*)toolsButton {
201 UIButton* toolsButton = [[self toolsCell] toolsButton]; 200 UIButton* toolsButton = [[self toolsCell] toolsButton];
202 [toolsButton addTarget:self 201 [toolsButton addTarget:self
203 action:@selector(buttonPressed:) 202 action:@selector(buttonPressed:)
204 forControlEvents:UIControlEventTouchUpInside]; 203 forControlEvents:UIControlEventTouchUpInside];
205 [toolsButton setTranslatesAutoresizingMaskIntoConstraints:YES]; 204 [toolsButton setTranslatesAutoresizingMaskIntoConstraints:YES];
206 [toolsButton setOpaque:NO]; 205 [toolsButton setOpaque:NO];
207 [toolsButton setBackgroundColor:[UIColor clearColor]]; 206 [toolsButton setBackgroundColor:[UIColor clearColor]];
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 [button removeTarget:self 465 [button removeTarget:self
467 action:@selector(buttonPressed:) 466 action:@selector(buttonPressed:)
468 forControlEvents:UIControlEventTouchUpInside]; 467 forControlEvents:UIControlEventTouchUpInside];
469 } 468 }
470 [toolsCell.stopButton removeTarget:self.dispatcher 469 [toolsCell.stopButton removeTarget:self.dispatcher
471 action:@selector(stopLoading) 470 action:@selector(stopLoading)
472 forControlEvents:UIControlEventTouchUpInside]; 471 forControlEvents:UIControlEventTouchUpInside];
473 [toolsCell.reloadButton removeTarget:self.dispatcher 472 [toolsCell.reloadButton removeTarget:self.dispatcher
474 action:@selector(reload) 473 action:@selector(reload)
475 forControlEvents:UIControlEventTouchUpInside]; 474 forControlEvents:UIControlEventTouchUpInside];
475 [toolsCell.starButton removeTarget:self.dispatcher
476 action:@selector(bookmarkPage)
477 forControlEvents:UIControlEventTouchUpInside];
478 [toolsCell.starredButton removeTarget:self.dispatcher
479 action:@selector(bookmarkPage)
480 forControlEvents:UIControlEventTouchUpInside];
476 } 481 }
477 482
478 #pragma mark - Button event handling 483 #pragma mark - Button event handling
479 484
480 - (void)buttonPressed:(id)sender { 485 - (void)buttonPressed:(id)sender {
481 int commandId = [sender tag]; 486 int commandId = [sender tag];
482 DCHECK(commandId); 487 DCHECK(commandId);
483 // The bookmark command workaround is only needed for metrics; remap it 488 // The bookmark command workaround is only needed for metrics; remap it
484 // to the real command for the dispatch. This is very hacky, but it will go 489 // to the real command for the dispatch. This is very hacky, but it will go
485 // away soon. See crbug/228521 490 // away soon. See crbug/228521
486 DCHECK([sender respondsToSelector:@selector(setTag:)]); 491 DCHECK([sender respondsToSelector:@selector(setTag:)]);
487 if (commandId == IDC_TEMP_EDIT_BOOKMARK)
488 [sender setTag:IDC_BOOKMARK_PAGE];
489 // Do nothing when tapping the tools menu a second time. 492 // Do nothing when tapping the tools menu a second time.
490 // Do not use -chromeExecuteCommand: for tags < 0 -- that is, items that have 493 // Do not use -chromeExecuteCommand: for tags < 0 -- that is, items that have
491 // been refactored to use the dispatcher. 494 // been refactored to use the dispatcher.
492 if (commandId != IDC_SHOW_TOOLS_MENU && commandId > 0) { 495 if (commandId != IDC_SHOW_TOOLS_MENU && commandId > 0) {
493 [self chromeExecuteCommand:sender]; 496 [self chromeExecuteCommand:sender];
494 } 497 }
495 if (commandId == IDC_TEMP_EDIT_BOOKMARK)
496 [sender setTag:IDC_TEMP_EDIT_BOOKMARK];
497 498
498 // Do any metrics logging for the command, and then close the menu. 499 // Do any metrics logging for the command, and then close the menu.
499 [_delegate commandWasSelected:commandId]; 500 [_delegate commandWasSelected:commandId];
500 } 501 }
501 502
502 #pragma mark - UICollectionViewDelegate Implementation 503 #pragma mark - UICollectionViewDelegate Implementation
503 504
504 - (BOOL)collectionView:(ToolsMenuCollectionView*)view 505 - (BOOL)collectionView:(ToolsMenuCollectionView*)view
505 shouldHighlightItemAtIndexPath:(NSIndexPath*)path { 506 shouldHighlightItemAtIndexPath:(NSIndexPath*)path {
506 if (view.tracking) 507 if (view.tracking)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // Add specific target/action dispatch for buttons refactored away from 592 // Add specific target/action dispatch for buttons refactored away from
592 // ChromeExecuteCommand. These need to be added *before* -buttonPressed:, 593 // ChromeExecuteCommand. These need to be added *before* -buttonPressed:,
593 // because -buttonPressed: closes the popup menu, which will usually 594 // because -buttonPressed: closes the popup menu, which will usually
594 // destroy the buttons before any other actions can be called. 595 // destroy the buttons before any other actions can be called.
595 [cell.stopButton addTarget:self.dispatcher 596 [cell.stopButton addTarget:self.dispatcher
596 action:@selector(stopLoading) 597 action:@selector(stopLoading)
597 forControlEvents:UIControlEventTouchUpInside]; 598 forControlEvents:UIControlEventTouchUpInside];
598 [cell.reloadButton addTarget:self.dispatcher 599 [cell.reloadButton addTarget:self.dispatcher
599 action:@selector(reload) 600 action:@selector(reload)
600 forControlEvents:UIControlEventTouchUpInside]; 601 forControlEvents:UIControlEventTouchUpInside];
602 [cell.starButton addTarget:self.dispatcher
603 action:@selector(bookmarkPage)
604 forControlEvents:UIControlEventTouchUpInside];
605 [cell.starredButton addTarget:self.dispatcher
606 action:@selector(bookmarkPage)
607 forControlEvents:UIControlEventTouchUpInside];
601 for (UIButton* button in [cell allButtons]) { 608 for (UIButton* button in [cell allButtons]) {
602 [button addTarget:self 609 [button addTarget:self
603 action:@selector(buttonPressed:) 610 action:@selector(buttonPressed:)
604 forControlEvents:UIControlEventTouchUpInside]; 611 forControlEvents:UIControlEventTouchUpInside];
605 } 612 }
606 613
607 return cell; 614 return cell;
608 } 615 }
609 616
610 ToolsMenuViewItem* menuItem = [_menuItems objectAtIndex:item]; 617 ToolsMenuViewItem* menuItem = [_menuItems objectAtIndex:item];
(...skipping 24 matching lines...) Expand all
635 642
636 - (void)unreadCountChanged:(NSInteger)unreadCount { 643 - (void)unreadCountChanged:(NSInteger)unreadCount {
637 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; 644 [[self readingListCell] updateBadgeCount:unreadCount animated:YES];
638 } 645 }
639 646
640 - (void)unseenStateChanged:(BOOL)unseenItemsExist { 647 - (void)unseenStateChanged:(BOOL)unseenItemsExist {
641 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; 648 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES];
642 } 649 }
643 650
644 @end 651 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698