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_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 Loading... | |
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 | |
mrossetti
2011/12/02 15:52:22
Add TODO(kushalp): here, too.
| |
53 // only 10.6 and greater support the setUsesSingleLineMode method. | |
54 NSTextFieldCell* nameFieldCell_ = [nameTextField_ cell]; | |
55 if ([nameFieldCell_ | |
56 respondsToSelector:@selector(setUsesSingleLineMode:)]) { | |
57 [nameFieldCell_ setUsesSingleLineMode:YES]; | |
58 } | |
59 | |
51 // Set text fields to match our bookmark. If the node is NULL we | 60 // 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. | 61 // arrived here from an "Add Page..." item in a context menu. |
53 if (node_) { | 62 if (node_) { |
54 [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; | 63 [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; |
55 std::string url_string = node_->url().possibly_invalid_spec(); | 64 std::string url_string = node_->url().possibly_invalid_spec(); |
56 initialUrl_.reset([[NSString stringWithUTF8String:url_string.c_str()] | 65 initialUrl_.reset([[NSString stringWithUTF8String:url_string.c_str()] |
57 retain]); | 66 retain]); |
58 } else { | 67 } else { |
59 GURL url; | 68 GURL url; |
60 string16 title16; | 69 string16 title16; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 SetExpandedNodes(expanded_nodes); | 159 SetExpandedNodes(expanded_nodes); |
151 return [NSNumber numberWithBool:YES]; | 160 return [NSNumber numberWithBool:YES]; |
152 } | 161 } |
153 | 162 |
154 - (NSColor *)urlFieldColor { | 163 - (NSColor *)urlFieldColor { |
155 return [urlField_ backgroundColor]; | 164 return [urlField_ backgroundColor]; |
156 } | 165 } |
157 | 166 |
158 @end // BookmarkEditorController | 167 @end // BookmarkEditorController |
159 | 168 |
OLD | NEW |