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

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

Issue 2950523003: [Mac] Fix for Dialog Textfields (Closed)
Patch Set: Created 3 years, 6 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_editor_base_controller.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 "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #import "base/mac/sdk_forward_declarations.h" 8 #import "base/mac/sdk_forward_declarations.h"
9 #include "base/metrics/user_metrics.h" 9 #include "base/metrics/user_metrics.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // model. This is an IBOutlet-looking entry point to remove the 143 // model. This is an IBOutlet-looking entry point to remove the
144 // dialog without touching the model. 144 // dialog without touching the model.
145 - (void)dismissWithoutEditing:(id)sender { 145 - (void)dismissWithoutEditing:(id)sender {
146 [self close]; 146 [self close];
147 } 147 }
148 148
149 - (void)windowWillClose:(NSNotification*)notification { 149 - (void)windowWillClose:(NSNotification*)notification {
150 // We caught a close so we don't need to watch for the parent closing. 150 // We caught a close so we don't need to watch for the parent closing.
151 bookmarkObserver_.reset(); 151 bookmarkObserver_.reset();
152 [self notifyBubbleClosed]; 152 [self notifyBubbleClosed];
153
154 // Force the field editor to resign the first responder so that it'll
155 // be removed from the view hierarchy and its delegate be set to nil.
156 [[self window] endEditingFor:nameTextField_];
157
153 [super windowWillClose:notification]; 158 [super windowWillClose:notification];
154 } 159 }
155 160
156 // Override -[BaseBubbleController showWindow:] to tweak bubble location and 161 // Override -[BaseBubbleController showWindow:] to tweak bubble location and
157 // set up UI elements. 162 // set up UI elements.
158 - (void)showWindow:(id)sender { 163 - (void)showWindow:(id)sender {
159 NSWindow* window = [self window]; // Force load the NIB. 164 NSWindow* window = [self window]; // Force load the NIB.
160 NSWindow* parentWindow = self.parentWindow; 165 NSWindow* parentWindow = self.parentWindow;
161 BrowserWindowController* bwc = 166 BrowserWindowController* bwc =
162 [BrowserWindowController browserWindowControllerForWindow:parentWindow]; 167 [BrowserWindowController browserWindowControllerForWindow:parentWindow];
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 265 }
261 266
262 // Delegate method: see |NSWindowDelegate| protocol. 267 // Delegate method: see |NSWindowDelegate| protocol.
263 - (id)windowWillReturnFieldEditor:(NSWindow*)sender toObject:(id)obj { 268 - (id)windowWillReturnFieldEditor:(NSWindow*)sender toObject:(id)obj {
264 if (obj != nameTextField_) 269 if (obj != nameTextField_)
265 return nil; 270 return nil;
266 271
267 if (!textFieldEditor_) 272 if (!textFieldEditor_)
268 textFieldEditor_.reset([[DialogTextFieldEditor alloc] init]); 273 textFieldEditor_.reset([[DialogTextFieldEditor alloc] init]);
269 274
270 return textFieldEditor_.autorelease(); 275 return textFieldEditor_.get();
271 } 276 }
272 277
273 // Shows the bookmark editor sheet for more advanced editing. 278 // Shows the bookmark editor sheet for more advanced editing.
274 - (void)showEditor { 279 - (void)showEditor {
275 [self ok:self]; 280 [self ok:self];
276 // Send the action up through the responder chain. 281 // Send the action up through the responder chain.
277 [NSApp sendAction:@selector(editBookmarkNode:) to:nil from:self]; 282 [NSApp sendAction:@selector(editBookmarkNode:) to:nil from:self];
278 } 283 }
279 284
280 - (IBAction)edit:(id)sender { 285 - (IBAction)edit:(id)sender {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; 475 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue];
471 DCHECK(idx != -1); 476 DCHECK(idx != -1);
472 [folderPopUpButton_ selectItemAtIndex:idx]; 477 [folderPopUpButton_ selectItemAtIndex:idx];
473 } 478 }
474 479
475 - (NSPopUpButton*)folderPopUpButton { 480 - (NSPopUpButton*)folderPopUpButton {
476 return folderPopUpButton_; 481 return folderPopUpButton_;
477 } 482 }
478 483
479 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) 484 @end // implementation BookmarkBubbleController(ExposedForUnitTesting)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698