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

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

Issue 7276035: Wrong name when creating new folder in bookmark editor (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include <stack> 5 #include <stack>
6 6
7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h" 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 modalDelegate:self 232 modalDelegate:self
233 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) 233 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
234 contextInfo:nil]; 234 contextInfo:nil];
235 } 235 }
236 236
237 - (BOOL)okEnabled { 237 - (BOOL)okEnabled {
238 return YES; 238 return YES;
239 } 239 }
240 240
241 - (IBAction)ok:(id)sender { 241 - (IBAction)ok:(id)sender {
242 NSWindow* window = [self window];
243 [window makeFirstResponder:window];
242 // At least one of these two functions should be provided by derived classes. 244 // At least one of these two functions should be provided by derived classes.
243 BOOL hasWillCommit = [self respondsToSelector:@selector(willCommit)]; 245 BOOL hasWillCommit = [self respondsToSelector:@selector(willCommit)];
244 BOOL hasDidCommit = [self respondsToSelector:@selector(didCommit)]; 246 BOOL hasDidCommit = [self respondsToSelector:@selector(didCommit)];
245 DCHECK(hasWillCommit || hasDidCommit); 247 DCHECK(hasWillCommit || hasDidCommit);
246 BOOL shouldContinue = YES; 248 BOOL shouldContinue = YES;
247 if (hasWillCommit) { 249 if (hasWillCommit) {
248 NSNumber* hasWillContinue = [self performSelector:@selector(willCommit)]; 250 NSNumber* hasWillContinue = [self performSelector:@selector(willCommit)];
249 if (hasWillContinue && [hasWillContinue isKindOfClass:[NSNumber class]]) 251 if (hasWillContinue && [hasWillContinue isKindOfClass:[NSNumber class]])
250 shouldContinue = [hasWillContinue boolValue]; 252 shouldContinue = [hasWillContinue boolValue];
251 } 253 }
252 if (shouldContinue) 254 if (shouldContinue)
253 [self createNewFolders]; 255 [self createNewFolders];
254 if (hasDidCommit) { 256 if (hasDidCommit) {
255 NSNumber* hasDidContinue = [self performSelector:@selector(didCommit)]; 257 NSNumber* hasDidContinue = [self performSelector:@selector(didCommit)];
256 if (hasDidContinue && [hasDidContinue isKindOfClass:[NSNumber class]]) 258 if (hasDidContinue && [hasDidContinue isKindOfClass:[NSNumber class]])
257 shouldContinue = [hasDidContinue boolValue]; 259 shouldContinue = [hasDidContinue boolValue];
258 } 260 }
259 if (shouldContinue) 261 if (shouldContinue)
260 [NSApp endSheet:[self window]]; 262 [NSApp endSheet:window];
261 } 263 }
262 264
263 - (IBAction)cancel:(id)sender { 265 - (IBAction)cancel:(id)sender {
264 [NSApp endSheet:[self window]]; 266 [NSApp endSheet:[self window]];
265 } 267 }
266 268
267 - (void)didEndSheet:(NSWindow*)sheet 269 - (void)didEndSheet:(NSWindow*)sheet
268 returnCode:(int)returnCode 270 returnCode:(int)returnCode
269 contextInfo:(void*)contextInfo { 271 contextInfo:(void*)contextInfo {
270 [sheet close]; 272 [sheet close];
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 598 }
597 599
598 // Implementing isEqual: allows the NSTreeController to preserve the selection 600 // Implementing isEqual: allows the NSTreeController to preserve the selection
599 // and open/shut state of outline items when the data changes. 601 // and open/shut state of outline items when the data changes.
600 - (BOOL)isEqual:(id)other { 602 - (BOOL)isEqual:(id)other {
601 return [other isKindOfClass:[BookmarkFolderInfo class]] && 603 return [other isKindOfClass:[BookmarkFolderInfo class]] &&
602 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; 604 folderNode_ == [(BookmarkFolderInfo*)other folderNode];
603 } 605 }
604 606
605 @end 607 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698