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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationServiceFactory.java

Issue 2801033002: Revert of Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Created 3 years, 8 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.chrome.browser.invalidation; 5 package org.chromium.chrome.browser.invalidation;
6 6
7 import android.content.Context;
8
7 import org.chromium.base.ThreadUtils; 9 import org.chromium.base.ThreadUtils;
8 import org.chromium.base.VisibleForTesting; 10 import org.chromium.base.VisibleForTesting;
9 import org.chromium.base.annotations.JNINamespace; 11 import org.chromium.base.annotations.JNINamespace;
10 import org.chromium.chrome.browser.profiles.Profile; 12 import org.chromium.chrome.browser.profiles.Profile;
11 import org.chromium.components.invalidation.InvalidationService; 13 import org.chromium.components.invalidation.InvalidationService;
12 14
13 import java.util.HashMap; 15 import java.util.HashMap;
14 import java.util.Map; 16 import java.util.Map;
15 17
16 /** 18 /**
(...skipping 17 matching lines...) Expand all
34 ThreadUtils.assertOnUiThread(); 36 ThreadUtils.assertOnUiThread();
35 InvalidationService service = sServiceMap.get(profile); 37 InvalidationService service = sServiceMap.get(profile);
36 if (service == null) { 38 if (service == null) {
37 service = nativeGetForProfile(profile); 39 service = nativeGetForProfile(profile);
38 sServiceMap.put(profile, service); 40 sServiceMap.put(profile, service);
39 } 41 }
40 return service; 42 return service;
41 } 43 }
42 44
43 @VisibleForTesting 45 @VisibleForTesting
44 public static InvalidationService getForTest() { 46 public static InvalidationService getForTest(Context context) {
45 return nativeGetForTest(); 47 return nativeGetForTest(context);
46 } 48 }
47 49
48 private static native InvalidationService nativeGetForProfile(Profile profil e); 50 private static native InvalidationService nativeGetForProfile(Profile profil e);
49 private static native InvalidationService nativeGetForTest(); 51 private static native InvalidationService nativeGetForTest(Context context);
50 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698