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

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

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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 2015 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 /**
8 * Represents parameters for a single XML request to send to the server.
9 * Persisted requests (those that must be resent in case of failure) should use the same ID from
10 * the first failed attempt.
11 */
12 public class RequestData {
13 private final long mCreationTimestamp;
14 private final boolean mSendInstallEvent;
15 private final String mRequestID;
16 private final String mInstallSource;
17
18 public RequestData(boolean sendInstallEvent, long timeStamp, String requestI D,
19 String installSource) {
20 assert requestID != null;
21 mSendInstallEvent = sendInstallEvent;
22 mCreationTimestamp = timeStamp;
23 mRequestID = requestID;
24 mInstallSource = installSource;
25 }
26
27 /**
28 * Whether or not we are telling the server about a new install.
29 * False indicates a ping/updatecheck.
30 */
31 public boolean isSendInstallEvent() {
32 return mSendInstallEvent;
33 }
34
35 /**
36 * ID of the request we're sending to the server.
37 */
38 public String getRequestID() {
39 return mRequestID;
40 }
41
42 /**
43 * Get the age in milliseconds.
44 */
45 public long getAgeInMilliseconds(long currentTimestamp) {
46 return currentTimestamp - mCreationTimestamp;
47 }
48
49 /**
50 * Get the age in seconds.
51 */
52 public long getAgeInSeconds(long currentTimestamp) {
53 return getAgeInMilliseconds(currentTimestamp) / 1000;
54 }
55
56 /**
57 * Get the exact timestamp when this was created.
58 */
59 public long getCreationTimestamp() {
60 return mCreationTimestamp;
61 }
62
63 /**
64 * Get the install source for the APK. Values can include
65 * {@link OmahaClient#INSTALL_SOURCE_SYSTEM} or {@link OmahaClient#INSTALL_S OURCE_ORGANIC}.
66 */
67 public String getInstallSource() {
68 return mInstallSource;
69 }
70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698