| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "chrome/browser/cocoa/translate/translate_message_infobar_controller.h" | 5 #include "chrome/browser/cocoa/translate/translate_message_infobar_controller.h" |
| 6 | 6 |
| 7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 | 8 |
| 9 using TranslateInfoBarUtilities::MoveControl; | 9 using TranslateInfoBarUtilities::MoveControl; |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 - (void)layout { | 24 - (void)layout { |
| 25 [optionsPopUp_ setHidden:YES]; | 25 [optionsPopUp_ setHidden:YES]; |
| 26 [self removeOkCancelButtons]; | 26 [self removeOkCancelButtons]; |
| 27 MoveControl(label1_, tryAgainButton_, spaceBetweenControls_ * 2, true); | 27 MoveControl(label1_, tryAgainButton_, spaceBetweenControls_ * 2, true); |
| 28 TranslateInfoBarDelegate* delegate = [self delegate]; | 28 TranslateInfoBarDelegate* delegate = [self delegate]; |
| 29 if (delegate->IsError()) | 29 if (delegate->IsError()) |
| 30 MoveControl(label1_, tryAgainButton_, spaceBetweenControls_ * 2, true); | 30 MoveControl(label1_, tryAgainButton_, spaceBetweenControls_ * 2, true); |
| 31 } | 31 } |
| 32 | 32 |
| 33 - (void)adjustOptionsButtonSizeAndVisibilityForView:(NSView*)lastView { |
| 34 // Do nothing, but stop the options button from showing up. |
| 35 } |
| 36 |
| 33 - (NSArray*)visibleControls { | 37 - (NSArray*)visibleControls { |
| 34 NSMutableArray* visibleControls = | 38 NSMutableArray* visibleControls = |
| 35 [NSMutableArray arrayWithObjects:label1_.get(), nil]; | 39 [NSMutableArray arrayWithObjects:label1_.get(), nil]; |
| 36 if (state_ == TranslateInfoBarDelegate::kTranslationError) | 40 if (state_ == TranslateInfoBarDelegate::kTranslationError) |
| 37 [visibleControls addObject:tryAgainButton_]; | 41 [visibleControls addObject:tryAgainButton_]; |
| 38 return visibleControls; | 42 return visibleControls; |
| 39 } | 43 } |
| 40 | 44 |
| 41 - (void)loadLabelText { | 45 - (void)loadLabelText { |
| 42 TranslateInfoBarDelegate* delegate = [self delegate]; | 46 TranslateInfoBarDelegate* delegate = [self delegate]; |
| 43 string16 messageText = delegate->GetMessageInfoBarText(); | 47 string16 messageText = delegate->GetMessageInfoBarText(); |
| 44 NSString* string1 = base::SysUTF16ToNSString(messageText); | 48 NSString* string1 = base::SysUTF16ToNSString(messageText); |
| 45 [label1_ setStringValue:string1]; | 49 [label1_ setStringValue:string1]; |
| 46 } | 50 } |
| 47 | 51 |
| 48 - (bool)verifyLayout { | 52 - (bool)verifyLayout { |
| 49 if (![optionsPopUp_ isHidden]) | 53 if (![optionsPopUp_ isHidden]) |
| 50 return false; | 54 return false; |
| 51 return [super verifyLayout]; | 55 return [super verifyLayout]; |
| 52 } | 56 } |
| 53 | 57 |
| 54 @end | 58 @end |
| OLD | NEW |