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 "cronet_consumer_view_controller.h" 6 7#import <Cronet/Cronet.h> 8 9@implementation CronetConsumerViewController 10#if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0 11{ 12 UIWebView* _webView; 13} 14 15- (void)viewDidLoad { 16 self.view.backgroundColor = [UIColor whiteColor]; 17 18 UIButton* button = [UIButton buttonWithType:UIButtonTypeSystem]; 19 [button setTitle:@"chromium.org" forState:UIControlStateNormal]; 20 [button setFrame:CGRectMake(5, 0, 95, 50)]; 21 [button addTarget:self 22 action:@selector(loadChromium) 23 forControlEvents:UIControlEventTouchUpInside]; 24 [self.view addSubview:button]; 25 26 _webView = [[UIWebView alloc] 27 initWithFrame:CGRectMake(0, 52, self.view.bounds.size.width, 28 self.view.bounds.size.height - 52)]; 29 [self.view addSubview:_webView]; 30 _webView.autoresizingMask = 31 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 32 33 [self loadChromium]; 34} 35 36// Disable the status bar to sidestep all the iOS7 status bar issues. 37- (BOOL)prefersStatusBarHidden { 38 return YES; 39} 40 41- (void)loadChromium { 42 [_webView 43 loadRequest:[NSURLRequest 44 requestWithURL: 45 [NSURL URLWithString:@"https://www.chromium.org"]]]; 46} 47#endif 48@end 49