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

Side by Side Diff: chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android .h" 5 #include "chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android .h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // TODO(miguelg): Test whether the Stop() and RemoveInfoBar() calls here are 92 // TODO(miguelg): Test whether the Stop() and RemoveInfoBar() calls here are
93 // necessary, or whether OpenURL() will do this for us. 93 // necessary, or whether OpenURL() will do this for us.
94 content::WebContents* contents = 94 content::WebContents* contents =
95 InfoBarService::WebContentsFromInfoBar(infobar()); 95 InfoBarService::WebContentsFromInfoBar(infobar());
96 contents->Stop(); 96 contents->Stop();
97 infobar()->RemoveSelf(); 97 infobar()->RemoveSelf();
98 // WARNING: |this| may be deleted at this point! Do not access any members! 98 // WARNING: |this| may be deleted at this point! Do not access any members!
99 contents->OpenURL(content::OpenURLParams( 99 contents->OpenURL(content::OpenURLParams(
100 GURL(base::android::ConvertJavaStringToUTF8(env, result)), 100 GURL(base::android::ConvertJavaStringToUTF8(env, result)),
101 content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, 101 content::Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_AUTO_BOOKMARK,
102 false)); 102 false));
103 } 103 }
104 104
105 void AutoLoginInfoBarDelegateAndroid::LoginFailed(JNIEnv* env, jobject obj) { 105 void AutoLoginInfoBarDelegateAndroid::LoginFailed(JNIEnv* env, jobject obj) {
106 if (!infobar()->owner()) 106 if (!infobar()->owner())
107 return; // We're closing; don't call anything, it might access the owner. 107 return; // We're closing; don't call anything, it might access the owner.
108 108
109 // TODO(miguelg): Using SimpleAlertInfoBarDelegate::Create() animates in a new 109 // TODO(miguelg): Using SimpleAlertInfoBarDelegate::Create() animates in a new
110 // infobar while we animate the current one closed. It would be better to use 110 // infobar while we animate the current one closed. It would be better to use
111 // ReplaceInfoBar(). 111 // ReplaceInfoBar().
112 InfoBarService* infobar_service = InfoBarService::FromWebContents( 112 InfoBarService* infobar_service = InfoBarService::FromWebContents(
113 InfoBarService::WebContentsFromInfoBar(infobar())); 113 InfoBarService::WebContentsFromInfoBar(infobar()));
114 DCHECK(infobar_service); 114 DCHECK(infobar_service);
115 SimpleAlertInfoBarDelegate::Create( 115 SimpleAlertInfoBarDelegate::Create(
116 infobar_service, IDR_INFOBAR_WARNING, 116 infobar_service, IDR_INFOBAR_WARNING,
117 l10n_util::GetStringUTF16(IDS_AUTO_LOGIN_FAILED), false); 117 l10n_util::GetStringUTF16(IDS_AUTO_LOGIN_FAILED), false);
118 infobar()->RemoveSelf(); 118 infobar()->RemoveSelf();
119 } 119 }
120 120
121 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { 121 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) {
122 infobar()->RemoveSelf(); 122 infobar()->RemoveSelf();
123 } 123 }
124 124
125 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { 125 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) {
126 return RegisterNativesImpl(env); 126 return RegisterNativesImpl(env);
127 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698