OLD | NEW |
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.services; | 5 package org.chromium.chrome.browser.services; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.util.Log; | 8 import android.util.Log; |
9 | 9 |
10 import org.chromium.base.ApplicationState; | 10 import org.chromium.base.ApplicationState; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 private GoogleServicesManager(Context context) { | 65 private GoogleServicesManager(Context context) { |
66 try { | 66 try { |
67 TraceEvent.begin("GoogleServicesManager.GoogleServicesManager"); | 67 TraceEvent.begin("GoogleServicesManager.GoogleServicesManager"); |
68 ThreadUtils.assertOnUiThread(); | 68 ThreadUtils.assertOnUiThread(); |
69 // We should store the application context, as we outlive any activi
ty which may create | 69 // We should store the application context, as we outlive any activi
ty which may create |
70 // us. | 70 // us. |
71 mContext = context.getApplicationContext(); | 71 mContext = context.getApplicationContext(); |
72 | 72 |
73 mChromeSigninController = ChromeSigninController.get(mContext); | 73 mChromeSigninController = ChromeSigninController.get(); |
74 mSigninHelper = SigninHelper.get(mContext); | 74 mSigninHelper = SigninHelper.get(mContext); |
75 | 75 |
76 // The sign out flow starts by clearing the signed in user in the Ch
romeSigninController | 76 // The sign out flow starts by clearing the signed in user in the Ch
romeSigninController |
77 // on the Java side, and then performs a sign out on the native side
. If there is a | 77 // on the Java side, and then performs a sign out on the native side
. If there is a |
78 // crash on the native side then the signin state may get out of syn
c. Make sure that | 78 // crash on the native side then the signin state may get out of syn
c. Make sure that |
79 // the native side is signed out if the Java side doesn't have a cur
rently signed in | 79 // the native side is signed out if the Java side doesn't have a cur
rently signed in |
80 // user. | 80 // user. |
81 SigninManager signinManager = SigninManager.get(mContext); | 81 SigninManager signinManager = SigninManager.get(mContext); |
82 if (!mChromeSigninController.isSignedIn() && signinManager.isSignedI
nOnNative()) { | 82 if (!mChromeSigninController.isSignedIn() && signinManager.isSignedI
nOnNative()) { |
83 Log.w(TAG, "Signed in state got out of sync, forcing native sign
out"); | 83 Log.w(TAG, "Signed in state got out of sync, forcing native sign
out"); |
(...skipping 24 matching lines...) Expand all Loading... |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 @Override | 111 @Override |
112 public void onApplicationStateChange(int newState) { | 112 public void onApplicationStateChange(int newState) { |
113 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { | 113 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
114 onMainActivityStart(); | 114 onMainActivityStart(); |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
OLD | NEW |