Commit 143ee25a authored by kushi.p@gmail.com's avatar kushi.p@gmail.com

Bookmark name inputs should only allow single-line input

- both BookmarkBubble and BookmarkEditor now use single-line input for their names
- update nib to use IBOutlet to call the NSCell off of the NSTextField

BUG=100618


Review URL: http://codereview.chromium.org/8775042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112846 0039d316-1c4b-4281-b951-d872f2087c98
parent 38824895
......@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10F2108</string>
<string key="IBDocument.InterfaceBuilderVersion">823</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.SystemVersion">10K549</string>
<string key="IBDocument.InterfaceBuilderVersion">851</string>
<string key="IBDocument.AppKitVersion">1038.36</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">823</string>
<string key="NS.object.0">851</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -699,6 +699,14 @@
</object>
<int key="connectionID">112</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">nameTextField_</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="921757931"/>
</object>
<int key="connectionID">113</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
......@@ -997,10 +1005,10 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{510, 586}, {480, 270}}</string>
<string>{{431, 488}, {480, 270}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<string>{{510, 586}, {480, 270}}</string>
<string>{{431, 488}, {480, 270}}</string>
<integer value="0"/>
<string>{196, 240}</string>
<string>{{357, 418}, {480, 270}}</string>
......@@ -1053,7 +1061,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">112</int>
<int key="maxID">113</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
......@@ -1170,6 +1178,24 @@
<string key="minorKey">browser/ui/cocoa/bookmarks/bookmark_editor_controller.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">BookmarkEditorController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">nameTextField_</string>
<string key="NS.object.0">NSTextField</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">nameTextField_</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">nameTextField_</string>
<string key="candidateClassName">NSTextField</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">ChromeUILocalizer</string>
<string key="superclassName">GTMUILocalizer</string>
......
......@@ -9,6 +9,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#include "content/browser/user_metrics.h"
......@@ -106,6 +107,17 @@ void BookmarkBubbleNotificationBridge::Observe(
return self;
}
- (void)awakeFromNib {
// Check if NSTextFieldCell supports the method. This check is in place as
// only 10.6 and greater support the setUsesSingleLineMode method.
// TODO(kushi.p): Remove this when the project hits a 10.6+ only state.
NSTextFieldCell* nameFieldCell_ = [nameTextField_ cell];
if ([nameFieldCell_
respondsToSelector:@selector(setUsesSingleLineMode:)]) {
[nameFieldCell_ setUsesSingleLineMode:YES];
}
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
......
......@@ -11,6 +11,7 @@
// Provides a category for 10.5 compilation of a selector which is only
// available on 10.6+. This purely enables compilation when the selector
// is present and does not implement the method itself.
// TODO(kushi.p): Remove this when the project hits a 10.6+ only state.
@interface NSCell(multilinebookmarks)
- (void)setUsesSingleLineMode:(BOOL)flag;
@end
......
......@@ -567,6 +567,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver {
DCHECK(row >= 0);
// Put the cell into single-line mode before putting it into edit mode.
// TODO(kushi.p): Remove this when the project hits a 10.6+ only state.
NSCell* folderCell = [folderTreeView_ preparedCellAtColumn:0 row:row];
if ([folderCell
respondsToSelector:@selector(setUsesSingleLineMode:)]) {
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -17,6 +17,7 @@
scoped_nsobject<NSString> initialUrl_;
NSString* displayURL_; // Bound to a text field in the dialog.
IBOutlet NSTextField* urlField_;
IBOutlet NSTextField* nameTextField_;
}
@property(nonatomic, copy) NSString* displayURL;
......
......@@ -9,6 +9,7 @@
#include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h"
#include "ui/base/l10n/l10n_util.h"
@interface BookmarkEditorController (Private)
......@@ -48,6 +49,15 @@
}
- (void)awakeFromNib {
// Check if NSTextFieldCell supports the method. This check is in place as
// only 10.6 and greater support the setUsesSingleLineMode method.
// TODO(kushi.p): Remove this when the project hits a 10.6+ only state.
NSTextFieldCell* nameFieldCell_ = [nameTextField_ cell];
if ([nameFieldCell_
respondsToSelector:@selector(setUsesSingleLineMode:)]) {
[nameFieldCell_ setUsesSingleLineMode:YES];
}
// Set text fields to match our bookmark. If the node is NULL we
// arrived here from an "Add Page..." item in a context menu.
if (node_) {
......
......@@ -72,6 +72,7 @@
// Check if NSTextFieldCell supports the method. This check is in place as
// only 10.6 and greater support the setUsesSingleLineMode method.
// TODO(kushi.p): Remove this when the project hits a 10.6+ only state.
NSTextFieldCell* nameFieldCell_ = [nameField_ cell];
if ([nameFieldCell_
respondsToSelector:@selector(setUsesSingleLineMode:)]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment