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