| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ios/chrome/browser/translate/before_translate_infobar_controller.h" | 5 #include "ios/chrome/browser/translate/before_translate_infobar_controller.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // |_languagePicker| does not retain it. | 120 // |_languagePicker| does not retain it. |
| 121 base::scoped_nsobject<LanguagePickerController> _languagePickerController; | 121 base::scoped_nsobject<LanguagePickerController> _languagePickerController; |
| 122 } | 122 } |
| 123 | 123 |
| 124 #pragma mark - | 124 #pragma mark - |
| 125 #pragma mark InfoBarControllerProtocol | 125 #pragma mark InfoBarControllerProtocol |
| 126 | 126 |
| 127 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate | 127 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate |
| 128 frame:(CGRect)frame { | 128 frame:(CGRect)frame { |
| 129 _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); | 129 _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); |
| 130 infobars::InfoBarDelegate* infoBarDelegate = | |
| 131 static_cast<infobars::InfoBarDelegate*>(_translateInfoBarDelegate); | |
| 132 DCHECK(!infoBarView_); | 130 DCHECK(!infoBarView_); |
| 133 infoBarView_.reset([ios::GetChromeBrowserProvider()->CreateInfoBarView() | 131 infoBarView_.reset([ios::GetChromeBrowserProvider()->CreateInfoBarView() |
| 134 initWithFrame:frame | 132 initWithFrame:frame |
| 135 delegate:delegate_ | 133 delegate:delegate_]); |
| 136 isWarning:infoBarDelegate->GetInfoBarType() == | |
| 137 infobars::InfoBarDelegate::WARNING_TYPE]); | |
| 138 // Icon | 134 // Icon |
| 139 gfx::Image icon = _translateInfoBarDelegate->GetIcon(); | 135 gfx::Image icon = _translateInfoBarDelegate->GetIcon(); |
| 140 if (!icon.IsEmpty()) | 136 if (!icon.IsEmpty()) |
| 141 [infoBarView_ addLeftIcon:icon.ToUIImage()]; | 137 [infoBarView_ addLeftIcon:icon.ToUIImage()]; |
| 142 | 138 |
| 143 // Main text. | 139 // Main text. |
| 144 [self updateInfobarLabel]; | 140 [self updateInfobarLabel]; |
| 145 | 141 |
| 146 // Close button. | 142 // Close button. |
| 147 [infoBarView_ addCloseButtonWithTag:TranslateInfoBarIOSTag::BEFORE_DENY | 143 [infoBarView_ addCloseButtonWithTag:TranslateInfoBarIOSTag::BEFORE_DENY |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 [super removeView]; | 349 [super removeView]; |
| 354 [self dismissLanguageSelectionView]; | 350 [self dismissLanguageSelectionView]; |
| 355 } | 351 } |
| 356 | 352 |
| 357 - (void)detachView { | 353 - (void)detachView { |
| 358 [super detachView]; | 354 [super detachView]; |
| 359 [self dismissLanguageSelectionView]; | 355 [self dismissLanguageSelectionView]; |
| 360 } | 356 } |
| 361 | 357 |
| 362 @end | 358 @end |
| OLD | NEW |