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

Unified Diff: sky/shell/ios/sky_app_delegate.mm

Issue 1171573002: Basic Sky shell for iOS targets (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Service provider platform task runner refactor to be platform agnostic Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/shell/ios/sky_app_delegate.h ('k') | sky/shell/ios/sky_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/ios/sky_app_delegate.mm
diff --git a/sky/shell/ios/sky_app_delegate.mm b/sky/shell/ios/sky_app_delegate.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ff7449daaa9c1e1549f3f6aa1c883511b4fb1677
--- /dev/null
+++ b/sky/shell/ios/sky_app_delegate.mm
@@ -0,0 +1,53 @@
+// Copyright 2015 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 "sky_app_delegate.h"
+#import "sky_view_controller.h"
+
+#include "sky/shell/shell.h"
+#include "sky/shell/service_provider.h"
+#include "sky/shell/ui_delegate.h"
+#include "base/lazy_instance.h"
+#include "base/message_loop/message_loop.h"
+
+@implementation SkyAppDelegate {
+ base::LazyInstance<scoped_ptr<base::MessageLoop>> _main_message_loop;
+}
+
+- (BOOL)application:(UIApplication*)application
+ didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
+ [self setupSkyShell];
+ [self setupViewport];
+
+ return YES;
+}
+
+- (void)setupSkyShell {
+ [self adoptPlatformRunLoop];
+
+ auto service_provider_context =
+ make_scoped_ptr(new sky::shell::ServiceProviderContext(
+ _main_message_loop.Get()->task_runner()));
+ sky::shell::Shell::Init(service_provider_context.Pass());
+}
+
+- (void)adoptPlatformRunLoop {
+ _main_message_loop.Get().reset(new base::MessageLoopForUI);
+ // One cannot start the message loop on the platform main thread. Instead,
+ // we attach to the CFRunLoop
+ base::MessageLoopForUI::current()->Attach();
+}
+
+- (void)setupViewport {
+ CGRect frame = [UIScreen mainScreen].bounds;
+ UIWindow* window = [[UIWindow alloc] initWithFrame:frame];
+ SkyViewController* viewController = [[SkyViewController alloc] init];
+ window.rootViewController = viewController;
+ [viewController release];
+ self.window = window;
+ [window release];
+ [self.window makeKeyAndVisible];
+}
+
+@end
« no previous file with comments | « sky/shell/ios/sky_app_delegate.h ('k') | sky/shell/ios/sky_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698