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

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

Issue 2781073002: Use the old back button on Terms of Service. (Closed)
Patch Set: Feedback Created 3 years, 8 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
« no previous file with comments | « ios/chrome/browser/ui/first_run/first_run_egtest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ios/chrome/browser/browser_state/chrome_browser_state.h" 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
11 #import "ios/chrome/browser/ui/icons/chrome_icon.h"
11 #import "ios/chrome/browser/ui/material_components/utils.h" 12 #import "ios/chrome/browser/ui/material_components/utils.h"
12 #include "ios/chrome/browser/ui/rtl_geometry.h" 13 #include "ios/chrome/browser/ui/rtl_geometry.h"
13 #import "ios/third_party/material_components_ios/src/components/AppBar/src/Mater ialAppBar.h" 14 #import "ios/third_party/material_components_ios/src/components/AppBar/src/Mater ialAppBar.h"
14 #import "ios/third_party/material_components_ios/src/components/FlexibleHeader/s rc/MaterialFlexibleHeader.h" 15 #import "ios/third_party/material_components_ios/src/components/FlexibleHeader/s rc/MaterialFlexibleHeader.h"
15 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 16 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
16 #import "ios/web/public/web_view_creation_util.h" 17 #import "ios/web/public/web_view_creation_util.h"
17 18
18 #if !defined(__has_feature) || !__has_feature(objc_arc) 19 #if !defined(__has_feature) || !__has_feature(objc_arc)
19 #error "This file requires ARC support." 20 #error "This file requires ARC support."
20 #endif 21 #endif
21 22
22 @interface StaticFileViewController ()<UIScrollViewDelegate> { 23 @interface StaticFileViewController ()<UIScrollViewDelegate> {
23 ios::ChromeBrowserState* _browserState; // weak 24 ios::ChromeBrowserState* _browserState; // weak
24 NSURL* _URL; 25 NSURL* _URL;
25 // YES if the header has been configured for RTL. 26 // YES if the header has been configured for RTL.
26 BOOL _headerLaidOutForRTL; 27 BOOL _headerLaidOutForRTL;
27 // The web view used to display the static content. 28 // The web view used to display the static content.
28 WKWebView* _webView; 29 WKWebView* _webView;
29 // The header. 30 // The header.
30 MDCAppBar* _appBar; 31 MDCAppBar* _appBar;
31 } 32 }
32 33
34 // Called when the back button is pressed.
35 - (void)back;
36
33 @end 37 @end
34 38
35 @implementation StaticFileViewController 39 @implementation StaticFileViewController
36 40
37 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState 41 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
38 URL:(NSURL*)URL { 42 URL:(NSURL*)URL {
39 DCHECK(browserState); 43 DCHECK(browserState);
40 DCHECK(URL); 44 DCHECK(URL);
41 self = [super init]; 45 self = [super init];
42 if (self) { 46 if (self) {
(...skipping 23 matching lines...) Expand all
66 [_webView setBackgroundColor:[UIColor whiteColor]]; 70 [_webView setBackgroundColor:[UIColor whiteColor]];
67 [self.view addSubview:_webView]; 71 [self.view addSubview:_webView];
68 72
69 ConfigureAppBarWithCardStyle(_appBar); 73 ConfigureAppBarWithCardStyle(_appBar);
70 [_appBar headerViewController].headerView.trackingScrollView = 74 [_appBar headerViewController].headerView.trackingScrollView =
71 [_webView scrollView]; 75 [_webView scrollView];
72 [_webView scrollView].delegate = [_appBar headerViewController]; 76 [_webView scrollView].delegate = [_appBar headerViewController];
73 77
74 // Add the app bar at the end. 78 // Add the app bar at the end.
75 [_appBar addSubviewsToParent]; 79 [_appBar addSubviewsToParent];
80
81 // Create a custom Back bar button item, as Material Navigation Bar deprecated
82 // the back arrow with a shaft.
83 self.navigationItem.leftBarButtonItem =
84 [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon backIcon]
85 target:self
86 action:@selector(back)];
87 }
88
89 #pragma mark - Actions
90
91 - (void)back {
92 [self.navigationController popViewControllerAnimated:YES];
76 } 93 }
77 94
78 @end 95 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/first_run/first_run_egtest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698