Chromium Code Reviews| Index: remoting/client/ios/app/host_view_controller.mm |
| diff --git a/remoting/client/ios/app/host_view_controller.mm b/remoting/client/ios/app/host_view_controller.mm |
| index ad6041a2dedc21218ea31ee8aa2a7d527521d375..17e1a45f1e61c6a886a9abbbcde7ab6325c1e602 100644 |
| --- a/remoting/client/ios/app/host_view_controller.mm |
| +++ b/remoting/client/ios/app/host_view_controller.mm |
| @@ -9,30 +9,21 @@ |
| #import "remoting/client/ios/app/host_view_controller.h" |
| #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" |
| -#import "remoting/client/display/sys_opengl.h" |
| -#import "remoting/client/ios/display/gl_display_handler.h" |
| -#import "remoting/client/ios/facade/remoting_service.h" |
| +#import "remoting/client/ios/session/remoting_client.h" |
| -#include "remoting/client/chromoting_client_runtime.h" |
| -#include "remoting/client/software_video_renderer.h" |
| - |
| -static const CGFloat kFabInset = 45.f; |
| +static const CGFloat kFabInset = 15.f; |
|
Jamie
2017/04/24 21:54:11
This doesn't look related to the CL description. I
nicholss
2017/04/24 22:03:07
The host view has a FAB on it, in seeing the rende
Jamie
2017/04/24 22:07:42
It should still at least be called out in the CL d
|
| @interface HostViewController () { |
| - EAGLContext* _context; |
| - GlDisplayHandler* _display_handler; |
| - remoting::SoftwareVideoRenderer* _video_renderer; |
| + RemotingClient* _client; |
| } |
| @end |
| @implementation HostViewController |
| -- (id)init { |
| +- (id)initWithClient:(RemotingClient*)client { |
| self = [super init]; |
| if (self) { |
| - // TODO(nicholss): For prod code, make sure to check for ES3 support and |
| - // fall back to ES2 if needed. |
| - _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; |
| + _client = client; |
| } |
| return self; |
| } |
| @@ -41,39 +32,28 @@ static const CGFloat kFabInset = 45.f; |
| - (void)viewDidLoad { |
| [super viewDidLoad]; |
| - // TODO(nicholss): Take a look at the following: |
| - // components/Snackbar/examples/SnackbarOverlayViewExample.m |
| - // to add the toast overlay. |
| - MDCFloatingButton* floatingButton = [MDCFloatingButton new]; |
| + MDCFloatingButton* floatingButton = |
| + [MDCFloatingButton floatingButtonWithShape:MDCFloatingButtonShapeMini]; |
| [floatingButton setTitle:@"+" forState:UIControlStateNormal]; |
| - [floatingButton sizeToFit]; |
| [floatingButton addTarget:self |
| action:@selector(didTap:) |
| forControlEvents:UIControlEventTouchUpInside]; |
| UIImage* settingsImage = [UIImage imageNamed:@"Settings"]; |
| [floatingButton setImage:settingsImage forState:UIControlStateNormal]; |
| - |
| - floatingButton.frame = CGRectMake( |
| - self.view.frame.size.width - floatingButton.frame.size.width - kFabInset, |
| - self.view.frame.size.height - floatingButton.frame.size.height - |
| - kFabInset, |
| - floatingButton.frame.size.width, floatingButton.frame.size.height); |
| + [floatingButton sizeToFit]; |
| + CGSize btnSize = floatingButton.frame.size; |
| + floatingButton.frame = |
| + CGRectMake(self.view.frame.size.width - btnSize.width - kFabInset, |
| + self.view.frame.size.height - btnSize.height - kFabInset, |
| + btnSize.width, btnSize.height); |
| [self.view addSubview:floatingButton]; |
| - |
| - static_cast<GLKView*>(self.view).context = _context; |
| - [self setupGL]; |
| } |
| - (void)viewDidUnload { |
| [super viewDidUnload]; |
| - [self tearDownGL]; |
| - |
| - if ([EAGLContext currentContext] == _context) { |
| - [EAGLContext setCurrentContext:nil]; |
| - } |
| - _context = nil; |
| + // TODO(nicholss): There needs to be a hook to tell the client we are done. |
| } |
| - (BOOL)prefersStatusBarHidden { |
| @@ -81,44 +61,27 @@ static const CGFloat kFabInset = 45.f; |
| } |
| - (void)viewDidAppear:(BOOL)animated { |
| - _video_renderer = |
| - (remoting::SoftwareVideoRenderer*)[_display_handler CreateVideoRenderer] |
| - .get(); |
| + [super viewDidAppear:animated]; |
| + GLKView* view = (GLKView*)self.view; |
| + view.context = [_client.displayHandler GetEAGLContext]; |
| } |
| - (void)viewWillDisappear:(BOOL)animated { |
| - [super viewWillDisappear:NO]; |
| + [super viewWillDisappear:animated]; |
| } |
| #pragma mark - GLKViewDelegate |
| -// In general, avoid expensive work in this function to maximize frame rate. |
| - (void)glkView:(GLKView*)view drawInRect:(CGRect)rect { |
| - if (_display_handler) { |
| - [_display_handler glkView:view drawInRect:rect]; |
| - } |
| + // Nothing to do that is synchronous yet. |
| } |
| #pragma mark - Private |
| -- (void)setupGL { |
| - _display_handler = [[GlDisplayHandler alloc] |
| - initWithRuntime:[[RemotingService SharedInstance] runtime]]; |
| - [_display_handler created]; |
| -} |
| - |
| -- (void)tearDownGL { |
| - // TODO(nicholss): Implement tearDownGL for the real application. |
| - [_display_handler stop]; |
| - _display_handler = nil; |
| - _video_renderer = nil; |
| -} |
| - |
| - (void)didTap:(id)sender { |
| // TODO(nicholss): The FAB is being used to close the window at the moment |
| // just as a demo as the integration continues. This will not be the case |
| // in the final app. |
| - [self tearDownGL]; |
| [self dismissViewControllerAnimated:YES completion:nil]; |
| } |