summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-03 01:56:50 +0000
committerkushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-03 01:56:50 +0000
commit143ee25a94004844d0edc8ab5c57913af5d2056f (patch)
tree7ace5e1f60d9c9fb0cc0478f784a13b83a38bf6e
parent38824895117e41ccc6a7302f0718e41e977a8c7d (diff)
downloadchromium_src-143ee25a94004844d0edc8ab5c57913af5d2056f.zip
chromium_src-143ee25a94004844d0edc8ab5c57913af5d2056f.tar.gz
chromium_src-143ee25a94004844d0edc8ab5c57913af5d2056f.tar.bz2
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
-rw-r--r--chrome/app/nibs/BookmarkEditor.xib40
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm12
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h1
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm1
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h3
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm10
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm1
7 files changed, 60 insertions, 8 deletions
diff --git a/chrome/app/nibs/BookmarkEditor.xib b/chrome/app/nibs/BookmarkEditor.xib
index 87022a3..aec31ef 100644
--- a/chrome/app/nibs/BookmarkEditor.xib
+++ b/chrome/app/nibs/BookmarkEditor.xib
@@ -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">
@@ -1171,6 +1179,24 @@
</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>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
index f2dd831..681d91e 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
@@ -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];
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h
index 250db72..4614520 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h
@@ -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
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
index 605c4ea..5a56592 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
@@ -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:)]) {
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h
index 9fc6e95b..856aba2 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h
@@ -1,4 +1,4 @@
-// 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;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm
index ebe06d1..e18f7c0 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm
@@ -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_) {
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm
index f45488c..7bf3061 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm
@@ -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:)]) {