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

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

Issue 338032: Reverting 30136. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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"
6 #include "base/mac_util.h" 5 #include "base/mac_util.h"
7 #include "base/sys_string_conversions.h" 6 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/profile.h" 7 #include "chrome/browser/profile.h"
9 #import "chrome/browser/cocoa/bookmark_name_folder_controller.h" 8 #import "chrome/browser/cocoa/bookmark_name_folder_controller.h"
10 #include "grit/generated_resources.h"
11 9
12 @implementation BookmarkNameFolderController 10 @implementation BookmarkNameFolderController
13 11
14 - (id)initWithParentWindow:(NSWindow*)window 12 - (id)initWithParentWindow:(NSWindow*)window
15 profile:(Profile*)profile 13 profile:(Profile*)profile
16 node:(const BookmarkNode*)node { 14 node:(const BookmarkNode*)node {
17 NSString* nibpath = [mac_util::MainAppBundle() 15 NSString* nibpath = [mac_util::MainAppBundle()
18 pathForResource:@"BookmarkNameFolder" 16 pathForResource:@"BookmarkNameFolder"
19 ofType:@"nib"]; 17 ofType:@"nib"];
20 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { 18 if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
21 parentWindow_ = window; 19 parentWindow_ = window;
22 profile_ = profile; 20 profile_ = profile;
23 node_ = node; 21 node_ = node;
24 std::wstring newFolderString = 22 if (node_) {
25 l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME); 23 initialName_.reset([base::SysWideToNSString(node_->GetTitle()) retain]);
26 initialName_.reset([base::SysWideToNSString(newFolderString) retain]); 24 } else {
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 }
33 [self controlTextDidChange:nil]; 39 [self controlTextDidChange:nil];
34 } 40 }
35 41
36 // Called as a side-effect of being the delegate of the text field. Ensure the 42 // Called as a side-effect of being the delegate of the text field. Ensure the
37 // OK button is only enabled when there is a valid name. 43 // OK button is only enabled when there is a valid name.
38 - (void)controlTextDidChange:(NSNotification*)ignore { 44 - (void)controlTextDidChange:(NSNotification*)ignore {
39 [okButton_ setEnabled:[[nameField_ stringValue] length]]; 45 [okButton_ setEnabled:[[nameField_ stringValue] length]];
40 } 46 }
41 47
42 // TODO(jrg): consider NSModalSession. 48 // TODO(jrg): consider NSModalSession.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 - (void)setFolderName:(NSString*)name { 88 - (void)setFolderName:(NSString*)name {
83 [nameField_ setStringValue:name]; 89 [nameField_ setStringValue:name];
84 [self controlTextDidChange:nil]; 90 [self controlTextDidChange:nil];
85 } 91 }
86 92
87 - (NSButton*)okButton { 93 - (NSButton*)okButton {
88 return okButton_; 94 return okButton_;
89 } 95 }
90 96
91 @end // BookmarkNameFolderController 97 @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