blob: 02e06e486bed9f6325dc0a945353a353519953e1 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Foundation/Foundation.h>
namespace translate {
class TranslateInfoBarDelegate;
@class LanguageSelectionContext;
@protocol LanguageSelectionHandler;
@protocol PopupMenuConsumer;
@protocol TranslateOptionSelectionHandler;
class WebStateList;
// Translate popup menu types.
typedef NS_ENUM(NSInteger, TranslatePopupMenuType) {
// Mediator object to configure and provide data for the translate infobar's
// language selection and translate option popup menus.
@interface TranslatePopupMenuMediator : NSObject
// |handler| presents and dismisses the language selection UI as well as the
// translate option selection UI.
- (instancetype)initWithSelectionHandler:
(id<LanguageSelectionHandler, TranslateOptionSelectionHandler>)handler
- (instancetype)init NS_UNAVAILABLE;
// Disconnects the mediator.
- (void)disconnect;
// Type of the translate popup menu.
@property(nonatomic, assign) TranslatePopupMenuType type;
// The WebStateList that this mediator observes.
@property(nonatomic, assign) WebStateList* webStateList;
// Provides a list of available languages as well as the current source and
// target languages.
@property(nonatomic, assign)
const translate::TranslateInfoBarDelegate* infobarDelegate;
// Index of the language unavailable for selection depending on if the language
// selection UI is being populated for the source or the target language.
@property(nonatomic, assign) NSUInteger unavailableLanguageIndex;
// The consumer to be configured with this mediator.
@property(nonatomic, weak) id<PopupMenuConsumer> consumer;