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 { ...@@ -364,8 +364,8 @@ public abstract class AppHooks {
/** /**
* Returns a Chime Delegate if the chime module is defined. * Returns a Chime Delegate if the chime module is defined.
*/ */
public @Nullable ChimeDelegate getChimeDelegate() { public ChimeDelegate getChimeDelegate() {
return null; return new ChimeDelegate();
} }
public @Nullable ImageEditorModuleProvider getImageEditorModuleProvider() { public @Nullable ImageEditorModuleProvider getImageEditorModuleProvider() {
......
...@@ -139,9 +139,7 @@ public class ChromeActivitySessionTracker { ...@@ -139,9 +139,7 @@ public class ChromeActivitySessionTracker {
updateAcceptLanguages(); updateAcceptLanguages();
mVariationsSession.start(); mVariationsSession.start();
mPowerBroadcastReceiver.onForegroundSessionStart(); 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. // Track the ratio of Chrome startups that are caused by notification clicks.
// TODO(johnme): Add other reasons (and switch to recordEnumeratedHistogram). // TODO(johnme): Add other reasons (and switch to recordEnumeratedHistogram).
......
...@@ -143,6 +143,7 @@ public class ChromeApplication extends SplitCompatApplication { ...@@ -143,6 +143,7 @@ public class ChromeApplication extends SplitCompatApplication {
} }
BuildInfo.setFirebaseAppId(FirebaseConfig.getFirebaseAppId()); BuildInfo.setFirebaseAppId(FirebaseConfig.getFirebaseAppId());
AppHooks.get().getChimeDelegate().initialize();
if (!ContextUtils.isIsolatedProcess()) { if (!ContextUtils.isIsolatedProcess()) {
// Incremental install disables process isolation, so things in this block will // Incremental install disables process isolation, so things in this block will
......
...@@ -5,11 +5,16 @@ ...@@ -5,11 +5,16 @@
package org.chromium.chrome.browser.notifications.chime; package org.chromium.chrome.browser.notifications.chime;
/** /**
* Chime interface. * Delegate Chime notification SDK functionalities.
*/ */
public interface ChimeDelegate { public class ChimeDelegate {
/* /**
* Start a chime session. * 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