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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm

Issue 2752433002: [Mac] Fix a crash in handling keyboard shortcuts for empty bookmark folder menus. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bookmarks/bookmark_bar_folder_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/sdk_forward_declarations.h" 10 #include "base/mac/sdk_forward_declarations.h"
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 if (index >= 0 && index < [self buttonCount]) 1628 if (index >= 0 && index < [self buttonCount])
1629 [[buttons_ objectAtIndex:index] highlight:state]; 1629 [[buttons_ objectAtIndex:index] highlight:state];
1630 } 1630 }
1631 1631
1632 // Selects the required button and deselects the previously selected one. 1632 // Selects the required button and deselects the previously selected one.
1633 // An index of -1 means no selection. 1633 // An index of -1 means no selection.
1634 - (void)setSelectedButtonByIndex:(int)index { 1634 - (void)setSelectedButtonByIndex:(int)index {
1635 if (index == selectedIndex_) 1635 if (index == selectedIndex_)
1636 return; 1636 return;
1637 1637
1638 if (index >= 0 && [[buttons_ objectAtIndex:index] isEmpty])
1639 index = -1;
1640
1638 [self setStateOfButtonByIndex:selectedIndex_ state:NO]; 1641 [self setStateOfButtonByIndex:selectedIndex_ state:NO];
1639 [self setStateOfButtonByIndex:index state:YES]; 1642 [self setStateOfButtonByIndex:index state:YES];
1640 selectedIndex_ = index; 1643 selectedIndex_ = index;
1641 1644
1642 [self showSelectedButton]; 1645 [self showSelectedButton];
1643 } 1646 }
1644 1647
1645 - (void)clearInputText { 1648 - (void)clearInputText {
1646 [typedPrefix_ release]; 1649 [typedPrefix_ release];
1647 typedPrefix_ = nil; 1650 typedPrefix_ = nil;
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 2102
2100 - (void)setIgnoreAnimations:(BOOL)ignore { 2103 - (void)setIgnoreAnimations:(BOOL)ignore {
2101 ignoreAnimations_ = ignore; 2104 ignoreAnimations_ = ignore;
2102 } 2105 }
2103 2106
2104 - (BookmarkButton*)buttonThatMouseIsIn { 2107 - (BookmarkButton*)buttonThatMouseIsIn {
2105 return buttonThatMouseIsIn_; 2108 return buttonThatMouseIsIn_;
2106 } 2109 }
2107 2110
2108 @end // BookmarkBarFolderController 2111 @end // BookmarkBarFolderController
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698