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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm

Issue 8775042: Bookmark name inputs should only allow single-line input (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add TODO comments for post-10.6+ only good times Created 9 years 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
OLDNEW
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_editor_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" 9 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/bookmarks/bookmark_utils.h" 11 #include "chrome/browser/bookmarks/bookmark_utils.h"
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 14
14 @interface BookmarkEditorController (Private) 15 @interface BookmarkEditorController (Private)
15 16
16 // Grab the url from the text field and convert. 17 // Grab the url from the text field and convert.
17 - (GURL)GURLFromUrlField; 18 - (GURL)GURLFromUrlField;
18 19
19 @end 20 @end
20 21
21 @implementation BookmarkEditorController 22 @implementation BookmarkEditorController
(...skipping 19 matching lines...) Expand all
41 } 42 }
42 return self; 43 return self;
43 } 44 }
44 45
45 - (void)dealloc { 46 - (void)dealloc {
46 [displayURL_ release]; 47 [displayURL_ release];
47 [super dealloc]; 48 [super dealloc];
48 } 49 }
49 50
50 - (void)awakeFromNib { 51 - (void)awakeFromNib {
52 // Check if NSTextFieldCell supports the method. This check is in place as
53 // only 10.6 and greater support the setUsesSingleLineMode method.
54 // TODO(kushi.p): Remove this when the project hits a 10.6+ only state.
55 NSTextFieldCell* nameFieldCell_ = [nameTextField_ cell];
56 if ([nameFieldCell_
57 respondsToSelector:@selector(setUsesSingleLineMode:)]) {
58 [nameFieldCell_ setUsesSingleLineMode:YES];
59 }
60
51 // Set text fields to match our bookmark. If the node is NULL we 61 // Set text fields to match our bookmark. If the node is NULL we
52 // arrived here from an "Add Page..." item in a context menu. 62 // arrived here from an "Add Page..." item in a context menu.
53 if (node_) { 63 if (node_) {
54 [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; 64 [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())];
55 std::string url_string = node_->url().possibly_invalid_spec(); 65 std::string url_string = node_->url().possibly_invalid_spec();
56 initialUrl_.reset([[NSString stringWithUTF8String:url_string.c_str()] 66 initialUrl_.reset([[NSString stringWithUTF8String:url_string.c_str()]
57 retain]); 67 retain]);
58 } else { 68 } else {
59 GURL url; 69 GURL url;
60 string16 title16; 70 string16 title16;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 SetExpandedNodes(expanded_nodes); 160 SetExpandedNodes(expanded_nodes);
151 return [NSNumber numberWithBool:YES]; 161 return [NSNumber numberWithBool:YES];
152 } 162 }
153 163
154 - (NSColor *)urlFieldColor { 164 - (NSColor *)urlFieldColor {
155 return [urlField_ backgroundColor]; 165 return [urlField_ backgroundColor];
156 } 166 }
157 167
158 @end // BookmarkEditorController 168 @end // BookmarkEditorController
159 169
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698