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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/locale/SogouPromoDialog.java

Issue 2921453003: Ensure promo dialogs are dismissed when activities are destroyed. (Closed)
Patch Set: Fix comment Created 3 years, 6 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 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.locale; 5 package org.chromium.chrome.browser.locale;
6 6
7 import android.content.Context; 7 import android.app.Activity;
8 import android.content.DialogInterface; 8 import android.content.DialogInterface;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.os.Bundle; 10 import android.os.Bundle;
11 import android.support.annotation.IntDef; 11 import android.support.annotation.IntDef;
12 import android.support.annotation.Nullable; 12 import android.support.annotation.Nullable;
13 import android.text.SpannableString; 13 import android.text.SpannableString;
14 import android.text.method.LinkMovementMethod; 14 import android.text.method.LinkMovementMethod;
15 import android.text.style.ClickableSpan; 15 import android.text.style.ClickableSpan;
16 import android.text.style.StyleSpan; 16 import android.text.style.StyleSpan;
17 import android.view.View; 17 import android.view.View;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 dismiss(); 61 dismiss();
62 } 62 }
63 }; 63 };
64 64
65 @UserChoice 65 @UserChoice
66 private int mChoice = CHOICE_BACK_KEY; 66 private int mChoice = CHOICE_BACK_KEY;
67 67
68 /** 68 /**
69 * Creates an instance of the dialog. 69 * Creates an instance of the dialog.
70 */ 70 */
71 public SogouPromoDialog( 71 public SogouPromoDialog(Activity activity, LocaleManager localeManager,
72 Context context, LocaleManager localeManager, @Nullable Callback<Boo lean> onDismissed) { 72 @Nullable Callback<Boolean> onDismissed) {
73 super(context); 73 super(activity);
74 mLocaleManager = localeManager; 74 mLocaleManager = localeManager;
75 setOnDismissListener(this); 75 setOnDismissListener(this);
76 setCanceledOnTouchOutside(false); 76 setCanceledOnTouchOutside(false);
77 mOnDismissedCallback = onDismissed; 77 mOnDismissedCallback = onDismissed;
78 } 78 }
79 79
80 @Override 80 @Override
81 protected DialogParams getDialogParams() { 81 protected DialogParams getDialogParams() {
82 PromoDialog.DialogParams params = new PromoDialog.DialogParams(); 82 PromoDialog.DialogParams params = new PromoDialog.DialogParams();
83 params.vectorDrawableResource = R.drawable.search_sogou; 83 params.vectorDrawableResource = R.drawable.search_sogou;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ContextUtils.getAppSharedPreferences() 147 ContextUtils.getAppSharedPreferences()
148 .edit() 148 .edit()
149 .putBoolean(LocaleManager.PREF_PROMO_SHOWN, true) 149 .putBoolean(LocaleManager.PREF_PROMO_SHOWN, true)
150 .apply(); 150 .apply();
151 RecordHistogram.recordEnumeratedHistogram( 151 RecordHistogram.recordEnumeratedHistogram(
152 "SpecialLocale.PromotionDialog", mChoice, CHOICE_ENUM_COUNT); 152 "SpecialLocale.PromotionDialog", mChoice, CHOICE_ENUM_COUNT);
153 153
154 if (mOnDismissedCallback != null) mOnDismissedCallback.onResult(true); 154 if (mOnDismissedCallback != null) mOnDismissedCallback.onResult(true);
155 } 155 }
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698