OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/infobars/after_translate_infobar_controller.h" | 5 #include "chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #import "chrome/browser/ui/cocoa/infobars/infobar_utilities.h" | 8 #import "chrome/browser/ui/cocoa/infobars/infobar_utilities.h" |
9 | 9 |
10 using InfoBarUtilities::MoveControl; | 10 using InfoBarUtilities::MoveControl; |
11 using InfoBarUtilities::VerifyControlOrderAndSpacing; | 11 using InfoBarUtilities::VerifyControlOrderAndSpacing; |
12 | 12 |
13 @implementation AfterTranslateInfobarController | 13 @implementation AfterTranslateInfobarController |
14 | 14 |
15 - (void)loadLabelText { | 15 - (void)loadLabelText { |
16 autodeterminedSourceLanguage_ = ([self delegate]->original_language_index() == | 16 autodeterminedSourceLanguage_ = |
17 TranslateInfoBarDelegate::kNoIndex); | 17 ([self delegate]->original_language_index() == |
| 18 translate::TranslateInfoBarDelegate::kNoIndex); |
18 std::vector<base::string16> strings; | 19 std::vector<base::string16> strings; |
19 TranslateInfoBarDelegate::GetAfterTranslateStrings( | 20 translate::TranslateInfoBarDelegate::GetAfterTranslateStrings( |
20 &strings, &swappedLanugageButtons_, autodeterminedSourceLanguage_); | 21 &strings, &swappedLanugageButtons_, autodeterminedSourceLanguage_); |
21 DCHECK_EQ(autodeterminedSourceLanguage_ ? 2U : 3U, strings.size()); | 22 DCHECK_EQ(autodeterminedSourceLanguage_ ? 2U : 3U, strings.size()); |
22 [label1_ setStringValue:base::SysUTF16ToNSString(strings[0])]; | 23 [label1_ setStringValue:base::SysUTF16ToNSString(strings[0])]; |
23 [label2_ setStringValue:base::SysUTF16ToNSString(strings[1])]; | 24 [label2_ setStringValue:base::SysUTF16ToNSString(strings[1])]; |
24 if (strings.size() == 3U) | 25 if (strings.size() == 3U) |
25 [label3_ setStringValue:base::SysUTF16ToNSString(strings[2])]; | 26 [label3_ setStringValue:base::SysUTF16ToNSString(strings[2])]; |
26 } | 27 } |
27 | 28 |
28 - (void)layout { | 29 - (void)layout { |
29 [self removeOkCancelButtons]; | 30 [self removeOkCancelButtons]; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 showOriginalButton_.get(), nil]; | 62 showOriginalButton_.get(), nil]; |
62 } | 63 } |
63 | 64 |
64 - (bool)verifyLayout { | 65 - (bool)verifyLayout { |
65 if ([optionsPopUp_ isHidden]) | 66 if ([optionsPopUp_ isHidden]) |
66 return false; | 67 return false; |
67 return [super verifyLayout]; | 68 return [super verifyLayout]; |
68 } | 69 } |
69 | 70 |
70 @end | 71 @end |
OLD | NEW |