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

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

Issue 476643002: Bookmark context menu "Add folder..." allows to create folder with empty name(empty string). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | 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) 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_name_folder_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) 90 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
91 contextInfo:nil]; 91 contextInfo:nil];
92 } 92 }
93 93
94 - (IBAction)cancel:(id)sender { 94 - (IBAction)cancel:(id)sender {
95 [NSApp endSheet:[self window]]; 95 [NSApp endSheet:[self window]];
96 } 96 }
97 97
98 - (IBAction)ok:(id)sender { 98 - (IBAction)ok:(id)sender {
99 NSString* name = [nameField_ stringValue]; 99 NSString* name = [nameField_ stringValue];
100 if (![name length])
Alexei Svitkine (slow) 2014/08/14 19:27:11 Nit: == 0 instead
siba.samal 2014/08/16 05:30:47 Done.
101 name = l10n_util::GetNSStringWithFixup(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME);
100 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); 102 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
101 if (node_) { 103 if (node_) {
102 model->SetTitle(node_, base::SysNSStringToUTF16(name)); 104 model->SetTitle(node_, base::SysNSStringToUTF16(name));
103 } else { 105 } else {
104 model->AddFolder(parent_, 106 model->AddFolder(parent_,
105 newIndex_, 107 newIndex_,
106 base::SysNSStringToUTF16(name)); 108 base::SysNSStringToUTF16(name));
107 } 109 }
108 [NSApp endSheet:[self window]]; 110 [NSApp endSheet:[self window]];
109 } 111 }
(...skipping 12 matching lines...) Expand all
122 124
123 - (void)setFolderName:(NSString*)name { 125 - (void)setFolderName:(NSString*)name {
124 [nameField_ setStringValue:name]; 126 [nameField_ setStringValue:name];
125 } 127 }
126 128
127 - (NSButton*)okButton { 129 - (NSButton*)okButton {
128 return okButton_; 130 return okButton_;
129 } 131 }
130 132
131 @end // BookmarkNameFolderController 133 @end // BookmarkNameFolderController
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