Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: ios/showcase/core/app_delegate.mm

Issue 2651833002: [ios showcase]Configures Resource Bundle and adds Toolbar Coordinator (Closed)
Patch Set: Removes Application State dependency Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
22 [MDCTypography setFontLoader:[MDFRobotoFontLoader sharedInstance]]; 25 [MDCTypography setFontLoader:[MDFRobotoFontLoader sharedInstance]];
23 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 26 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
24 ShowcaseViewController* viewController = 27 ShowcaseViewController* viewController =
25 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; 28 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]];
26 UINavigationController* navigationController = [[UINavigationController alloc] 29 UINavigationController* navigationController = [[UINavigationController alloc]
27 initWithRootViewController:viewController]; 30 initWithRootViewController:viewController];
28 self.window.rootViewController = navigationController; 31 self.window.rootViewController = navigationController;
29 [self.window makeKeyAndVisible]; 32 [self.window makeKeyAndVisible];
33
34 base::MakeUnique<IOSChromeMain>();
35 ResourceBundle::InitSharedInstanceWithLocale(
36 std::string(), nullptr, ResourceBundle::LOAD_COMMON_RESOURCES);
lpromero 2017/01/25 08:07:30 Can you move this before or right after the MDCTyp
sczs 2017/01/25 16:59:21 Done.
37
30 return YES; 38 return YES;
31 } 39 }
32 40
33 #pragma mark - Private 41 #pragma mark - Private
34 42
35 // Creates model data to display in the view controller. 43 // Creates model data to display in the view controller.
36 - (NSArray<showcase::ModelRow*>*)rowsToDisplay { 44 - (NSArray<showcase::ModelRow*>*)rowsToDisplay {
37 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; 45 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model];
38 NSSortDescriptor* sortDescriptor = 46 NSSortDescriptor* sortDescriptor =
39 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey 47 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey
40 ascending:YES]; 48 ascending:YES];
41 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; 49 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]];
42 } 50 }
43 51
44 @end 52 @end
OLDNEW
« no previous file with comments | « ios/showcase/core/BUILD.gn ('k') | ios/showcase/core/main.mm » ('j') | ios/showcase/core/main.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698