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

Side by Side Diff: chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm

Issue 1660273003: Keep focus on Find-In-Page buttons when using the keyboard to navigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add view IDs for cocoa find bar UI. Created 4 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
« no previous file with comments | « AUTHORS ('k') | chrome/browser/ui/view_ids.h » ('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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 - (id)initWithBrowser:(Browser*)browser { 81 - (id)initWithBrowser:(Browser*)browser {
82 if ((self = [super initWithNibName:@"FindBar" 82 if ((self = [super initWithNibName:@"FindBar"
83 bundle:base::mac::FrameworkBundle()])) { 83 bundle:base::mac::FrameworkBundle()])) {
84 [[NSNotificationCenter defaultCenter] 84 [[NSNotificationCenter defaultCenter]
85 addObserver:self 85 addObserver:self
86 selector:@selector(findPboardUpdated:) 86 selector:@selector(findPboardUpdated:)
87 name:kFindPasteboardChangedNotification 87 name:kFindPasteboardChangedNotification
88 object:[FindPasteboard sharedInstance]]; 88 object:[FindPasteboard sharedInstance]];
89 browser_ = browser; 89 browser_ = browser;
90
91 // Set ViewIDs for the buttons which don't have their dedicated class.
92 // ViewID of |findText_| is handled by itself.
93 view_id_util::SetID(previousButton_, VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON);
94 view_id_util::SetID(nextButton_, VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON);
95 view_id_util::SetID(closeButton_, VIEW_ID_FIND_IN_PAGE_CLOSE_BUTTON);
90 } 96 }
91 return self; 97 return self;
92 } 98 }
93 99
94 - (void)dealloc { 100 - (void)dealloc {
95 [self browserWillBeDestroyed]; 101 [self browserWillBeDestroyed];
96 [super dealloc]; 102 [super dealloc];
97 } 103 }
98 104
99 - (void)browserWillBeDestroyed { 105 - (void)browserWillBeDestroyed {
100 // All animations should have been explicitly stopped before a tab is closed. 106 // All animations should have been explicitly stopped before a tab is closed.
101 DCHECK(!showHideAnimation_.get()); 107 DCHECK(!showHideAnimation_.get());
102 DCHECK(!moveAnimation_.get()); 108 DCHECK(!moveAnimation_.get());
103 [[NSNotificationCenter defaultCenter] removeObserver:self]; 109 [[NSNotificationCenter defaultCenter] removeObserver:self];
104 browser_ = nullptr; 110 browser_ = nullptr;
111
112 // Set ViewIDs for the buttons which don't have their dedicated class.
tapted 2016/02/09 02:41:24 This comment isn't right. I think it can just be o
113 // ViewID of |findText_| is handled by itself.
114 view_id_util::UnsetID(previousButton_);
115 view_id_util::UnsetID(nextButton_);
116 view_id_util::UnsetID(closeButton_);
105 } 117 }
106 118
107 - (void)setFindBarBridge:(FindBarBridge*)findBarBridge { 119 - (void)setFindBarBridge:(FindBarBridge*)findBarBridge {
108 DCHECK(!findBarBridge_); // should only be called once. 120 DCHECK(!findBarBridge_); // should only be called once.
109 findBarBridge_ = findBarBridge; 121 findBarBridge_ = findBarBridge;
110 } 122 }
111 123
112 - (void)awakeFromNib { 124 - (void)awakeFromNib {
113 [[closeButton_ cell] setImageID:IDR_CLOSE_1 125 [[closeButton_ cell] setImageID:IDR_CLOSE_1
114 forButtonState:image_button_cell::kDefaultState]; 126 forButtonState:image_button_cell::kDefaultState];
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } 650 }
639 651
640 - (BrowserWindowController*)browserWindowController { 652 - (BrowserWindowController*)browserWindowController {
641 if (!browser_) 653 if (!browser_)
642 return nil; 654 return nil;
643 return [BrowserWindowController 655 return [BrowserWindowController
644 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; 656 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()];
645 } 657 }
646 658
647 @end 659 @end
OLDNEW
« no previous file with comments | « AUTHORS ('k') | chrome/browser/ui/view_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698