OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/web/shell/app_delegate.h" |
| 6 |
| 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ios/web/public/app/web_main.h" |
| 10 #include "ios/web/public/web_client.h" |
| 11 #include "ios/web/public/web_state/web_state.h" |
| 12 #include "ios/web/shell/shell_browser_state.h" |
| 13 #include "ios/web/shell/shell_main_delegate.h" |
| 14 #include "ios/web/shell/shell_web_client.h" |
| 15 #import "ios/web/shell/view_controller.h" |
| 16 |
| 17 @interface AppDelegate () { |
| 18 scoped_ptr<web::ShellMainDelegate> _delegate; |
| 19 scoped_ptr<web::WebMain> _webMain; |
| 20 } |
| 21 @end |
| 22 |
| 23 @implementation AppDelegate |
| 24 |
| 25 @synthesize window = _window; |
| 26 |
| 27 - (BOOL)application:(UIApplication*)application |
| 28 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { |
| 29 _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| 30 self.window.backgroundColor = [UIColor whiteColor]; |
| 31 |
| 32 _delegate.reset(new web::ShellMainDelegate()); |
| 33 web::WebMainParams params(_delegate.get()); |
| 34 _webMain.reset(new web::WebMain(params)); |
| 35 |
| 36 web::ShellWebClient* client = |
| 37 static_cast<web::ShellWebClient*>(web::GetWebClient()); |
| 38 web::BrowserState* browserState = client->browser_state(); |
| 39 |
| 40 base::scoped_nsobject<ViewController> controller( |
| 41 [[ViewController alloc] initWithBrowserState:browserState]); |
| 42 self.window.rootViewController = controller; |
| 43 [self.window makeKeyAndVisible]; |
| 44 return YES; |
| 45 } |
| 46 |
| 47 - (void)applicationWillResignActive:(UIApplication*)application { |
| 48 } |
| 49 |
| 50 - (void)applicationDidEnterBackground:(UIApplication*)application { |
| 51 } |
| 52 |
| 53 - (void)applicationWillEnterForeground:(UIApplication*)application { |
| 54 } |
| 55 |
| 56 - (void)applicationDidBecomeActive:(UIApplication*)application { |
| 57 } |
| 58 |
| 59 - (void)applicationWillTerminate:(UIApplication*)application { |
| 60 _webMain.reset(); |
| 61 _delegate.reset(); |
| 62 } |
| 63 |
| 64 @end |
OLD | NEW |