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

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

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android compilation Created 6 years, 9 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 | Annotate | Revision Log
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_helper.h" 8 #include "base/android/jni_helper.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/infobars/infobar.h" 11 #include "chrome/browser/infobars/infobar.h"
12 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" 13 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
13 #include "chrome/browser/ui/auto_login_infobar_delegate.h" 14 #include "chrome/browser/ui/auto_login_infobar_delegate.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
17 #include "jni/AutoLoginDelegate_jni.h" 18 #include "jni/AutoLoginDelegate_jni.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 20
20 using base::android::ConvertUTF8ToJavaString; 21 using base::android::ConvertUTF8ToJavaString;
21 using base::android::ScopedJavaLocalRef; 22 using base::android::ScopedJavaLocalRef;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 false)); 99 false));
99 } 100 }
100 101
101 void AutoLoginInfoBarDelegateAndroid::LoginFailed(JNIEnv* env, jobject obj) { 102 void AutoLoginInfoBarDelegateAndroid::LoginFailed(JNIEnv* env, jobject obj) {
102 if (!infobar()->owner()) 103 if (!infobar()->owner())
103 return; // We're closing; don't call anything, it might access the owner. 104 return; // We're closing; don't call anything, it might access the owner.
104 105
105 // TODO(miguelg): Using SimpleAlertInfoBarDelegate::Create() animates in a new 106 // TODO(miguelg): Using SimpleAlertInfoBarDelegate::Create() animates in a new
106 // infobar while we animate the current one closed. It would be better to use 107 // infobar while we animate the current one closed. It would be better to use
107 // ReplaceInfoBar(). 108 // ReplaceInfoBar().
109 InfoBarService* infobar_service =
110 InfoBarService::FromWebContents(web_contents());
111 DCHECK(infobar_service);
108 SimpleAlertInfoBarDelegate::Create( 112 SimpleAlertInfoBarDelegate::Create(
109 infobar()->owner(), IDR_INFOBAR_WARNING, 113 infobar_service, IDR_INFOBAR_WARNING,
droger 2014/03/26 17:44:45 Note: this particular change is not trivial.
110 l10n_util::GetStringUTF16(IDS_AUTO_LOGIN_FAILED), false); 114 l10n_util::GetStringUTF16(IDS_AUTO_LOGIN_FAILED), false);
111 infobar()->RemoveSelf(); 115 infobar()->RemoveSelf();
112 } 116 }
113 117
114 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { 118 void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) {
115 infobar()->RemoveSelf(); 119 infobar()->RemoveSelf();
116 } 120 }
117 121
118 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { 122 bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) {
119 return RegisterNativesImpl(env); 123 return RegisterNativesImpl(env);
120 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698