OLD | NEW |
---|---|
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 #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/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 DCHECK(parent); | 63 DCHECK(parent); |
64 return [self initWithParentWindow:window | 64 return [self initWithParentWindow:window |
65 profile:profile | 65 profile:profile |
66 node:nil | 66 node:nil |
67 parent:parent | 67 parent:parent |
68 newIndex:newIndex]; | 68 newIndex:newIndex]; |
69 } | 69 } |
70 | 70 |
71 - (void)awakeFromNib { | 71 - (void)awakeFromNib { |
72 [nameField_ setStringValue:initialName_.get()]; | 72 [nameField_ setStringValue:initialName_.get()]; |
73 [[nameField_ cell] setUsesSingleLineMode:YES]; | |
73 | 74 |
74 // Check if NSTextFieldCell supports the method. This check is in place as | 75 [okButton_ setTitle:l10n_util::GetNSStringWithFixup(node_ ? IDS_SAVE : |
75 // only 10.6 and greater support the setUsesSingleLineMode method. | 76 IDS_ADD)]; |
Nico
2012/07/27 22:25:20
Why not change the nib instead?
Alexei Svitkine (slow)
2012/07/27 22:32:01
It's conditional. I can change it in the nib to on
| |
76 // TODO(kushi.p): Remove this when the project hits a 10.6+ only state. | |
77 NSTextFieldCell* nameFieldCell_ = [nameField_ cell]; | |
78 if ([nameFieldCell_ | |
79 respondsToSelector:@selector(setUsesSingleLineMode:)]) { | |
80 [nameFieldCell_ setUsesSingleLineMode:YES]; | |
81 } | |
82 } | 77 } |
83 | 78 |
84 - (void)runAsModalSheet { | 79 - (void)runAsModalSheet { |
85 // Ping me when things change out from under us. | 80 // Ping me when things change out from under us. |
86 observer_.reset(new BookmarkModelObserverForCocoa( | 81 observer_.reset(new BookmarkModelObserverForCocoa( |
87 node_, profile_->GetBookmarkModel(), | 82 node_, profile_->GetBookmarkModel(), |
88 self, | 83 self, |
89 @selector(cancel:))); | 84 @selector(cancel:))); |
90 [NSApp beginSheet:[self window] | 85 [NSApp beginSheet:[self window] |
91 modalForWindow:parentWindow_ | 86 modalForWindow:parentWindow_ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 | 120 |
126 - (void)setFolderName:(NSString*)name { | 121 - (void)setFolderName:(NSString*)name { |
127 [nameField_ setStringValue:name]; | 122 [nameField_ setStringValue:name]; |
128 } | 123 } |
129 | 124 |
130 - (NSButton*)okButton { | 125 - (NSButton*)okButton { |
131 return okButton_; | 126 return okButton_; |
132 } | 127 } |
133 | 128 |
134 @end // BookmarkNameFolderController | 129 @end // BookmarkNameFolderController |
OLD | NEW |