OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.components.background_task_scheduler; | 5 package org.chromium.components.background_task_scheduler; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.Bundle; | 8 import android.os.Bundle; |
9 import android.support.annotation.NonNull; | 9 import android.support.annotation.NonNull; |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 /** | 32 /** |
33 * @return the extras for this task. | 33 * @return the extras for this task. |
34 */ | 34 */ |
35 @NonNull | 35 @NonNull |
36 public Bundle getExtras() { | 36 public Bundle getExtras() { |
37 return mExtras; | 37 return mExtras; |
38 } | 38 } |
39 | 39 |
40 static Builder create(int taskId) { | 40 /** Creates a builder for task parameters. */ |
| 41 public static Builder create(int taskId) { |
41 return new Builder(taskId); | 42 return new Builder(taskId); |
42 } | 43 } |
43 | 44 |
44 static final class Builder { | 45 /** Class for building a task parameters object. Public for testing */ |
| 46 public static final class Builder { |
45 private final int mTaskId; | 47 private final int mTaskId; |
46 private Bundle mExtras; | 48 private Bundle mExtras; |
47 | 49 |
48 Builder(int taskId) { | 50 Builder(int taskId) { |
49 mTaskId = taskId; | 51 mTaskId = taskId; |
50 } | 52 } |
51 | 53 |
52 Builder addExtras(Bundle extras) { | 54 public Builder addExtras(Bundle extras) { |
53 mExtras = extras; | 55 mExtras = extras; |
54 return this; | 56 return this; |
55 } | 57 } |
56 | 58 |
57 TaskParameters build() { | 59 public TaskParameters build() { |
58 return new TaskParameters(this); | 60 return new TaskParameters(this); |
59 } | 61 } |
60 } | 62 } |
61 } | 63 } |
OLD | NEW |