| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/showcase/core/app_delegate.h" | 5 #import "ios/showcase/core/app_delegate.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "ios/chrome/app/startup/ios_chrome_main.h" |
| 7 #import "ios/showcase/core/showcase_model.h" | 9 #import "ios/showcase/core/showcase_model.h" |
| 8 #import "ios/showcase/core/showcase_view_controller.h" | 10 #import "ios/showcase/core/showcase_view_controller.h" |
| 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 11 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 10 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MDCTypographyAd
ditions/MDFRobotoFontLoader+MDCTypographyAdditions.h" | 12 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MDCTypographyAd
ditions/MDFRobotoFontLoader+MDCTypographyAdditions.h" |
| 11 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 13 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
| 14 #include "ui/base/resource/resource_bundle.h" |
| 12 | 15 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) | 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." | 17 #error "This file requires ARC support." |
| 15 #endif | 18 #endif |
| 16 | 19 |
| 17 @implementation AppDelegate | 20 @implementation AppDelegate |
| 18 @synthesize window = _window; | 21 @synthesize window = _window; |
| 19 | 22 |
| 20 - (BOOL)application:(UIApplication*)application | 23 - (BOOL)application:(UIApplication*)application |
| 21 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { | 24 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { |
| 25 base::MakeUnique<IOSChromeMain>(); |
| 26 ResourceBundle::InitSharedInstanceWithLocale( |
| 27 std::string(), nullptr, ResourceBundle::LOAD_COMMON_RESOURCES); |
| 22 [MDCTypography setFontLoader:[MDFRobotoFontLoader sharedInstance]]; | 28 [MDCTypography setFontLoader:[MDFRobotoFontLoader sharedInstance]]; |
| 23 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | 29 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| 24 ShowcaseViewController* viewController = | 30 ShowcaseViewController* viewController = |
| 25 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; | 31 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; |
| 26 UINavigationController* navigationController = [[UINavigationController alloc] | 32 UINavigationController* navigationController = [[UINavigationController alloc] |
| 27 initWithRootViewController:viewController]; | 33 initWithRootViewController:viewController]; |
| 28 self.window.rootViewController = navigationController; | 34 self.window.rootViewController = navigationController; |
| 29 [self.window makeKeyAndVisible]; | 35 [self.window makeKeyAndVisible]; |
| 36 |
| 30 return YES; | 37 return YES; |
| 31 } | 38 } |
| 32 | 39 |
| 33 #pragma mark - Private | 40 #pragma mark - Private |
| 34 | 41 |
| 35 // Creates model data to display in the view controller. | 42 // Creates model data to display in the view controller. |
| 36 - (NSArray<showcase::ModelRow*>*)rowsToDisplay { | 43 - (NSArray<showcase::ModelRow*>*)rowsToDisplay { |
| 37 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; | 44 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; |
| 38 NSSortDescriptor* sortDescriptor = | 45 NSSortDescriptor* sortDescriptor = |
| 39 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey | 46 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey |
| 40 ascending:YES]; | 47 ascending:YES]; |
| 41 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; | 48 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; |
| 42 } | 49 } |
| 43 | 50 |
| 44 @end | 51 @end |
| OLD | NEW |