Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaDelegate.java

Issue 2686783003: Revert of [Omaha] Make the whole pipeline run each time (patchset #4 id:60001 of https://codereview… (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.omaha;
6
7 import android.app.Service;
8 import android.content.Context;
9
10 import org.chromium.chrome.browser.omaha.OmahaClient.PostResult;
11
12 /** Delegates calls out from the OmahaClient. */
13 public abstract class OmahaDelegate {
14 protected final Context mContext;
15 private RequestGenerator mRequestGenerator;
16
17 OmahaDelegate(Context context) {
18 mContext = context;
19 }
20
21 /** @return Context that is used to interact with the system. */
22 Context getContext() {
23 return mContext;
24 }
25
26 /** @return Whether Chrome is installed as part of the system image. */
27 abstract boolean isInSystemImage();
28
29 /** @return The scheduler used to trigger jobs. */
30 abstract ExponentialBackoffScheduler getScheduler();
31
32 /** @return The {@link RequestGenerator} used to create Omaha XML. */
33 final RequestGenerator getRequestGenerator() {
34 if (mRequestGenerator == null) mRequestGenerator = createRequestGenerato r(getContext());
35 return mRequestGenerator;
36 }
37
38 /** @return A UUID that can be used to identify particular requests. */
39 abstract String generateUUID();
40
41 /** Determine whether or not Chrome is currently being used actively. */
42 abstract boolean isChromeBeingUsed();
43
44 /**
45 * Schedules the {@link Service} to run again at the given time.
46 * @param service Service that is doing the scheduling.
47 * @param nextTimestampMs When the service should be run again.
48 */
49 abstract void scheduleService(Service service, long nextTimestampMs);
50
51 /** Creates a {@link RequestGenerator}. */
52 abstract RequestGenerator createRequestGenerator(Context context);
53
54 /**
55 * Called when {@link OmahaClient#registerNewRequest} finishes.
56 * @param timestampRequestMs When the next active user request should be gen erated.
57 * @param timestampPostMs Earliest time the next POST should be allowed.
58 */
59 void onRegisterNewRequestDone(long timestampRequestMs, long timestampPostMs) {}
60
61 /**
62 * Called when {@link OmahaClient#handlePostRequest} finishes.
63 * @param result See {@link PostResult}.
64 * @param installEventWasSent Whether or not an install event was sent.
65 */
66 void onHandlePostRequestDone(@PostResult int result, boolean installEventWas Sent) {}
67
68 /**
69 * Called when {@link OmahaClient#generateAndPostRequest} finishes.
70 * @param succeeded Whether or not the post was successfully received by the server.
71 */
72 void onGenerateAndPostRequestDone(boolean succeeded) {}
73
74 /**
75 * Called when {@link OmahaClient#saveState} finishes.
76 * @param timestampRequestMs When the next active user request should be gen erated.
77 * @param timestampPostMs Earliest time the next POST should be allowed.
78 */
79 void onSaveStateDone(long timestampRequestMs, long timestampPostMs) {}
80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698