blob: 75a7bcbbbffa0ce5ddf24132093377d6fcc5bfa4 [file] [log] [blame]
// Copyright 2012 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 "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h"
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
#import "ios/chrome/browser/ui/browser_view_controller_helper.h"
#import "ios/chrome/browser/ui/key_commands_provider.h"
#import "ios/chrome/browser/ui/toolbar/public/features.h"
#include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation BrowserViewControllerDependencyFactory {
ios::ChromeBrowserState* browserState_;
WebStateList* webStateList_;
}
- (id)initWithBrowserState:(ios::ChromeBrowserState*)browserState
webStateList:(WebStateList*)webStateList {
self = [super init];
if (self) {
browserState_ = browserState;
webStateList_ = webStateList;
}
return self;
}
- (BrowserViewControllerHelper*)newBrowserViewControllerHelper {
return [[BrowserViewControllerHelper alloc] init];
}
- (KeyCommandsProvider*)newKeyCommandsProvider {
return [[KeyCommandsProvider alloc] init];
}
- (AlertCoordinator*)alertCoordinatorWithTitle:(NSString*)title
message:(NSString*)message
viewController:
(UIViewController*)viewController {
AlertCoordinator* alertCoordinator =
[[AlertCoordinator alloc] initWithBaseViewController:viewController
title:title
message:message];
[alertCoordinator addItemWithTitle:l10n_util::GetNSString(IDS_OK)
action:nil
style:UIAlertActionStyleDefault];
return alertCoordinator;
}
@end