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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/rlz/RevenueStats.java

Issue 2697933002: Remove factory methods from ChromeApplication. (Closed)
Patch Set: Rebase Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 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 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.rlz; 5 package org.chromium.chrome.browser.rlz;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.SharedPreferences; 8 import android.content.SharedPreferences;
9 9
10 import org.chromium.base.ContextUtils; 10 import org.chromium.base.ContextUtils;
11 import org.chromium.base.annotations.JNINamespace; 11 import org.chromium.base.annotations.JNINamespace;
12 import org.chromium.chrome.browser.ChromeApplication; 12 import org.chromium.chrome.browser.AppHooks;
13 import org.chromium.chrome.browser.tab.Tab; 13 import org.chromium.chrome.browser.tab.Tab;
14 14
15 import java.util.concurrent.atomic.AtomicReference; 15 import java.util.concurrent.atomic.AtomicReference;
16 16
17 /** 17 /**
18 * Utility class for managing revenue sharing information. 18 * Utility class for managing revenue sharing information.
19 */ 19 */
20 @JNINamespace("chrome::android") 20 @JNINamespace("chrome::android")
21 public class RevenueStats { 21 public class RevenueStats {
22 private static final String PREF_RLZ_NOTIFIED = "rlz_first_search_notified"; 22 private static final String PREF_RLZ_NOTIFIED = "rlz_first_search_notified";
23 23
24 // Use an AtomicReference since getInstance() can be called from multiple th reads. 24 // Use an AtomicReference since getInstance() can be called from multiple th reads.
25 private static AtomicReference<RevenueStats> sInstance = new AtomicReference <RevenueStats>(); 25 private static AtomicReference<RevenueStats> sInstance = new AtomicReference <RevenueStats>();
26 26
27 /** 27 /**
28 * Returns the singleton instance of ExternalAuthUtils, creating it if neede d. 28 * Returns the singleton instance of ExternalAuthUtils, creating it if neede d.
29 */ 29 */
30 public static RevenueStats getInstance() { 30 public static RevenueStats getInstance() {
31 if (sInstance.get() == null) { 31 if (sInstance.get() == null) {
32 ChromeApplication application = 32 sInstance.compareAndSet(null, AppHooks.get().createRevenueStatsInsta nce());
33 (ChromeApplication) ContextUtils.getApplicationContext();
34 sInstance.compareAndSet(null, application.createRevenueStatsInstance ());
35 } 33 }
36 return sInstance.get(); 34 return sInstance.get();
37 } 35 }
38 36
39 /** 37 /**
40 * Notifies tab creation event. 38 * Notifies tab creation event.
41 */ 39 */
42 public void tabCreated(Tab tab) {} 40 public void tabCreated(Tab tab) {}
43 41
44 /** 42 /**
(...skipping 25 matching lines...) Expand all
70 /** 68 /**
71 * Sets rlz value. 69 * Sets rlz value.
72 */ 70 */
73 protected static void setRlzParameterValue(String rlz) { 71 protected static void setRlzParameterValue(String rlz) {
74 nativeSetRlzParameterValue(rlz); 72 nativeSetRlzParameterValue(rlz);
75 } 73 }
76 74
77 private static native void nativeSetSearchClient(String client); 75 private static native void nativeSetSearchClient(String client);
78 private static native void nativeSetRlzParameterValue(String rlz); 76 private static native void nativeSetRlzParameterValue(String rlz);
79 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698