Commit 2b8e9d3a authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Migrate StaticFileViewController to MDCAppBarViewController

Bug: 874471
Change-Id: Ied43248aefe91db97b00090a4fde284b326a82ba
Reviewed-on: https://chromium-review.googlesource.com/1205103
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589266}
parent b705710a
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#import "ios/chrome/browser/ui/icons/chrome_icon.h" #import "ios/chrome/browser/ui/icons/chrome_icon.h"
#import "ios/chrome/browser/ui/material_components/utils.h" #import "ios/chrome/browser/ui/material_components/utils.h"
#include "ios/chrome/browser/ui/rtl_geometry.h" #include "ios/chrome/browser/ui/rtl_geometry.h"
#import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h" #import "ios/third_party/material_components_ios/src/components/AppBar/src/MDCAppBarViewController.h"
#import "ios/third_party/material_components_ios/src/components/FlexibleHeader/src/MaterialFlexibleHeader.h" #import "ios/third_party/material_components_ios/src/components/FlexibleHeader/src/MaterialFlexibleHeader.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h" #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#import "ios/web/public/web_view_creation_util.h" #import "ios/web/public/web_view_creation_util.h"
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// The web view used to display the static content. // The web view used to display the static content.
WKWebView* _webView; WKWebView* _webView;
// The header. // The header.
MDCAppBar* _appBar; MDCAppBarViewController* _appBarViewController;
} }
// Called when the back button is pressed. // Called when the back button is pressed.
...@@ -47,8 +47,7 @@ ...@@ -47,8 +47,7 @@
DCHECK(URL); DCHECK(URL);
self = [super init]; self = [super init];
if (self) { if (self) {
_appBar = [[MDCAppBar alloc] init]; _appBarViewController = [[MDCAppBarViewController alloc] init];
[self addChildViewController:[_appBar headerViewController]];
_browserState = browserState; _browserState = browserState;
_URL = URL; _URL = URL;
} }
...@@ -78,13 +77,14 @@ ...@@ -78,13 +77,14 @@
_webView.navigationDelegate = self; _webView.navigationDelegate = self;
[self.view addSubview:_webView]; [self.view addSubview:_webView];
ConfigureAppBarWithCardStyle(_appBar); ConfigureAppBarViewControllerWithCardStyle(_appBarViewController);
[_appBar headerViewController].headerView.trackingScrollView = _appBarViewController.headerView.trackingScrollView = [_webView scrollView];
[_webView scrollView]; [_webView scrollView].delegate = _appBarViewController;
[_webView scrollView].delegate = [_appBar headerViewController];
// Add the app bar at the end. // Add the app bar at the end.
[_appBar addSubviewsToParent]; [self addChildViewController:_appBarViewController];
[self.view addSubview:_appBarViewController.view];
[_appBarViewController didMoveToParentViewController:self];
// Create a custom Back bar button item, as Material Navigation Bar deprecated // Create a custom Back bar button item, as Material Navigation Bar deprecated
// the back arrow with a shaft. // the back arrow with a shaft.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment