| 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 13 matching lines...) Expand all Loading... |
| 24 CGFloat kUIPickerHeight = 216; | 24 CGFloat kUIPickerHeight = 216; |
| 25 CGFloat kUIPickerFontSize = 26; | 25 CGFloat kUIPickerFontSize = 26; |
| 26 NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; | 26 NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 // The class is a data source and delegate to the UIPickerView that contains the | 30 // The class is a data source and delegate to the UIPickerView that contains the |
| 31 // language list. | 31 // language list. |
| 32 @interface LanguagePickerController | 32 @interface LanguagePickerController |
| 33 : UIViewController<UIPickerViewDataSource, UIPickerViewDelegate> { | 33 : UIViewController<UIPickerViewDataSource, UIPickerViewDelegate> { |
| 34 __weak translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; | 34 translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; // weak |
| 35 NSInteger _initialRow; // Displayed in bold font. | 35 NSInteger _initialRow; // Displayed in bold font. |
| 36 NSInteger _disabledRow; // Grayed out. | 36 NSInteger _disabledRow; // Grayed out. |
| 37 } | 37 } |
| 38 @end | 38 @end |
| 39 | 39 |
| 40 @implementation LanguagePickerController | 40 @implementation LanguagePickerController |
| 41 | 41 |
| 42 - (instancetype)initWithDelegate:(translate::TranslateInfoBarDelegate*) | 42 - (instancetype)initWithDelegate:(translate::TranslateInfoBarDelegate*) |
| 43 translateInfoBarDelegate | 43 translateInfoBarDelegate |
| 44 initialRow:(NSInteger)initialRow | 44 initialRow:(NSInteger)initialRow |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Action for the language selection "Done" button. | 100 // Action for the language selection "Done" button. |
| 101 - (void)languageSelectionDone; | 101 - (void)languageSelectionDone; |
| 102 // Dismisses the language selection view. | 102 // Dismisses the language selection view. |
| 103 - (void)dismissLanguageSelectionView; | 103 - (void)dismissLanguageSelectionView; |
| 104 // Changes the text on the view to match the language. | 104 // Changes the text on the view to match the language. |
| 105 - (void)updateInfobarLabelOnView:(UIView<InfoBarViewProtocol>*)view; | 105 - (void)updateInfobarLabelOnView:(UIView<InfoBarViewProtocol>*)view; |
| 106 | 106 |
| 107 @end | 107 @end |
| 108 | 108 |
| 109 @implementation BeforeTranslateInfoBarController { | 109 @implementation BeforeTranslateInfoBarController { |
| 110 __weak translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; | 110 translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; // weak |
| 111 // A fullscreen view that catches all touch events and contains a UIPickerView | 111 // A fullscreen view that catches all touch events and contains a UIPickerView |
| 112 // and a UINavigationBar. | 112 // and a UINavigationBar. |
| 113 base::scoped_nsobject<UIView> _languageSelectionView; | 113 base::scoped_nsobject<UIView> _languageSelectionView; |
| 114 // Stores whether the user is currently choosing in the UIPickerView the | 114 // Stores whether the user is currently choosing in the UIPickerView the |
| 115 // original language, or the target language. | 115 // original language, or the target language. |
| 116 NSUInteger _languageSelectionType; | 116 NSUInteger _languageSelectionType; |
| 117 // The language picker. | 117 // The language picker. |
| 118 base::scoped_nsobject<UIPickerView> _languagePicker; | 118 base::scoped_nsobject<UIPickerView> _languagePicker; |
| 119 // Navigation bar associated with the picker with "Done" and "Cancel" buttons. | 119 // Navigation bar associated with the picker with "Done" and "Cancel" buttons. |
| 120 base::scoped_nsobject<UINavigationBar> _navigationBar; | 120 base::scoped_nsobject<UINavigationBar> _navigationBar; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 [super removeView]; | 349 [super removeView]; |
| 350 [self dismissLanguageSelectionView]; | 350 [self dismissLanguageSelectionView]; |
| 351 } | 351 } |
| 352 | 352 |
| 353 - (void)detachView { | 353 - (void)detachView { |
| 354 [super detachView]; | 354 [super detachView]; |
| 355 [self dismissLanguageSelectionView]; | 355 [self dismissLanguageSelectionView]; |
| 356 } | 356 } |
| 357 | 357 |
| 358 @end | 358 @end |
| OLD | NEW |