OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/edit_search_engine_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 delta:windowDelta]; | 80 delta:windowDelta]; |
81 | 81 |
82 ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); | 82 ResourceBundle& bundle = ResourceBundle::GetSharedInstance(); |
83 goodImage_.reset([bundle.GetNativeImageNamed(IDR_INPUT_GOOD) retain]); | 83 goodImage_.reset([bundle.GetNativeImageNamed(IDR_INPUT_GOOD) retain]); |
84 badImage_.reset([bundle.GetNativeImageNamed(IDR_INPUT_ALERT) retain]); | 84 badImage_.reset([bundle.GetNativeImageNamed(IDR_INPUT_ALERT) retain]); |
85 if (templateURL_) { | 85 if (templateURL_) { |
86 // Defaults to |..._NEW_WINDOW_TITLE|. | 86 // Defaults to |..._NEW_WINDOW_TITLE|. |
87 [window setTitle:l10n_util::GetNSString( | 87 [window setTitle:l10n_util::GetNSString( |
88 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE)]; | 88 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE)]; |
89 [nameField_ setStringValue: | 89 [nameField_ setStringValue: |
90 base::SysUTF16ToNSString(templateURL_->short_name())]; | 90 base::SysWideToNSString(templateURL_->short_name())]; |
91 [keywordField_ setStringValue: | 91 [keywordField_ setStringValue: |
92 base::SysUTF16ToNSString(templateURL_->keyword())]; | 92 base::SysWideToNSString(templateURL_->keyword())]; |
93 [urlField_ setStringValue: | 93 [urlField_ setStringValue: |
94 base::SysUTF16ToNSString(templateURL_->url()->DisplayURL())]; | 94 base::SysWideToNSString(templateURL_->url()->DisplayURL())]; |
95 [urlField_ setEnabled:(templateURL_->prepopulate_id() == 0)]; | 95 [urlField_ setEnabled:(templateURL_->prepopulate_id() == 0)]; |
96 } | 96 } |
97 // When creating a new keyword, this will mark the fields as "invalid" and | 97 // When creating a new keyword, this will mark the fields as "invalid" and |
98 // will not let the user save. If this is an edit, then this will set all | 98 // will not let the user save. If this is an edit, then this will set all |
99 // the images to the "valid" state. | 99 // the images to the "valid" state. |
100 [self validateFields]; | 100 [self validateFields]; |
101 } | 101 } |
102 | 102 |
103 // When the window closes, clean ourselves up. | 103 // When the window closes, clean ourselves up. |
104 - (void)windowWillClose:(NSNotification*)notif { | 104 - (void)windowWillClose:(NSNotification*)notif { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 toolTip:IDS_SEARCH_ENGINES_INVALID_URL_TT | 178 toolTip:IDS_SEARCH_ENGINES_INVALID_URL_TT |
179 forImageView:urlImage_ | 179 forImageView:urlImage_ |
180 textField:urlField_]; | 180 textField:urlField_]; |
181 | 181 |
182 BOOL isValid = (titleValid && keywordValid && urlValid); | 182 BOOL isValid = (titleValid && keywordValid && urlValid); |
183 [doneButton_ setEnabled:isValid]; | 183 [doneButton_ setEnabled:isValid]; |
184 return isValid; | 184 return isValid; |
185 } | 185 } |
186 | 186 |
187 @end | 187 @end |
OLD | NEW |