OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/cocoa/translate/before_translate_infobar_controller.h" |
| 6 |
| 7 #include "app/l10n_util.h" |
| 8 #include "base/sys_string_conversions.h" |
| 9 #include "grit/generated_resources.h" |
| 10 |
| 11 using TranslateInfoBarUtilities::MoveControl; |
| 12 |
| 13 @implementation BeforeTranslateInfobarController |
| 14 |
| 15 - (void)layout { |
| 16 [optionsPopUp_ setHidden:NO]; |
| 17 MoveControl(label1_, fromLanguagePopUp_, 0, true); |
| 18 MoveControl(fromLanguagePopUp_, label2_, 0, true); |
| 19 MoveControl(label2_, okButton_, spaceBetweenControls_, true); |
| 20 MoveControl(okButton_, cancelButton_, spaceBetweenControls_, true); |
| 21 } |
| 22 |
| 23 - (void)loadLabelText { |
| 24 size_t offset = 0; |
| 25 string16 text = |
| 26 l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_BEFORE_MESSAGE, |
| 27 string16(), &offset); |
| 28 NSString* string1 = base::SysUTF16ToNSString(text.substr(0, offset)); |
| 29 NSString* string2 = base::SysUTF16ToNSString(text.substr(offset)); |
| 30 [label1_ setStringValue:string1]; |
| 31 [label2_ setStringValue:string2]; |
| 32 [label3_ setStringValue:@""]; |
| 33 } |
| 34 |
| 35 - (NSArray*)visibleControls { |
| 36 return [NSArray arrayWithObjects:label1_.get(), fromLanguagePopUp_.get(), |
| 37 label2_.get(), okButton_, cancelButton_, nil]; |
| 38 |
| 39 } |
| 40 |
| 41 - (bool)verifyLayout { |
| 42 if ([optionsPopUp_ isHidden]) |
| 43 return false; |
| 44 return [super verifyLayout]; |
| 45 } |
| 46 |
| 47 @end |
OLD | NEW |