Commit 5697a402 authored by Peter K. Lee's avatar Peter K. Lee Committed by Commit Bot

Adds delegate method to process avatar image for current user (1/4)

This adds a delegate method to ContentSuggestionsHeaderViewControllerDelegate
protocol specify how user's avatar image would be processed.

New Tab Page uses this delegate method to add/update the avatar for the
current user's identity and display at the top right corner of NTP.

Bug: 961120
Change-Id: I19abd5eab02481214a605de4b6321aa9a22ea79f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612091Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Peter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660608}
parent 8a648748
......@@ -104,6 +104,7 @@ source_set("content_suggestions_ui") {
"content_suggestions_view_controller.mm",
"content_suggestions_view_controller_audience.h",
"ntp_home_consumer.h",
"user_account_image_update_delegate.h",
]
deps = [
":content_suggestions_constant",
......
......@@ -7,6 +7,8 @@
#import <UIKit/UIKit.h>
@protocol UserAccountImageUpdateDelegate;
// Delegate for the ContentSuggestionsHeaderViewController.
@protocol ContentSuggestionsHeaderViewControllerDelegate
......@@ -16,6 +18,10 @@
// Returns whether the collection is scrolled to its top.
- (BOOL)isScrolledToTop;
// Register |imageUpdater| object as delegate to refresh UI when user account
// avatar is changed.
- (void)registerImageUpdater:(id<UserAccountImageUpdateDelegate>)imageUpdater;
// Returns whether calls that may trigger a URL load are allowed, such as a
// voice search or focusing the omnibox via the fakebox.
// See: crbug.com/925304 for more context. Remove this when ios/web supports
......
......@@ -33,6 +33,7 @@
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller_audience.h"
#import "ios/chrome/browser/ui/content_suggestions/ntp_home_consumer.h"
#import "ios/chrome/browser/ui/content_suggestions/ntp_home_metrics.h"
#import "ios/chrome/browser/ui/content_suggestions/user_account_image_update_delegate.h"
#import "ios/chrome/browser/ui/location_bar/location_bar_notification_names.h"
#include "ios/chrome/browser/ui/ntp/metrics.h"
#import "ios/chrome/browser/ui/ntp/new_tab_page_header_constants.h"
......@@ -469,6 +470,9 @@ const char kNTPHelpURL[] =
return self.suggestionsViewController.scrolledToTop;
}
- (void)registerImageUpdater:(id<UserAccountImageUpdateDelegate>)imageUpdater {
}
- (BOOL)ignoreLoadRequests {
NewTabPageTabHelper* NTPHelper =
NewTabPageTabHelper::FromWebState(self.webState);
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// 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_CONTENT_SUGGESTIONS_USER_ACCOUNT_IMAGE_UPDATE_DELEGATE_H_
#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_USER_ACCOUNT_IMAGE_UPDATE_DELEGATE_H_
// Delegate protocol to update UI with current user account avatar.
@protocol UserAccountImageUpdateDelegate
// Updates current user account avatar with supplied image.
- (void)updateAccountImage:(UIImage*)image;
@end
#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_USER_ACCOUNT_IMAGE_UPDATE_DELEGATE_H_
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