Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/cocoa/translate/before_translate_infobar_controller.mm

Issue 2804035: Clean up mac translate bars. (Closed)
Patch Set: Fixes. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/before_translate_infobar_controller.h" 5 #include "chrome/browser/cocoa/translate/before_translate_infobar_controller.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 10
11 using TranslateInfoBarUtilities::MoveControl; 11 using TranslateInfoBarUtilities::MoveControl;
12 using TranslateInfoBarUtilities::VerifyControlOrderAndSpacing;
12 13
13 @implementation BeforeTranslateInfobarController 14 @implementation BeforeTranslateInfobarController
14 15
15 - (void)layout { 16 - (void)layout {
16 [optionsPopUp_ setHidden:NO]; 17 MoveControl(label1_, fromLanguagePopUp_, spaceBetweenControls_ / 2, true);
17 MoveControl(label1_, fromLanguagePopUp_, 0, true); 18 MoveControl(fromLanguagePopUp_, label2_, spaceBetweenControls_, true);
18 MoveControl(fromLanguagePopUp_, label2_, 0, true);
19 MoveControl(label2_, okButton_, spaceBetweenControls_, true); 19 MoveControl(label2_, okButton_, spaceBetweenControls_, true);
20 MoveControl(okButton_, cancelButton_, spaceBetweenControls_, true); 20 MoveControl(okButton_, cancelButton_, spaceBetweenControls_, true);
21 } 21 }
22 22
23 - (void)loadLabelText { 23 - (void)loadLabelText {
24 size_t offset = 0; 24 size_t offset = 0;
25 string16 text = 25 string16 text =
26 l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_BEFORE_MESSAGE, 26 l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_BEFORE_MESSAGE,
27 string16(), &offset); 27 string16(), &offset);
28 NSString* string1 = base::SysUTF16ToNSString(text.substr(0, offset)); 28 NSString* string1 = base::SysUTF16ToNSString(text.substr(0, offset));
29 NSString* string2 = base::SysUTF16ToNSString(text.substr(offset)); 29 NSString* string2 = base::SysUTF16ToNSString(text.substr(offset));
30 [label1_ setStringValue:string1]; 30 [label1_ setStringValue:string1];
31 [label2_ setStringValue:string2]; 31 [label2_ setStringValue:string2];
32 [label3_ setStringValue:@""]; 32 [label3_ setStringValue:@""];
33 } 33 }
34 34
35 - (NSArray*)visibleControls { 35 - (NSArray*)visibleControls {
36 return [NSArray arrayWithObjects:label1_.get(), fromLanguagePopUp_.get(), 36 return [NSArray arrayWithObjects:label1_.get(), fromLanguagePopUp_.get(),
37 label2_.get(), okButton_, cancelButton_, nil]; 37 label2_.get(), okButton_, cancelButton_, nil];
38
39 } 38 }
40 39
41 - (bool)verifyLayout { 40 - (bool)verifyLayout {
42 if ([optionsPopUp_ isHidden]) 41 if ([optionsPopUp_ isHidden])
43 return false; 42 return false;
44 return [super verifyLayout]; 43 return [super verifyLayout];
45 } 44 }
46 45
47 @end 46 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698