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

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

Issue 337006: New Folder Should Show Up as "New Folder" (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 2 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/l10n_util.h"
5 #include "base/mac_util.h" 6 #include "base/mac_util.h"
6 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
7 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
8 #import "chrome/browser/cocoa/bookmark_name_folder_controller.h" 9 #import "chrome/browser/cocoa/bookmark_name_folder_controller.h"
10 #include "grit/generated_resources.h"
9 11
10 @implementation BookmarkNameFolderController 12 @implementation BookmarkNameFolderController
11 13
12 - (id)initWithParentWindow:(NSWindow*)window 14 - (id)initWithParentWindow:(NSWindow*)window
13 profile:(Profile*)profile 15 profile:(Profile*)profile
14 node:(const BookmarkNode*)node { 16 node:(const BookmarkNode*)node {
15 NSString* nibpath = [mac_util::MainAppBundle() 17 NSString* nibpath = [mac_util::MainAppBundle()
16 pathForResource:@"BookmarkNameFolder" 18 pathForResource:@"BookmarkNameFolder"
17 ofType:@"nib"]; 19 ofType:@"nib"];
18 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { 20 if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
19 parentWindow_ = window; 21 parentWindow_ = window;
20 profile_ = profile; 22 profile_ = profile;
21 node_ = node; 23 node_ = node;
22 if (node_) { 24 std::wstring newFolderString =
23 initialName_.reset([base::SysWideToNSString(node_->GetTitle()) retain]); 25 l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME);
24 } else { 26 initialName_.reset([base::SysWideToNSString(newFolderString) retain]);
25 initialName_.reset([@"" retain]);
26 }
27 } 27 }
28 return self; 28 return self;
29 } 29 }
30 30
31 - (void)awakeFromNib { 31 - (void)awakeFromNib {
32 [nameField_ setStringValue:initialName_.get()]; 32 [nameField_ setStringValue:initialName_.get()];
33 if (node_) {
34 // TODO(jrg)?: on Windows the dialog is named either New Folder or
35 // Edit Folder Name. However, since we're a sheet on the Mac, the
36 // title is never seen. If we switch from a sheet, correct the
37 // title right here.
38 }
39 } 33 }
40 34
41 // TODO(jrg): consider NSModalSession. 35 // TODO(jrg): consider NSModalSession.
42 - (void)runAsModalSheet { 36 - (void)runAsModalSheet {
43 [NSApp beginSheet:[self window] 37 [NSApp beginSheet:[self window]
44 modalForWindow:parentWindow_ 38 modalForWindow:parentWindow_
45 modalDelegate:self 39 modalDelegate:self
46 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) 40 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
47 contextInfo:nil]; 41 contextInfo:nil];
48 } 42 }
(...skipping 27 matching lines...) Expand all
76 contextInfo:(void*)contextInfo { 70 contextInfo:(void*)contextInfo {
77 [[self window] orderOut:self]; 71 [[self window] orderOut:self];
78 [self autorelease]; 72 [self autorelease];
79 } 73 }
80 74
81 - (void)setFolderName:(NSString*)name { 75 - (void)setFolderName:(NSString*)name {
82 [nameField_ setStringValue:name]; 76 [nameField_ setStringValue:name];
83 } 77 }
84 78
85 @end // BookmarkNameFolderController 79 @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