OLD | NEW |
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.signin; | 5 package org.chromium.chrome.browser.signin; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.provider.Settings; | 9 import android.provider.Settings; |
10 import android.util.AttributeSet; | 10 import android.util.AttributeSet; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 mTitle.setText(R.string.sync_your_bookmarks); | 106 mTitle.setText(R.string.sync_your_bookmarks); |
107 } else { | 107 } else { |
108 mTitle.setVisibility(View.GONE); | 108 mTitle.setVisibility(View.GONE); |
109 } | 109 } |
110 | 110 |
111 // We don't call update() here as it will be called in onAttachedToWindo
w(). | 111 // We don't call update() here as it will be called in onAttachedToWindo
w(). |
112 } | 112 } |
113 | 113 |
114 private void update() { | 114 private void update() { |
115 ViewState viewState; | 115 ViewState viewState; |
116 if (!ChromeSigninController.get(getContext()).isSignedIn()) { | 116 if (!ChromeSigninController.get().isSignedIn()) { |
117 viewState = getStateForSignin(); | 117 viewState = getStateForSignin(); |
118 } else if (!AndroidSyncSettings.isMasterSyncEnabled(getContext())) { | 118 } else if (!AndroidSyncSettings.isMasterSyncEnabled(getContext())) { |
119 viewState = getStateForEnableAndroidSync(); | 119 viewState = getStateForEnableAndroidSync(); |
120 } else if (!AndroidSyncSettings.isChromeSyncEnabled(getContext())) { | 120 } else if (!AndroidSyncSettings.isChromeSyncEnabled(getContext())) { |
121 viewState = getStateForEnableChromeSync(); | 121 viewState = getStateForEnableChromeSync(); |
122 } else { | 122 } else { |
123 viewState = getStateForStartUsing(); | 123 viewState = getStateForStartUsing(); |
124 } | 124 } |
125 viewState.apply(mDescription, mPositiveButton, mNegativeButton); | 125 viewState.apply(mDescription, mPositiveButton, mNegativeButton); |
126 } | 126 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 public void onSignedOut() { | 286 public void onSignedOut() { |
287 update(); | 287 update(); |
288 } | 288 } |
289 | 289 |
290 // AndroidSyncStateObserver | 290 // AndroidSyncStateObserver |
291 @Override | 291 @Override |
292 public void androidSyncSettingsChanged() { | 292 public void androidSyncSettingsChanged() { |
293 update(); | 293 update(); |
294 } | 294 } |
295 } | 295 } |
OLD | NEW |