Commit 24038970 authored by Tina Wang's avatar Tina Wang Committed by Commit Bot

[ProfileCard] Add ProfileCardCoordinatorFactory to create coordinator instance

- Added ProfildCardCoordinatorFactory to internal directory
- Auto generate ProfileCardCoordinatorFactory to public directory
- Added factory build target
- Added dependency to higher level target
- More info refer to go/chrome-hoa

Bug: 1058408
Change-Id: Ie6c31e716fd86b0febdf405f7db516ae4dae9c79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087695
Commit-Queue: Tina Wang <tinazwang@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarsebsg <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747849}
parent df8a0343
......@@ -273,6 +273,7 @@ android_library("chrome_java") {
"//chrome/browser/notifications/chime/android:java",
"//chrome/browser/performance_hints/android:java",
"//chrome/browser/preferences:java",
"//chrome/browser/profile_card/android:factory_java",
"//chrome/browser/profile_card/android:java",
"//chrome/browser/settings:java",
"//chrome/browser/share/android:java_resources",
......
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/android/rules.gni")
import("//chrome/android/features/android_library_factory_tmpl.gni")
android_library("java") {
sources = [
......@@ -19,3 +20,8 @@ android_library("java") {
"//third_party/android_deps:androidx_annotation_annotation_java",
]
}
android_library_factory("factory_java") {
deps = [ ":java" ]
sources = [ "java/src/org/chromium/chrome/browser/profile_card/ProfileCardCoordinatorFactory.java" ]
}
......@@ -9,6 +9,7 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/profile_card/ContentPreviewPostView.java",
"java/src/org/chromium/chrome/browser/profile_card/EntryPointCoordinatorImpl.java",
"java/src/org/chromium/chrome/browser/profile_card/EntryPointView.java",
"java/src/org/chromium/chrome/browser/profile_card/ProfileCardCoordinatorFactory.java",
"java/src/org/chromium/chrome/browser/profile_card/ProfileCardCoordinatorImpl.java",
"java/src/org/chromium/chrome/browser/profile_card/ProfileCardMediator.java",
"java/src/org/chromium/chrome/browser/profile_card/ProfileCardProperties.java",
......
......@@ -16,7 +16,7 @@ import org.chromium.content_public.browser.NavigationHandle;
*/
public class EntryPointCoordinatorImpl implements EntryPointCoordinator {
private EntryPointView mView;
private ProfileCardCoordinatorImpl mProfileCardCoordinator;
private ProfileCardCoordinator mProfileCardCoordinator;
private CreatorMetadata mCreatorMetadata;
@Override
......@@ -47,7 +47,8 @@ public class EntryPointCoordinatorImpl implements EntryPointCoordinator {
}
void showProfileCard() {
mProfileCardCoordinator.init(mView, mCreatorMetadata);
mProfileCardCoordinator =
ProfileCardCoordinatorFactory.createProfileCardCoordinator(mView, mCreatorMetadata);
mProfileCardCoordinator.show();
}
}
// Copyright 2020 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.
package org.chromium.chrome.browser.profile_card;
import android.view.View;
/** The factory for creating a {@link ProfileCardCoordinator}. */
public class ProfileCardCoordinatorFactory {
ProfileCardCoordinatorFactory() {}
/**
* Create a new profile card coordinator.
* @param view The {@link View} triggers the profile card.
* @param CreatorMetadata The {@link CreatorMetadata} stores all data needed by profile card.
*/
public static ProfileCardCoordinator createProfileCardCoordinator(
View anchorView, CreatorMetadata creatorMetadata) {
return new ProfileCardCoordinatorImpl(anchorView, creatorMetadata);
}
}
......@@ -21,8 +21,12 @@ public class ProfileCardCoordinatorImpl implements ProfileCardCoordinator {
private PropertyModelChangeProcessor mModelChangeProcessor;
private CreatorMetadata mCreatorMetadata;
@Override
public void init(View anchorView, CreatorMetadata creatorMetadata) {
/**
* Construct a new profile card coordinator.
* @param view The {@link View} triggers the profile card.
* @param CreatorMetadata The {@link CreatorMetadata} stores all data needed by profile card.
*/
ProfileCardCoordinatorImpl(View anchorView, CreatorMetadata creatorMetadata) {
ViewRectProvider rectProvider = new ViewRectProvider(anchorView);
mView = new ProfileCardView(anchorView.getContext(), anchorView, /*stringId=*/"",
/*accessibilityStringId=*/"", rectProvider);
......
......@@ -4,16 +4,8 @@
package org.chromium.chrome.browser.profile_card;
import android.view.View;
/** Interface for the Profile Card related UI. */
public interface ProfileCardCoordinator {
/**
* Initiates the profile card coordinator.
* @param view {@link View} triggers the profile card.
* @param CreatorMetadata {@link CreatorMetadata} stores all data needed by profile card.
*/
void init(View view, CreatorMetadata creatorMetadata);
/**
* Shows the profile card.
......
// Copyright 2020 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.
//
// This file is autogenerated by
// chrome/android/features/create_stripped_java_factory.py
// Please do not change its content.
package org.chromium.chrome.browser.profile_card;
import android.view.View;
public class ProfileCardCoordinatorFactory {
public static ProfileCardCoordinator createProfileCardCoordinator(
View anchorView, CreatorMetadata creatorMetadata) {
return null;
}
}
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