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

Side by Side Diff: ios/chrome/browser/ui/first_run/static_file_view_controller.mm

Issue 2680433002: [ObjC ARC] Converts ios/chrome/browser/ui/first_run:first_run to ARC. (Closed)
Patch Set: weak Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "ios/chrome/browser/ui/first_run/static_file_view_controller.h" 5 #include "ios/chrome/browser/ui/first_run/static_file_view_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsobject.h"
11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
12 #import "ios/chrome/browser/ui/material_components/utils.h" 11 #import "ios/chrome/browser/ui/material_components/utils.h"
13 #include "ios/chrome/browser/ui/rtl_geometry.h" 12 #include "ios/chrome/browser/ui/rtl_geometry.h"
14 #import "ios/third_party/material_components_ios/src/components/AppBar/src/Mater ialAppBar.h" 13 #import "ios/third_party/material_components_ios/src/components/AppBar/src/Mater ialAppBar.h"
15 #import "ios/third_party/material_components_ios/src/components/FlexibleHeader/s rc/MaterialFlexibleHeader.h" 14 #import "ios/third_party/material_components_ios/src/components/FlexibleHeader/s rc/MaterialFlexibleHeader.h"
16 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 15 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
17 #import "ios/web/public/web_view_creation_util.h" 16 #import "ios/web/public/web_view_creation_util.h"
18 17
18 #if !defined(__has_feature) || !__has_feature(objc_arc)
19 #error "This file requires ARC support."
20 #endif
21
19 @interface StaticFileViewController ()<UIScrollViewDelegate> { 22 @interface StaticFileViewController ()<UIScrollViewDelegate> {
20 ios::ChromeBrowserState* _browserState; // weak 23 ios::ChromeBrowserState* _browserState; // weak
21 base::scoped_nsobject<NSURL> _URL; 24 NSURL* _URL;
22 // YES if the header has been configured for RTL. 25 // YES if the header has been configured for RTL.
23 BOOL _headerLaidOutForRTL; 26 BOOL _headerLaidOutForRTL;
24 // The web view used to display the static content. 27 // The web view used to display the static content.
25 base::scoped_nsobject<WKWebView> _webView; 28 WKWebView* _webView;
26 // The header. 29 // The header.
27 base::scoped_nsobject<MDCAppBar> _appBar; 30 MDCAppBar* _appBar;
28 } 31 }
29 32
30 @end 33 @end
31 34
32 @implementation StaticFileViewController 35 @implementation StaticFileViewController
33 36
34 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState 37 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
35 URL:(NSURL*)URL { 38 URL:(NSURL*)URL {
36 DCHECK(browserState); 39 DCHECK(browserState);
37 DCHECK(URL); 40 DCHECK(URL);
38 self = [super init]; 41 self = [super init];
39 if (self) { 42 if (self) {
40 _appBar.reset([[MDCAppBar alloc] init]); 43 _appBar = [[MDCAppBar alloc] init];
41 [self addChildViewController:[_appBar headerViewController]]; 44 [self addChildViewController:[_appBar headerViewController]];
42 _browserState = browserState; 45 _browserState = browserState;
43 _URL.reset([URL retain]); 46 _URL = URL;
44 } 47 }
45 return self; 48 return self;
46 } 49 }
47 50
48 - (void)dealloc { 51 - (void)dealloc {
49 [_webView scrollView].delegate = nil; 52 [_webView scrollView].delegate = nil;
50 [super dealloc];
51 } 53 }
52 54
53 #pragma mark - UIViewController 55 #pragma mark - UIViewController
54 56
55 - (void)viewDidLoad { 57 - (void)viewDidLoad {
56 [super viewDidLoad]; 58 [super viewDidLoad];
57 59
58 _webView.reset([web::BuildWKWebView(self.view.bounds, _browserState) retain]); 60 _webView = web::BuildWKWebView(self.view.bounds, _browserState);
59 [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | 61 [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth |
60 UIViewAutoresizingFlexibleHeight]; 62 UIViewAutoresizingFlexibleHeight];
61 63
62 // Loads terms of service into the web view. 64 // Loads terms of service into the web view.
63 [_webView loadRequest:[NSURLRequest requestWithURL:_URL]]; 65 [_webView loadRequest:[NSURLRequest requestWithURL:_URL]];
64 [_webView setBackgroundColor:[UIColor whiteColor]]; 66 [_webView setBackgroundColor:[UIColor whiteColor]];
65 [self.view addSubview:_webView]; 67 [self.view addSubview:_webView];
66 68
67 ConfigureAppBarWithCardStyle(_appBar); 69 ConfigureAppBarWithCardStyle(_appBar);
68 [_appBar headerViewController].headerView.trackingScrollView = 70 [_appBar headerViewController].headerView.trackingScrollView =
69 [_webView scrollView]; 71 [_webView scrollView];
70 [_webView scrollView].delegate = [_appBar headerViewController]; 72 [_webView scrollView].delegate = [_appBar headerViewController];
71 73
72 // Add the app bar at the end. 74 // Add the app bar at the end.
73 [_appBar addSubviewsToParent]; 75 [_appBar addSubviewsToParent];
74 } 76 }
75 77
76 @end 78 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/first_run/first_run_util.mm ('k') | ios/chrome/browser/ui/first_run/welcome_to_chrome_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698