1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.chrome.shell.sync; 6 7import android.app.AlertDialog; 8import android.app.Dialog; 9import android.app.DialogFragment; 10import android.content.DialogInterface; 11import android.os.Bundle; 12 13import org.chromium.chrome.browser.signin.SigninManager; 14import org.chromium.chrome.shell.R; 15 16/** 17 * The fragment to show when the user is given the option to sign out of Chromium. 18 */ 19public class SignoutFragment extends DialogFragment implements DialogInterface.OnClickListener { 20 @Override 21 public Dialog onCreateDialog(Bundle savedInstanceState) { 22 return new AlertDialog.Builder(getActivity(), AlertDialog.THEME_HOLO_LIGHT) 23 .setTitle(R.string.signout_title) 24 .setPositiveButton(R.string.signout_sign_out, this) 25 .setNegativeButton(R.string.signout_cancel, this) 26 .create(); 27 } 28 29 @Override 30 public void onClick(DialogInterface dialog, int which) { 31 switch (which) { 32 case DialogInterface.BUTTON_POSITIVE: { 33 SigninManager.get(getActivity()).signOut(getActivity(), null); 34 break; 35 } 36 case DialogInterface.BUTTON_NEGATIVE: { 37 dismiss(); 38 break; 39 } 40 default: 41 break; 42 } 43 } 44} 45