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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" | 10 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 if ([nameFieldCell_ | 64 if ([nameFieldCell_ |
65 respondsToSelector:@selector(setUsesSingleLineMode:)]) { | 65 respondsToSelector:@selector(setUsesSingleLineMode:)]) { |
66 [nameFieldCell_ setUsesSingleLineMode:YES]; | 66 [nameFieldCell_ setUsesSingleLineMode:YES]; |
67 } | 67 } |
68 | 68 |
69 // Set text fields to match our bookmark. If the node is NULL we | 69 // Set text fields to match our bookmark. If the node is NULL we |
70 // arrived here from an "Add Page..." item in a context menu. | 70 // arrived here from an "Add Page..." item in a context menu. |
71 if (node_) { | 71 if (node_) { |
72 [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; | 72 [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; |
73 PrefService* prefs = [self profile] ? | 73 PrefService* prefs = [self profile] ? |
74 components::UserPrefs::Get([self profile]) : | 74 user_prefs::UserPrefs::Get([self profile]) : |
75 NULL; | 75 NULL; |
76 string16 urlString = | 76 string16 urlString = |
77 chrome::FormatBookmarkURLForDisplay(node_->url(), prefs); | 77 chrome::FormatBookmarkURLForDisplay(node_->url(), prefs); |
78 initialUrl_.reset([base::SysUTF16ToNSString(urlString) retain]); | 78 initialUrl_.reset([base::SysUTF16ToNSString(urlString) retain]); |
79 } else { | 79 } else { |
80 GURL url = [self url]; | 80 GURL url = [self url]; |
81 [self setInitialName:base::SysUTF16ToNSString([self title])]; | 81 [self setInitialName:base::SysUTF16ToNSString([self title])]; |
82 if (url.is_valid()) | 82 if (url.is_valid()) |
83 initialUrl_.reset([[NSString stringWithUTF8String:url.spec().c_str()] | 83 initialUrl_.reset([[NSString stringWithUTF8String:url.spec().c_str()] |
84 retain]); | 84 retain]); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 SetExpandedNodes(expanded_nodes); | 163 SetExpandedNodes(expanded_nodes); |
164 return [NSNumber numberWithBool:YES]; | 164 return [NSNumber numberWithBool:YES]; |
165 } | 165 } |
166 | 166 |
167 - (NSColor *)urlFieldColor { | 167 - (NSColor *)urlFieldColor { |
168 return [urlField_ backgroundColor]; | 168 return [urlField_ backgroundColor]; |
169 } | 169 } |
170 | 170 |
171 @end // BookmarkEditorController | 171 @end // BookmarkEditorController |
172 | 172 |
OLD | NEW |