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

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

Issue 1369903002: Android Chromoting: Add hooks for the official account-switcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add hooks for Google Play Services connection errors. Created 5 years, 2 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.chromoting.accountswitcher; 5 package org.chromium.chromoting.accountswitcher;
6 6
7 import android.content.Context; 7 import android.app.Activity;
8 8
9 /** 9 /**
10 * Factory class for creating AccountSwitcher implementations. This enables offi cial builds of 10 * Factory class for creating AccountSwitcher implementations. This enables offi cial builds of
11 * the project to implement an alternative account-switching UI. 11 * the project to implement an alternative account-switching UI.
12 */ 12 */
13 public class AccountSwitcherFactory { 13 public class AccountSwitcherFactory {
14 /** 14 /**
15 * The singleton instance of this class. This is provided by the Application context, so that 15 * The singleton instance of this class. This is provided by the Application context, so that
16 * different application builds can provide different implementations. It ha s to be 16 * different application builds can provide different implementations. It ha s to be
17 * dependency-injected, because the Application context is defined in a high er-level build 17 * dependency-injected, because the Application context is defined in a high er-level build
18 * target that depends on this code. 18 * target that depends on this code.
19 */ 19 */
20 private static AccountSwitcherFactory sInstance; 20 private static AccountSwitcherFactory sInstance;
21 21
22 /** Returns the instance. Should be called on the main thread. */ 22 /** Returns the instance. Should be called on the main thread. */
23 public static AccountSwitcherFactory getInstance() { 23 public static AccountSwitcherFactory getInstance() {
24 return sInstance; 24 return sInstance;
25 } 25 }
26 26
27 /** 27 /**
28 * Factory method to create an AccountSwitcher. This method returns the publ ic implementation, 28 * Factory method to create an AccountSwitcher. This method returns the publ ic implementation,
29 * but it can be overridden to provide an alternative account-switcher imple mentation. This is 29 * but it can be overridden to provide an alternative account-switcher imple mentation. This is
30 * called during the Activity's onCreate() handler. 30 * called during the Activity's onCreate() handler.
31 * @param context Context used for UI operations. 31 * @param activity Activity used for UI operations.
32 * @param callback Callback for receiving notifications from the account-swi tcher. 32 * @param callback Callback for receiving notifications from the account-swi tcher.
33 */ 33 */
34 public AccountSwitcher createAccountSwitcher(Context context, 34 public AccountSwitcher createAccountSwitcher(Activity activity,
35 AccountSwitcher.Callback callback) { 35 AccountSwitcher.Callback callback) {
36 return new AccountSwitcherBasic(context, callback); 36 return new AccountSwitcherBasic(activity, callback);
37 } 37 }
38 38
39 /** 39 /**
40 * Sets the global instance. Called by the Application context during initia lization before any 40 * Sets the global instance. Called by the Application context during initia lization before any
41 * Activity is created. 41 * Activity is created.
42 */ 42 */
43 public static void setInstance(AccountSwitcherFactory instance) { 43 public static void setInstance(AccountSwitcherFactory instance) {
44 sInstance = instance; 44 sInstance = instance;
45 } 45 }
46 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698