0

Remove unused parameter in HelpAndFeedback

Remove unused context parameter in HelpAndFeedback's getInstance method.

Also fix presubmit errors in affected files.

Change-Id: I74d7f3bccedbf29f516554ffc53b20374edd6565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814394
Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698519}
This commit is contained in:
Natalie Chouinard
2019-09-20 16:51:33 +00:00
committed by Commit Bot
parent 440de562a1
commit ffde52fef9
19 changed files with 53 additions and 49 deletions

@ -77,7 +77,7 @@ class AssistantCoordinator {
* Show the Chrome feedback form.
*/
public void showFeedback(String debugContext) {
HelpAndFeedback.getInstance(mActivity).showFeedback(mActivity, Profile.getLastUsedProfile(),
HelpAndFeedback.getInstance().showFeedback(mActivity, Profile.getLastUsedProfile(),
mActivity.getActivityTab().getUrl(), FEEDBACK_CATEGORY_TAG,
FeedbackContext.buildContextString(mActivity, debugContext, 4));
}

@ -189,7 +189,7 @@ public class VrShellDelegate
private long mNativeVrShellDelegate;
/* package */ final static class VrUnsupportedException extends RuntimeException {}
/* package */ static final class VrUnsupportedException extends RuntimeException {}
private static final class VrLifecycleObserver
implements ApplicationStatus.ActivityStateListener {
@ -247,8 +247,9 @@ public class VrShellDelegate
}
// We add a black overlay view so that we can show black while the VR UI is loading.
if (!sInstance.mInVr)
if (!sInstance.mInVr) {
VrModuleProvider.getDelegate().addBlackOverlayViewForActivity(sInstance.mActivity);
}
// For headset insertion handling it should be impossible in practice to receive this
// broadcast after being resumed. However, with VR entry flows skipped, these events
@ -395,8 +396,9 @@ public class VrShellDelegate
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return;
if (sInstance != null) return; // Will be handled in onResume.
if (!VrModuleProvider.getDelegate().activitySupportsVrBrowsing(activity)
&& sRegisteredVrAssetsComponent)
&& sRegisteredVrAssetsComponent) {
return;
}
// Short-circuit the asnyc task if we've already queried support level previously. Creating
// the async task takes ~1ms on my Android Go device.
@ -597,8 +599,9 @@ public class VrShellDelegate
if (sInstance != null) sInstance.setExpectingIntent(false);
if (VrDelegate.DEBUG_LOGS)
if (VrDelegate.DEBUG_LOGS) {
Log.i(TAG, "maybeHandleVrIntentPreNative: preparing for transition");
}
// We add a black overlay view so that we can show black while the VR UI is loading.
// Note that this alone isn't sufficient to prevent 2D UI from showing when
@ -798,10 +801,9 @@ public class VrShellDelegate
private static void startFeedback(Tab tab) {
// TODO(ymalik): This call will connect to the Google Services api which can be slow. Can we
// connect to it beforehand when we know that we'll be prompting for feedback?
HelpAndFeedback.getInstance(tab.getActivity())
.showFeedback(tab.getActivity(), tab.getProfile(), tab.getUrl(),
ContextUtils.getApplicationContext().getPackageName() + "."
+ FEEDBACK_REPORT_TYPE);
HelpAndFeedback.getInstance().showFeedback(tab.getActivity(), tab.getProfile(),
tab.getUrl(),
ContextUtils.getApplicationContext().getPackageName() + "." + FEEDBACK_REPORT_TYPE);
}
private static void promptForFeedback(final Tab tab) {
@ -1173,9 +1175,10 @@ public class VrShellDelegate
return;
}
if (!mInVr)
if (!mInVr) {
VrShellDelegateJni.get().recordVrStartAction(
mNativeVrShellDelegate, VrStartAction.INTENT_LAUNCH);
}
mStartedFromVrIntent = true;
// Setting DON succeeded will cause us to enter VR when resuming.
@ -1468,8 +1471,9 @@ public class VrShellDelegate
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
try {
if (mNativeVrShellDelegate != 0)
if (mNativeVrShellDelegate != 0) {
VrShellDelegateJni.get().onResume(mNativeVrShellDelegate, VrShellDelegate.this);
}
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
@ -1556,8 +1560,9 @@ public class VrShellDelegate
}
if (mInVr) mVrShell.pause();
if (mNativeVrShellDelegate != 0)
if (mNativeVrShellDelegate != 0) {
VrShellDelegateJni.get().onPause(mNativeVrShellDelegate, VrShellDelegate.this);
}
mIsDaydreamCurrentViewer = null;
}
@ -1654,8 +1659,9 @@ public class VrShellDelegate
@CalledByNative
private void setListeningForWebVrActivate(boolean listening) {
if (VrDelegate.DEBUG_LOGS)
if (VrDelegate.DEBUG_LOGS) {
Log.i(TAG, "WebVR page listening for vrdisplayactivate: " + listening);
}
// Non-Daydream devices do not have the concept of activation.
if (getVrSupportLevel() != VrSupportLevel.VR_DAYDREAM) return;
if (mListeningForWebVrActivate == listening) return;
@ -1953,8 +1959,9 @@ public class VrShellDelegate
private void destroy() {
if (sInstance == null) return;
shutdownVr(false /* disableVrMode */, false /* stayingInChrome */);
if (mNativeVrShellDelegate != 0)
if (mNativeVrShellDelegate != 0) {
VrShellDelegateJni.get().destroy(mNativeVrShellDelegate, VrShellDelegate.this);
}
mNativeVrShellDelegate = 0;
sInstance = null;
}

@ -2205,7 +2205,7 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
// before starting the GoogleHelp.
String helpContextId = HelpAndFeedback.getHelpContextIdFromUrl(
this, url, getCurrentTabModel().isIncognito());
HelpAndFeedback.getInstance(this).show(this, helpContextId, profile, url);
HelpAndFeedback.getInstance().show(this, helpContextId, profile, url);
RecordUserAction.record(recordAction);
}

@ -38,8 +38,7 @@ public class HelpAndFeedback {
/**
* Returns the singleton instance of HelpAndFeedback, creating it if needed.
*/
// TODO(chouinard): Remove unused context parameter.
public static HelpAndFeedback getInstance(Context context) {
public static HelpAndFeedback getInstance() {
ThreadUtils.assertOnUiThread();
if (sInstance == null) {
sInstance = AppHooks.get().createHelpAndFeedback();

@ -42,7 +42,7 @@ public class IncognitoNewTabPage
private final int mIncognitoNTPBackgroundColor;
private void showIncognitoLearnMore() {
HelpAndFeedback.getInstance(mActivity).show(mActivity,
HelpAndFeedback.getInstance().show(mActivity,
mActivity.getString(R.string.help_context_incognito_learn_more),
Profile.getLastUsedProfile(), null);
}

@ -51,7 +51,7 @@ public class LearnMorePreference extends Preference {
@Override
protected void onClick() {
Activity activity = ContextUtils.activityFromContext(getContext());
HelpAndFeedback.getInstance(activity).show(
HelpAndFeedback.getInstance().show(
activity, activity.getString(mHelpContext), Profile.getLastUsedProfile(), null);
}

@ -263,7 +263,7 @@ public class Preferences extends ChromeBaseAppCompatActivity
finish();
return true;
} else if (item.getItemId() == R.id.menu_id_general_help) {
HelpAndFeedback.getInstance(this).show(this, getString(R.string.help_context_settings),
HelpAndFeedback.getInstance().show(this, getString(R.string.help_context_settings),
Profile.getLastUsedProfile(), null);
return true;
}

@ -105,9 +105,9 @@ public class DataReductionPreferenceFragment extends PreferenceFragmentCompat {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_data_reduction),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_data_reduction), Profile.getLastUsedProfile(),
null);
return true;
}
return false;

@ -177,9 +177,8 @@ public class SavePasswordsPreferences
return true;
}
if (id == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_passwords),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_passwords), Profile.getLastUsedProfile(), null);
return true;
}
return super.onOptionsItemSelected(item);

@ -188,9 +188,9 @@ public class ClearBrowsingDataTabsFragment extends Fragment {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_clear_browsing_data),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_clear_browsing_data),
Profile.getLastUsedProfile(), null);
return true;
}
return false;

@ -157,9 +157,8 @@ public class PrivacyPreferences
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_privacy),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_privacy), Profile.getLastUsedProfile(), null);
return true;
}
return false;

@ -166,9 +166,9 @@ public class ManageSyncPreferences extends PreferenceFragmentCompat
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_sync_and_services),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_sync_and_services),
Profile.getLastUsedProfile(), null);
return true;
}
return false;

@ -265,9 +265,9 @@ public class SyncAndServicesPreferences extends PreferenceFragmentCompat
showCancelSyncDialog();
return true;
} else if (item.getItemId() == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_sync_and_services),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_sync_and_services),
Profile.getLastUsedProfile(), null);
return true;
}
return false;

@ -130,9 +130,8 @@ public class ChosenObjectPreferences extends PreferenceFragmentCompat {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_settings),
Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(getActivity(),
getString(R.string.help_context_settings), Profile.getLastUsedProfile(), null);
return true;
}
return false;
@ -157,10 +156,11 @@ public class ChosenObjectPreferences extends PreferenceFragmentCompat {
public void revokeObjectPermissions() {
boolean hasManagedObject = false;
for (ChosenObjectInfo info : mObjectInfos) {
if (info.isManaged())
if (info.isManaged()) {
hasManagedObject = true;
else
} else {
info.revoke();
}
}
// Managed objects cannot be revoked, so finish the activity only if the list did not

@ -390,7 +390,7 @@ public class SingleCategoryPreferences extends PreferenceFragmentCompat
if (mCategory.showSites(SiteSettingsCategory.Type.PROTECTED_MEDIA)) {
helpContextResId = R.string.help_context_protected_content;
}
HelpAndFeedback.getInstance(getActivity()).show(
HelpAndFeedback.getInstance().show(
getActivity(), getString(helpContextResId), Profile.getLastUsedProfile(), null);
return true;
}

@ -76,7 +76,7 @@ public class PassphraseCreationDialogFragment extends DialogFragment {
new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() {
@Override
public void onClick(View view) {
HelpAndFeedback.getInstance(activity).show(activity,
HelpAndFeedback.getInstance().show(activity,
activity.getString(R.string.help_context_change_sync_passphrase),
Profile.getLastUsedProfile(), null);
}

@ -182,8 +182,8 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL
new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() {
@Override
public void onClick(View view) {
HelpAndFeedback help = HelpAndFeedback.getInstance(getActivity());
help.show(getActivity(), helpContext, Profile.getLastUsedProfile(), null);
HelpAndFeedback.getInstance().show(
getActivity(), helpContext, Profile.getLastUsedProfile(), null);
}
}));
}

@ -89,7 +89,7 @@ public class SadTab extends EmptyTabObserver implements UserData {
public void run() {
Activity activity = mTab.getWindowAndroid().getActivity().get();
assert activity != null;
HelpAndFeedback.getInstance(activity).show(activity,
HelpAndFeedback.getInstance().show(activity,
activity.getString(R.string.help_context_sad_tab),
Profile.getLastUsedProfile(), null);
}

@ -176,7 +176,7 @@ public class EditorDialog
/** Launches the Autofill help page on top of the current Context. */
public static void launchAutofillHelpPage(Context context) {
HelpAndFeedback.getInstance(context).show((Activity) context,
HelpAndFeedback.getInstance().show((Activity) context,
context.getString(R.string.help_context_autofill), Profile.getLastUsedProfile(),
null);
}