| 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "components/strings/grit/components_strings.h" | 14 #include "components/strings/grit/components_strings.h" |
| 15 #include "components/translate/core/browser/translate_infobar_delegate.h" | 15 #include "components/translate/core/browser/translate_infobar_delegate.h" |
| 16 #include "ios/chrome/browser/translate/translate_infobar_tags.h" | 16 #include "ios/chrome/browser/translate/translate_infobar_tags.h" |
| 17 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 17 #import "ios/chrome/browser/ui/infobars/infobar_view.h" |
| 18 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" | 18 #import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" |
| 19 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" | 19 #import "ios/chrome/browser/ui/infobars/infobar_view_protocol.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 CGFloat kNavigationBarHeight = 44; | 25 CGFloat kNavigationBarHeight = 44; |
| 26 CGFloat kUIPickerHeight = 216; | 26 CGFloat kUIPickerHeight = 216; |
| 27 CGFloat kUIPickerFontSize = 26; | 27 CGFloat kUIPickerFontSize = 26; |
| 28 NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; | 28 NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; |
| 29 | 29 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 #pragma mark - | 128 #pragma mark - |
| 129 #pragma mark InfoBarControllerProtocol | 129 #pragma mark InfoBarControllerProtocol |
| 130 | 130 |
| 131 - (UIView<InfoBarViewProtocol>*)viewForDelegate: | 131 - (UIView<InfoBarViewProtocol>*)viewForDelegate: |
| 132 (infobars::InfoBarDelegate*)delegate | 132 (infobars::InfoBarDelegate*)delegate |
| 133 frame:(CGRect)frame { | 133 frame:(CGRect)frame { |
| 134 base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; | 134 base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; |
| 135 _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); | 135 _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); |
| 136 infoBarView.reset( | 136 infoBarView.reset( |
| 137 ios::GetChromeBrowserProvider()->CreateInfoBarView(frame, self.delegate)); | 137 [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]); |
| 138 // Icon | 138 // Icon |
| 139 gfx::Image icon = _translateInfoBarDelegate->GetIcon(); | 139 gfx::Image icon = _translateInfoBarDelegate->GetIcon(); |
| 140 if (!icon.IsEmpty()) | 140 if (!icon.IsEmpty()) |
| 141 [infoBarView addLeftIcon:icon.ToUIImage()]; | 141 [infoBarView addLeftIcon:icon.ToUIImage()]; |
| 142 | 142 |
| 143 // Main text. | 143 // Main text. |
| 144 [self updateInfobarLabelOnView:infoBarView]; | 144 [self updateInfobarLabelOnView:infoBarView]; |
| 145 | 145 |
| 146 // Close button. | 146 // Close button. |
| 147 [infoBarView addCloseButtonWithTag:TranslateInfoBarIOSTag::BEFORE_DENY | 147 [infoBarView addCloseButtonWithTag:TranslateInfoBarIOSTag::BEFORE_DENY |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 [super removeView]; | 366 [super removeView]; |
| 367 [self dismissLanguageSelectionView]; | 367 [self dismissLanguageSelectionView]; |
| 368 } | 368 } |
| 369 | 369 |
| 370 - (void)detachView { | 370 - (void)detachView { |
| 371 [super detachView]; | 371 [super detachView]; |
| 372 [self dismissLanguageSelectionView]; | 372 [self dismissLanguageSelectionView]; |
| 373 } | 373 } |
| 374 | 374 |
| 375 @end | 375 @end |
| OLD | NEW |