Commit 06ef5402 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Refactor]: Change WebappActivity#mWebappInfo -> #getWebappInfo()

This CL:
- Makes WebappActivity#mWebappInfo private
- Makes WebappActivity#getWebappInfo() public instead of package private

BUG=None

Change-Id: I3cec990487e8f6f01ecb4f832d9ae6269859c20a
Reviewed-on: https://chromium-review.googlesource.com/843817Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527073}
parent 3b575dac
...@@ -65,7 +65,7 @@ public class WebApkActivity extends WebappActivity { ...@@ -65,7 +65,7 @@ public class WebApkActivity extends WebappActivity {
@Override @Override
protected void initializeUI(Bundle savedInstance) { protected void initializeUI(Bundle savedInstance) {
super.initializeUI(savedInstance); super.initializeUI(savedInstance);
getActivityTab().setWebappManifestScope(mWebappInfo.scopeUri().toString()); getActivityTab().setWebappManifestScope(getWebappInfo().scopeUri().toString());
} }
@Override @Override
...@@ -120,7 +120,7 @@ public class WebApkActivity extends WebappActivity { ...@@ -120,7 +120,7 @@ public class WebApkActivity extends WebappActivity {
protected void onDeferredStartupWithStorage(WebappDataStorage storage) { protected void onDeferredStartupWithStorage(WebappDataStorage storage) {
super.onDeferredStartupWithStorage(storage); super.onDeferredStartupWithStorage(storage);
WebApkInfo info = (WebApkInfo) mWebappInfo; WebApkInfo info = (WebApkInfo) getWebappInfo();
WebApkUma.recordShellApkVersion(info.shellApkVersion(), info.apkPackageName()); WebApkUma.recordShellApkVersion(info.shellApkVersion(), info.apkPackageName());
mUpdateManager = new WebApkUpdateManager(storage); mUpdateManager = new WebApkUpdateManager(storage);
......
...@@ -52,7 +52,7 @@ public class WebApkDisclosureNotificationManager { ...@@ -52,7 +52,7 @@ public class WebApkDisclosureNotificationManager {
if (activityState == ActivityState.STARTED || activityState == ActivityState.RESUMED if (activityState == ActivityState.STARTED || activityState == ActivityState.RESUMED
|| activityState == ActivityState.PAUSED) { || activityState == ActivityState.PAUSED) {
sVisibleNotifications.add(packageName); sVisibleNotifications.add(packageName);
WebApkDisclosureNotificationManager.showDisclosure(activity.mWebappInfo); WebApkDisclosureNotificationManager.showDisclosure(activity.getWebappInfo());
} }
} }
......
...@@ -52,7 +52,7 @@ class WebappActionsNotificationManager { ...@@ -52,7 +52,7 @@ class WebappActionsNotificationManager {
if (!isEnabled() || mWebappActivity.getActivityTab() == null) return; if (!isEnabled() || mWebappActivity.getActivityTab() == null) return;
// All features provided by the notification are also available in the minimal-ui toolbar. // All features provided by the notification are also available in the minimal-ui toolbar.
if (mWebappActivity.mWebappInfo.displayMode() == WebDisplayMode.MINIMAL_UI) { if (mWebappActivity.getWebappInfo().displayMode() == WebDisplayMode.MINIMAL_UI) {
return; return;
} }
...@@ -82,7 +82,7 @@ class WebappActionsNotificationManager { ...@@ -82,7 +82,7 @@ class WebappActionsNotificationManager {
.createChromeNotificationBuilder( .createChromeNotificationBuilder(
true /* prefer compat */, ChannelDefinitions.CHANNEL_ID_WEBAPP_ACTIONS) true /* prefer compat */, ChannelDefinitions.CHANNEL_ID_WEBAPP_ACTIONS)
.setSmallIcon(R.drawable.ic_chrome) .setSmallIcon(R.drawable.ic_chrome)
.setContentTitle(mWebappActivity.mWebappInfo.shortName()) .setContentTitle(mWebappActivity.getWebappInfo().shortName())
.setContentText(mWebappActivity.getString(R.string.webapp_tap_to_copy_url)) .setContentText(mWebappActivity.getString(R.string.webapp_tap_to_copy_url))
.setShowWhen(false) .setShowWhen(false)
.setAutoCancel(false) .setAutoCancel(false)
......
...@@ -104,7 +104,7 @@ public class WebappActivity extends SingleTabActivity { ...@@ -104,7 +104,7 @@ public class WebappActivity extends SingleTabActivity {
private final WebappActionsNotificationManager mNotificationManager; private final WebappActionsNotificationManager mNotificationManager;
private final WebappDirectoryManager mDirectoryManager; private final WebappDirectoryManager mDirectoryManager;
protected WebappInfo mWebappInfo; private WebappInfo mWebappInfo;
private WebappSplashScreenController mSplashController; private WebappSplashScreenController mSplashController;
...@@ -560,7 +560,7 @@ public class WebappActivity extends SingleTabActivity { ...@@ -560,7 +560,7 @@ public class WebappActivity extends SingleTabActivity {
* @return Structure containing data about the webapp currently displayed. * @return Structure containing data about the webapp currently displayed.
* The return value should not be cached. * The return value should not be cached.
*/ */
WebappInfo getWebappInfo() { public WebappInfo getWebappInfo() {
return mWebappInfo; return mWebappInfo;
} }
......
...@@ -67,11 +67,11 @@ class WebappBrowserControlsDelegate extends TabStateBrowserControlsVisibilityDel ...@@ -67,11 +67,11 @@ class WebappBrowserControlsDelegate extends TabStateBrowserControlsVisibilityDel
*/ */
static boolean shouldShowToolbarCloseButton(WebappActivity activity) { static boolean shouldShowToolbarCloseButton(WebappActivity activity) {
// Show if we're on the URL requiring browser controls, i.e. off-scope. // Show if we're on the URL requiring browser controls, i.e. off-scope.
return shouldShowBrowserControlsForUrl(activity.scopePolicy(), activity.mWebappInfo, return shouldShowBrowserControlsForUrl(activity.scopePolicy(), activity.getWebappInfo(),
activity.getActivityTab().getUrl()) activity.getActivityTab().getUrl())
// Also keep shown if toolbar is not visible, so that during the in and off-scope // Also keep shown if toolbar is not visible, so that during the in and off-scope
// transitions we avoid button flickering when toolbar is appearing/disappearing. // transitions we avoid button flickering when toolbar is appearing/disappearing.
|| !shouldShowBrowserControls(activity.scopePolicy(), activity.mWebappInfo, || !shouldShowBrowserControls(activity.scopePolicy(), activity.getWebappInfo(),
activity.getActivityTab().getUrl(), activity.getActivityTab().getUrl(),
activity.getActivityTab().getSecurityLevel(), activity.getActivityTab().getSecurityLevel(),
activity.getBrowserSession() != null && activity.didVerificationFail()); activity.getBrowserSession() != null && activity.didVerificationFail());
......
...@@ -90,9 +90,9 @@ public class WebappInterceptNavigationDelegate extends InterceptNavigationDelega ...@@ -90,9 +90,9 @@ public class WebappInterceptNavigationDelegate extends InterceptNavigationDelega
navigationParams, mActivity.getWebappInfo(), mActivity.scopePolicy())) { navigationParams, mActivity.getWebappInfo(), mActivity.scopePolicy())) {
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setShowTitle(true); intentBuilder.setShowTitle(true);
if (mActivity.mWebappInfo.hasValidThemeColor()) { if (mActivity.getWebappInfo().hasValidThemeColor()) {
// Need to cast as themeColor is a long to contain possible error results. // Need to cast as themeColor is a long to contain possible error results.
intentBuilder.setToolbarColor((int) mActivity.mWebappInfo.themeColor()); intentBuilder.setToolbarColor((int) mActivity.getWebappInfo().themeColor());
} }
CustomTabsIntent customTabIntent = intentBuilder.build(); CustomTabsIntent customTabIntent = intentBuilder.build();
customTabIntent.intent.setPackage(mActivity.getPackageName()); customTabIntent.intent.setPackage(mActivity.getPackageName());
...@@ -101,7 +101,7 @@ public class WebappInterceptNavigationDelegate extends InterceptNavigationDelega ...@@ -101,7 +101,7 @@ public class WebappInterceptNavigationDelegate extends InterceptNavigationDelega
customTabIntent.intent.putExtra(CustomTabIntentDataProvider.EXTRA_BROWSER_LAUNCH_SOURCE, customTabIntent.intent.putExtra(CustomTabIntentDataProvider.EXTRA_BROWSER_LAUNCH_SOURCE,
mActivity.getActivityType()); mActivity.getActivityType());
customTabIntent.intent.putExtra( customTabIntent.intent.putExtra(
Browser.EXTRA_APPLICATION_ID, mActivity.mWebappInfo.apkPackageName()); Browser.EXTRA_APPLICATION_ID, mActivity.getWebappInfo().apkPackageName());
if (shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent()) { if (shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent()) {
customTabIntent.intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); customTabIntent.intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
......
...@@ -192,7 +192,7 @@ public class WebappLauncherActivity extends Activity { ...@@ -192,7 +192,7 @@ public class WebappLauncherActivity extends Activity {
continue; continue;
} }
WebappActivity webappActivity = (WebappActivity) activity; WebappActivity webappActivity = (WebappActivity) activity;
if (!TextUtils.equals(webappActivity.mWebappInfo.id(), info.id())) { if (!TextUtils.equals(webappActivity.getWebappInfo().id(), info.id())) {
activity.finish(); activity.finish();
} }
break; break;
......
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