0

[Android] Add getURL method to PageInfoMainController

Add getURL method in order to easy retrieve the current URL from page
info subpages.

Bug: 1225981
Change-Id: Icfea276a4e187e9b52317bdfe461d5dcc495bc69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3067071
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Robbie McElrath <rmcelrath@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Auto-Submit: Ehimare Okoyomon <eokoyomon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#908181}
This commit is contained in:
Ehimare Okoyomon
2021-08-03 23:02:29 +00:00
committed by Chromium LUCI CQ
parent f7a4e9edb1
commit 911e4a8725
8 changed files with 24 additions and 17 deletions
chrome/android/java/src/org/chromium/chrome/browser/page_info
components/page_info/android/java/src/org/chromium/components/page_info
weblayer/browser/java/org/chromium/weblayer_private

@ -218,8 +218,8 @@ public class ChromePageInfoControllerDelegate extends PageInfoControllerDelegate
@Override
public PageInfoSubpageController createHistoryController(
PageInfoMainController mainController, PageInfoRowView rowView, String host) {
return new PageInfoHistoryController(mainController, rowView, this, host);
PageInfoMainController mainController, PageInfoRowView rowView) {
return new PageInfoHistoryController(mainController, rowView, this);
}
/**

@ -48,12 +48,12 @@ public class PageInfoHistoryController
private long mLastVisitedTimestamp;
public PageInfoHistoryController(PageInfoMainController mainController, PageInfoRowView rowView,
PageInfoControllerDelegate delegate, String host) {
PageInfoControllerDelegate delegate) {
mMainController = mainController;
mRowView = rowView;
mDelegate = delegate;
mTitle = mRowView.getContext().getResources().getString(R.string.page_info_history_title);
mHost = host;
mHost = mainController.getURL().getHost();
mHistoryProvider = sProviderForTests != null
? sProviderForTests
: new BrowsingHistoryBridge(Profile.getLastUsedRegularProfile());

@ -250,14 +250,12 @@ public class PageInfoController implements PageInfoMainController, ModalDialogPr
// Create Subcontrollers.
mConnectionController = new PageInfoConnectionController(this, mView.getConnectionRowView(),
mWebContents, mDelegate, publisher, mIsInternalPage);
mPermissionsController =
new PageInfoPermissionsController(this, mView.getPermissionsRowView(), mDelegate,
mFullUrl.getSpec(), highlightedPermission);
mCookiesController = new PageInfoCookiesController(
this, mView.getCookiesRowView(), mDelegate, mFullUrl.getSpec());
mPermissionsController = new PageInfoPermissionsController(
this, mView.getPermissionsRowView(), mDelegate, highlightedPermission);
mCookiesController =
new PageInfoCookiesController(this, mView.getCookiesRowView(), mDelegate);
if (PageInfoFeatures.PAGE_INFO_HISTORY.isEnabled()) {
mHistoryController = mDelegate.createHistoryController(
this, mView.getHistoryRowView(), mFullUrl.getHost());
mHistoryController = mDelegate.createHistoryController(this, mView.getHistoryRowView());
// TODO(crbug.com/1173154): Setup forget this site button after history delete is
// implemented.
// setupForgetSiteButton(mView.getForgetSiteButton());
@ -547,4 +545,9 @@ public class PageInfoController implements PageInfoMainController, ModalDialogPr
public Activity getActivity() {
return mWindowAndroid.getActivity().get();
}
@Override
public GURL getURL() {
return mFullUrl;
}
}

@ -182,7 +182,7 @@ public abstract class PageInfoControllerDelegate {
*/
@Nullable
public abstract PageInfoSubpageController createHistoryController(
PageInfoMainController mainController, PageInfoRowView rowView, String host);
PageInfoMainController mainController, PageInfoRowView rowView);
/**
* @return Returns the browser context associated with this dialog.

@ -43,11 +43,11 @@ public class PageInfoCookiesController
private Website mWebsite;
public PageInfoCookiesController(PageInfoMainController mainController, PageInfoRowView rowView,
PageInfoControllerDelegate delegate, String fullUrl) {
PageInfoControllerDelegate delegate) {
mMainController = mainController;
mRowView = rowView;
mDelegate = delegate;
mFullUrl = fullUrl;
mFullUrl = mainController.getURL().getSpec();
mTitle = mRowView.getContext().getResources().getString(R.string.cookies_title);
mBridge = mDelegate.createCookieControlsBridge(this);

@ -9,6 +9,7 @@ import android.app.Activity;
import androidx.annotation.Nullable;
import org.chromium.components.embedder_support.browser_context.BrowserContextHandle;
import org.chromium.url.GURL;
/**
* Interface for a page info main page controller.
@ -41,4 +42,7 @@ public interface PageInfoMainController {
/** @return The Activity associated with the controller. */
@Nullable
Activity getActivity();
/** @return The GURL of the page associated with the controller. */
GURL getURL();
}

@ -53,12 +53,12 @@ public class PageInfoPermissionsController
new PageInfoDiscoverabilityMetrics();
public PageInfoPermissionsController(PageInfoMainController mainController,
PageInfoRowView view, PageInfoControllerDelegate delegate, String pageUrl,
PageInfoRowView view, PageInfoControllerDelegate delegate,
@ContentSettingsType int highlightedPermission) {
mMainController = mainController;
mRowView = view;
mDelegate = delegate;
mPageUrl = pageUrl;
mPageUrl = mainController.getURL().getSpec();
mHighlightedPermission = highlightedPermission;
Resources resources = mRowView.getContext().getResources();
mHighlightColor = resources.getColor(R.color.iph_highlight_blue);

@ -104,7 +104,7 @@ public class PageInfoControllerDelegateImpl extends PageInfoControllerDelegate {
@Override
@Nullable
public PageInfoSubpageController createHistoryController(
PageInfoMainController mainController, PageInfoRowView rowView, String host) {
PageInfoMainController mainController, PageInfoRowView rowView) {
return null;
}