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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java

Issue 2638653005: android: Record the source of account change notifications from GSA. (Closed)
Patch Set: Add OWNERS file, per tedchoc's suggestion. Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.gsa; 5 package org.chromium.chrome.browser.gsa;
6 6
7 import android.content.BroadcastReceiver; 7 import android.content.BroadcastReceiver;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.IntentFilter; 10 import android.content.IntentFilter;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return sInstance; 54 return sInstance;
55 } 55 }
56 56
57 private GSAAccountChangeListener(Context context) { 57 private GSAAccountChangeListener(Context context) {
58 Context applicationContext = context.getApplicationContext(); 58 Context applicationContext = context.getApplicationContext();
59 BroadcastReceiver accountChangeReceiver = new BroadcastReceiver() { 59 BroadcastReceiver accountChangeReceiver = new BroadcastReceiver() {
60 @Override 60 @Override
61 public void onReceive(Context context, Intent intent) { 61 public void onReceive(Context context, Intent intent) {
62 if (!ACCOUNT_UPDATE_BROADCAST_INTENT.equals(intent.getAction())) return; 62 if (!ACCOUNT_UPDATE_BROADCAST_INTENT.equals(intent.getAction())) return;
63 String accountName = intent.getStringExtra(BROADCAST_INTENT_ACCO UNT_NAME_EXTRA); 63 String accountName = intent.getStringExtra(BROADCAST_INTENT_ACCO UNT_NAME_EXTRA);
64 RecordHistogram.recordEnumeratedHistogram(GSAServiceClient.ACCOU NT_CHANGE_HISTOGRAM,
65 GSAServiceClient.ACCOUNT_CHANGE_SOURCE_BROADCAST,
66 GSAServiceClient.ACCOUNT_CHANGE_SOURCE_COUNT);
64 GSAState.getInstance(context.getApplicationContext()).setGsaAcco unt(accountName); 67 GSAState.getInstance(context.getApplicationContext()).setGsaAcco unt(accountName);
65 } 68 }
66 }; 69 };
67 applicationContext.registerReceiver(accountChangeReceiver, 70 applicationContext.registerReceiver(accountChangeReceiver,
68 new IntentFilter(ACCOUNT_UPDATE_BROADCAST_INTENT), 71 new IntentFilter(ACCOUNT_UPDATE_BROADCAST_INTENT),
69 ACCOUNT_UPDATE_BROADCAST_PERMISSION, null); 72 ACCOUNT_UPDATE_BROADCAST_PERMISSION, null);
70 73
71 createGsaClientAndConnect(applicationContext); 74 createGsaClientAndConnect(applicationContext);
72 75
73 // If some future version of GSA no longer broadcasts the account change 76 // If some future version of GSA no longer broadcasts the account change
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 public void disconnect() { 142 public void disconnect() {
140 mUsersCount--; 143 mUsersCount--;
141 if (mClient != null && mUsersCount == 0) mClient.disconnect(); 144 if (mClient != null && mUsersCount == 0) mClient.disconnect();
142 } 145 }
143 146
144 private void notifyGsaBroadcastsAccountChanges() { 147 private void notifyGsaBroadcastsAccountChanges() {
145 mClient.disconnect(); 148 mClient.disconnect();
146 mClient = null; 149 mClient = null;
147 } 150 }
148 } 151 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698