-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
new_tab_page_header_view_controller.h
118 lines (92 loc) · 4.63 KB
/
new_tab_page_header_view_controller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_HEADER_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_HEADER_VIEW_CONTROLLER_H_
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/content_suggestions/user_account_image_update_delegate.h"
#import "ios/chrome/browser/ui/ntp/logo_animation_controller.h"
#import "ios/chrome/browser/ui/ntp/new_tab_page_header_consumer.h"
#import "ios/chrome/browser/ui/ntp/new_tab_page_header_view_controller_delegate.h"
@protocol ApplicationCommands;
@protocol BrowserCoordinatorCommands;
@protocol ContentSuggestionsCommands;
@protocol FakeboxFocuser;
@protocol NewTabPageControllerDelegate;
@protocol NewTabPageHeaderCommands;
@class NewTabPageMetricsRecorder;
@protocol OmniboxCommands;
@protocol LensCommands;
@class LayoutGuideCenter;
@class PrimaryToolbarViewController;
// Controller for the header containing the logo and the fake omnibox, handling
// the interactions between the header and the collection, and the rest of the
// application.
@interface NewTabPageHeaderViewController
: UIViewController <LogoAnimationControllerOwnerOwner,
NewTabPageHeaderConsumer,
UserAccountImageUpdateDelegate>
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithNibName:(NSString*)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
@property(nonatomic, weak) id<ApplicationCommands,
BrowserCoordinatorCommands,
OmniboxCommands,
FakeboxFocuser,
LensCommands>
dispatcher;
@property(nonatomic, weak) id<NewTabPageHeaderViewControllerDelegate> delegate;
@property(nonatomic, weak) id<NewTabPageHeaderCommands> commandHandler;
@property(nonatomic, weak) id<NewTabPageControllerDelegate> toolbarDelegate;
// `YES` if Google is the default search engine.
@property(nonatomic, assign) BOOL isGoogleDefaultSearchEngine;
// `YES` if its view is visible. When set to `NO` various UI updates are
// ignored.
@property(nonatomic, assign, getter=isShowing) BOOL showing;
// The base view controller from which to present UI.
@property(nonatomic, weak) UIViewController* baseViewController;
// The layout guide center for the current scene.
@property(nonatomic, strong) LayoutGuideCenter* layoutGuideCenter;
// Metrics recorder for the new tab page.
@property(nonatomic, weak) NewTabPageMetricsRecorder* NTPMetricsRecorder;
// Identity disc shown in this ViewController.
// TODO(crbug.com/1170995): Remove once the Feed header properly supports
// ContentSuggestions.
@property(nonatomic, strong, readonly) UIButton* identityDiscButton;
// Animation to expand this header in response to focusing the omnibox to match
// the fake omnibox with the omnibox's.
- (void)expandHeaderForFocus;
// Configure the header after the focus omnibox animation has completed.
// `finalPosition` is important since the animation could be cancelled before
// completion.
- (void)completeHeaderFakeOmniboxFocusAnimationWithFinalPosition:
(UIViewAnimatingPosition)finalPosition;
// Updates the iPhone fakebox's frame based on the current scroll view `offset`
// and `width`. `width` is the width of the screen, including the space outside
// the safe area. The `safeAreaInsets` is relative to the view used to calculate
// the `width`.
- (void)updateFakeOmniboxForOffset:(CGFloat)offset
screenWidth:(CGFloat)screenWidth
safeAreaInsets:(UIEdgeInsets)safeAreaInsets
animateScrollAnimation:(BOOL)animateScrollAnimation;
// Updates the fakeomnibox's width in order to be adapted to the new `width`,
// without taking the y-position into account.
- (void)updateFakeOmniboxForWidth:(CGFloat)width;
// Returns the Y value to use for the scroll view's contentOffset when scrolling
// the omnibox to the top of the screen.
- (CGFloat)pinnedOffsetY;
// Return the toolbar view;
- (UIView*)toolBarView;
// Sends notification to focus the accessibility of the omnibox.
- (void)focusAccessibilityOnOmnibox;
// Calls layoutIfNeeded on the header.
- (void)layoutHeader;
// Returns the height of the entire header.
- (CGFloat)headerHeight;
// Update any dynamic constraints.
- (void)updateConstraints;
// The positive offset value to begin the fake omniobx expansion animation.
- (CGFloat)offsetToBeginFakeOmniboxExpansionForSplitMode;
@end
#endif // IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_HEADER_VIEW_CONTROLLER_H_