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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Chromoting.java

Issue 22657003: Fix crash when app is not yet authorized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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 | « remoting/android/java/AndroidManifest.xml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.accounts.Account; 7 import android.accounts.Account;
8 import android.accounts.AccountManager; 8 import android.accounts.AccountManager;
9 import android.accounts.AccountManagerCallback; 9 import android.accounts.AccountManagerCallback;
10 import android.accounts.AccountManagerFuture; 10 import android.accounts.AccountManagerFuture;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 /** Called to initialize the action bar. */ 141 /** Called to initialize the action bar. */
142 @Override 142 @Override
143 public boolean onCreateOptionsMenu(Menu menu) { 143 public boolean onCreateOptionsMenu(Menu menu) {
144 getMenuInflater().inflate(R.menu.chromoting_actionbar, menu); 144 getMenuInflater().inflate(R.menu.chromoting_actionbar, menu);
145 mRefreshButton = menu.findItem(R.id.actionbar_directoryrefresh); 145 mRefreshButton = menu.findItem(R.id.actionbar_directoryrefresh);
146 mAccountSwitcher = menu.findItem(R.id.actionbar_accountswitcher); 146 mAccountSwitcher = menu.findItem(R.id.actionbar_accountswitcher);
147 147
148 Account[] usableAccounts = AccountManager.get(this).getAccountsByType(AC COUNT_TYPE); 148 Account[] usableAccounts = AccountManager.get(this).getAccountsByType(AC COUNT_TYPE);
149 if (usableAccounts.length == 1 && mAccount.equals(usableAccounts[0])) { 149 if (usableAccounts.length == 1 && usableAccounts[0].equals(mAccount)) {
150 // If we're using the only available account, don't offer account sw itching. 150 // If we're using the only available account, don't offer account sw itching.
151 // (If there are *no* accounts available, clicking this allows you t o add a new one.) 151 // (If there are *no* accounts available, clicking this allows you t o add a new one.)
152 mAccountSwitcher.setEnabled(false); 152 mAccountSwitcher.setEnabled(false);
153 } 153 }
154 154
155 if (mAccount == null) { 155 if (mAccount == null) {
156 // If no account has been chosen, don't allow the user to refresh th e listing. 156 // If no account has been chosen, don't allow the user to refresh th e listing.
157 mRefreshButton.setEnabled(false); 157 mRefreshButton.setEnabled(false);
158 } else { 158 } else {
159 // If the user has picked an account, show its name directly on the account switcher. 159 // If the user has picked an account, show its name directly on the account switcher.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 Toast.LENGTH_LONG).show(); 414 Toast.LENGTH_LONG).show();
415 415
416 // Close the application. 416 // Close the application.
417 finish(); 417 finish();
418 } 418 }
419 419
420 return target; 420 return target;
421 } 421 }
422 } 422 }
423 } 423 }
OLDNEW
« no previous file with comments | « remoting/android/java/AndroidManifest.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698