Commit caf01d8b authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Chime: Add initialize method in ChimeDelegate.

There is some effort to migrate the DFM declaration to downstream. This
CL adds an initialization function in ChimeDelegate.

Also polish the comment and make ChimeDelegate a class instead of
interface.

Bug: 1136305
Change-Id: I9e5e3c0f9bc029d38793767dc9293478c8ee1a58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2514588Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823361}
parent 44452272
......@@ -364,8 +364,8 @@ public abstract class AppHooks {
/**
* Returns a Chime Delegate if the chime module is defined.
*/
public @Nullable ChimeDelegate getChimeDelegate() {
return null;
public ChimeDelegate getChimeDelegate() {
return new ChimeDelegate();
}
public @Nullable ImageEditorModuleProvider getImageEditorModuleProvider() {
......
......@@ -139,9 +139,7 @@ public class ChromeActivitySessionTracker {
updateAcceptLanguages();
mVariationsSession.start();
mPowerBroadcastReceiver.onForegroundSessionStart();
if (AppHooks.get().getChimeDelegate() != null) {
AppHooks.get().getChimeDelegate().startSession();
}
AppHooks.get().getChimeDelegate().startSession();
// Track the ratio of Chrome startups that are caused by notification clicks.
// TODO(johnme): Add other reasons (and switch to recordEnumeratedHistogram).
......
......@@ -143,6 +143,7 @@ public class ChromeApplication extends SplitCompatApplication {
}
BuildInfo.setFirebaseAppId(FirebaseConfig.getFirebaseAppId());
AppHooks.get().getChimeDelegate().initialize();
if (!ContextUtils.isIsolatedProcess()) {
// Incremental install disables process isolation, so things in this block will
......
......@@ -5,11 +5,16 @@
package org.chromium.chrome.browser.notifications.chime;
/**
* Chime interface.
* Delegate Chime notification SDK functionalities.
*/
public interface ChimeDelegate {
/*
* Start a chime session.
public class ChimeDelegate {
/**
* Initializes Chime SDK.
*/
public default void startSession() {}
public void initialize() {}
/**
* Starts a Chime session.
*/
public void startSession() {}
}
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